@ai-sdk/provider-utils 4.0.0-beta.41 → 4.0.0-beta.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -863,7 +863,7 @@ type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessag
|
|
|
863
863
|
/**
|
|
864
864
|
* Additional options that are sent into each tool call.
|
|
865
865
|
*/
|
|
866
|
-
interface
|
|
866
|
+
interface ToolExecutionOptions {
|
|
867
867
|
/**
|
|
868
868
|
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
869
869
|
*/
|
|
@@ -904,7 +904,7 @@ type ToolNeedsApprovalFunction<INPUT> = (input: INPUT, options: {
|
|
|
904
904
|
*/
|
|
905
905
|
experimental_context?: unknown;
|
|
906
906
|
}) => boolean | PromiseLike<boolean>;
|
|
907
|
-
type ToolExecuteFunction<INPUT, OUTPUT> = (input: INPUT, options:
|
|
907
|
+
type ToolExecuteFunction<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
908
908
|
type NeverOptional<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
909
909
|
type ToolOutputProperties<INPUT, OUTPUT> = NeverOptional<OUTPUT, {
|
|
910
910
|
/**
|
|
@@ -965,21 +965,21 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
|
|
|
965
965
|
* Optional function that is called when the argument streaming starts.
|
|
966
966
|
* Only called when the tool is used in a streaming context.
|
|
967
967
|
*/
|
|
968
|
-
onInputStart?: (options:
|
|
968
|
+
onInputStart?: (options: ToolExecutionOptions) => void | PromiseLike<void>;
|
|
969
969
|
/**
|
|
970
970
|
* Optional function that is called when an argument streaming delta is available.
|
|
971
971
|
* Only called when the tool is used in a streaming context.
|
|
972
972
|
*/
|
|
973
973
|
onInputDelta?: (options: {
|
|
974
974
|
inputTextDelta: string;
|
|
975
|
-
} &
|
|
975
|
+
} & ToolExecutionOptions) => void | PromiseLike<void>;
|
|
976
976
|
/**
|
|
977
977
|
* Optional function that is called when a tool call can be started,
|
|
978
978
|
* even if the execute function is not provided.
|
|
979
979
|
*/
|
|
980
980
|
onInputAvailable?: (options: {
|
|
981
981
|
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
982
|
-
} &
|
|
982
|
+
} & ToolExecutionOptions) => void | PromiseLike<void>;
|
|
983
983
|
} & ToolOutputProperties<INPUT, OUTPUT> & {
|
|
984
984
|
/**
|
|
985
985
|
Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
@@ -1143,7 +1143,7 @@ declare function withoutTrailingSlash(url: string | undefined): string | undefin
|
|
|
1143
1143
|
declare function executeTool<INPUT, OUTPUT>({ execute, input, options, }: {
|
|
1144
1144
|
execute: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
1145
1145
|
input: INPUT;
|
|
1146
|
-
options:
|
|
1146
|
+
options: ToolExecutionOptions;
|
|
1147
1147
|
}): AsyncGenerator<{
|
|
1148
1148
|
type: 'preliminary';
|
|
1149
1149
|
output: OUTPUT;
|
|
@@ -1211,4 +1211,9 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1211
1211
|
dynamic?: boolean;
|
|
1212
1212
|
}
|
|
1213
1213
|
|
|
1214
|
-
|
|
1214
|
+
/**
|
|
1215
|
+
* @deprecated Use ToolExecutionOptions instead.
|
|
1216
|
+
*/
|
|
1217
|
+
type ToolCallOptions = ToolExecutionOptions;
|
|
1218
|
+
|
|
1219
|
+
export { type AssistantContent, type AssistantModelMessage, type DataContent, DelayedPromise, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -863,7 +863,7 @@ type ModelMessage = SystemModelMessage | UserModelMessage | AssistantModelMessag
|
|
|
863
863
|
/**
|
|
864
864
|
* Additional options that are sent into each tool call.
|
|
865
865
|
*/
|
|
866
|
-
interface
|
|
866
|
+
interface ToolExecutionOptions {
|
|
867
867
|
/**
|
|
868
868
|
* The ID of the tool call. You can use it e.g. when sending tool-call related information with stream data.
|
|
869
869
|
*/
|
|
@@ -904,7 +904,7 @@ type ToolNeedsApprovalFunction<INPUT> = (input: INPUT, options: {
|
|
|
904
904
|
*/
|
|
905
905
|
experimental_context?: unknown;
|
|
906
906
|
}) => boolean | PromiseLike<boolean>;
|
|
907
|
-
type ToolExecuteFunction<INPUT, OUTPUT> = (input: INPUT, options:
|
|
907
|
+
type ToolExecuteFunction<INPUT, OUTPUT> = (input: INPUT, options: ToolExecutionOptions) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT;
|
|
908
908
|
type NeverOptional<N, T> = 0 extends 1 & N ? Partial<T> : [N] extends [never] ? Partial<Record<keyof T, undefined>> : T;
|
|
909
909
|
type ToolOutputProperties<INPUT, OUTPUT> = NeverOptional<OUTPUT, {
|
|
910
910
|
/**
|
|
@@ -965,21 +965,21 @@ type Tool<INPUT extends JSONValue | unknown | never = any, OUTPUT extends JSONVa
|
|
|
965
965
|
* Optional function that is called when the argument streaming starts.
|
|
966
966
|
* Only called when the tool is used in a streaming context.
|
|
967
967
|
*/
|
|
968
|
-
onInputStart?: (options:
|
|
968
|
+
onInputStart?: (options: ToolExecutionOptions) => void | PromiseLike<void>;
|
|
969
969
|
/**
|
|
970
970
|
* Optional function that is called when an argument streaming delta is available.
|
|
971
971
|
* Only called when the tool is used in a streaming context.
|
|
972
972
|
*/
|
|
973
973
|
onInputDelta?: (options: {
|
|
974
974
|
inputTextDelta: string;
|
|
975
|
-
} &
|
|
975
|
+
} & ToolExecutionOptions) => void | PromiseLike<void>;
|
|
976
976
|
/**
|
|
977
977
|
* Optional function that is called when a tool call can be started,
|
|
978
978
|
* even if the execute function is not provided.
|
|
979
979
|
*/
|
|
980
980
|
onInputAvailable?: (options: {
|
|
981
981
|
input: [INPUT] extends [never] ? unknown : INPUT;
|
|
982
|
-
} &
|
|
982
|
+
} & ToolExecutionOptions) => void | PromiseLike<void>;
|
|
983
983
|
} & ToolOutputProperties<INPUT, OUTPUT> & {
|
|
984
984
|
/**
|
|
985
985
|
Optional conversion function that maps the tool result to an output that can be used by the language model.
|
|
@@ -1143,7 +1143,7 @@ declare function withoutTrailingSlash(url: string | undefined): string | undefin
|
|
|
1143
1143
|
declare function executeTool<INPUT, OUTPUT>({ execute, input, options, }: {
|
|
1144
1144
|
execute: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
1145
1145
|
input: INPUT;
|
|
1146
|
-
options:
|
|
1146
|
+
options: ToolExecutionOptions;
|
|
1147
1147
|
}): AsyncGenerator<{
|
|
1148
1148
|
type: 'preliminary';
|
|
1149
1149
|
output: OUTPUT;
|
|
@@ -1211,4 +1211,9 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1211
1211
|
dynamic?: boolean;
|
|
1212
1212
|
}
|
|
1213
1213
|
|
|
1214
|
-
|
|
1214
|
+
/**
|
|
1215
|
+
* @deprecated Use ToolExecutionOptions instead.
|
|
1216
|
+
*/
|
|
1217
|
+
type ToolCallOptions = ToolExecutionOptions;
|
|
1218
|
+
|
|
1219
|
+
export { type AssistantContent, type AssistantModelMessage, type DataContent, DelayedPromise, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
|
package/dist/index.js
CHANGED
|
@@ -378,7 +378,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
// src/version.ts
|
|
381
|
-
var VERSION = true ? "4.0.0-beta.
|
|
381
|
+
var VERSION = true ? "4.0.0-beta.42" : "0.0.0-test";
|
|
382
382
|
|
|
383
383
|
// src/get-from-api.ts
|
|
384
384
|
var getOriginalFetch = () => globalThis.fetch;
|