@ai-sdk/provider-utils 4.0.0-beta.38 → 4.0.0-beta.40
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 +16 -0
- package/dist/index.d.mts +46 -16
- package/dist/index.d.ts +46 -16
- package/dist/index.js +38 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ai-sdk/provider-utils
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.40
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 544d4e8: chore(specification): rename v3 provider defined tool to provider tool
|
|
8
|
+
- Updated dependencies [544d4e8]
|
|
9
|
+
- @ai-sdk/provider@3.0.0-beta.22
|
|
10
|
+
|
|
11
|
+
## 4.0.0-beta.39
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 954c356: feat(openai): allow custom names for provider-defined tools
|
|
16
|
+
- Updated dependencies [954c356]
|
|
17
|
+
- @ai-sdk/provider@3.0.0-beta.21
|
|
18
|
+
|
|
3
19
|
## 4.0.0-beta.38
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV3FunctionTool, LanguageModelV3ProviderTool, JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions } from '@ai-sdk/provider';
|
|
2
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
export * from '@standard-schema/spec';
|
|
4
4
|
import * as z3 from 'zod/v3';
|
|
@@ -16,6 +16,42 @@ declare function combineHeaders(...headers: Array<Record<string, string | undefi
|
|
|
16
16
|
*/
|
|
17
17
|
declare function convertAsyncIteratorToReadableStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Interface for mapping between custom tool names and provider tool names.
|
|
21
|
+
*/
|
|
22
|
+
interface ToolNameMapping {
|
|
23
|
+
/**
|
|
24
|
+
* Maps a custom tool name (used by the client) to the provider's tool name.
|
|
25
|
+
* If the custom tool name does not have a mapping, returns the input name.
|
|
26
|
+
*
|
|
27
|
+
* @param customToolName - The custom name of the tool defined by the client.
|
|
28
|
+
* @returns The corresponding provider tool name, or the input name if not mapped.
|
|
29
|
+
*/
|
|
30
|
+
toProviderToolName: (customToolName: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Maps a provider tool name to the custom tool name used by the client.
|
|
33
|
+
* If the provider tool name does not have a mapping, returns the input name.
|
|
34
|
+
*
|
|
35
|
+
* @param providerToolName - The name of the tool as understood by the provider.
|
|
36
|
+
* @returns The corresponding custom tool name, or the input name if not mapped.
|
|
37
|
+
*/
|
|
38
|
+
toCustomToolName: (providerToolName: string) => string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param tools - Tools that were passed to the language model.
|
|
42
|
+
* @param providerToolNames - Maps the provider tool ids to the provider tool names.
|
|
43
|
+
*/
|
|
44
|
+
declare function createToolNameMapping({ tools, providerToolNames, }: {
|
|
45
|
+
/**
|
|
46
|
+
* Tools that were passed to the language model.
|
|
47
|
+
*/
|
|
48
|
+
tools: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Maps the provider tool ids to the provider tool names.
|
|
51
|
+
*/
|
|
52
|
+
providerToolNames: Record<`${string}.${string}`, string>;
|
|
53
|
+
}): ToolNameMapping;
|
|
54
|
+
|
|
19
55
|
/**
|
|
20
56
|
* Creates a Promise that resolves after a specified delay
|
|
21
57
|
* @param delayInMs - The delay duration in milliseconds. If null or undefined, resolves immediately.
|
|
@@ -958,16 +994,12 @@ The types of input and output are not known at development time.
|
|
|
958
994
|
/**
|
|
959
995
|
Tool with provider-defined input and output schemas.
|
|
960
996
|
*/
|
|
961
|
-
type: 'provider
|
|
997
|
+
type: 'provider';
|
|
962
998
|
/**
|
|
963
|
-
The ID of the tool.
|
|
999
|
+
The ID of the tool. Must follow the format `<provider-name>.<unique-tool-name>`.
|
|
964
1000
|
*/
|
|
965
1001
|
id: `${string}.${string}`;
|
|
966
1002
|
/**
|
|
967
|
-
The name of the tool that the user must use in the tool set.
|
|
968
|
-
*/
|
|
969
|
-
name: string;
|
|
970
|
-
/**
|
|
971
1003
|
The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
972
1004
|
*/
|
|
973
1005
|
args: Record<string, unknown>;
|
|
@@ -1005,7 +1037,7 @@ declare function dynamicTool(tool: {
|
|
|
1005
1037
|
type: 'dynamic';
|
|
1006
1038
|
};
|
|
1007
1039
|
|
|
1008
|
-
type
|
|
1040
|
+
type ProviderToolFactory<INPUT, ARGS extends object> = <OUTPUT>(options: ARGS & {
|
|
1009
1041
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
1010
1042
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
1011
1043
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -1013,12 +1045,11 @@ type ProviderDefinedToolFactory<INPUT, ARGS extends object> = <OUTPUT>(options:
|
|
|
1013
1045
|
onInputDelta?: Tool<INPUT, OUTPUT>['onInputDelta'];
|
|
1014
1046
|
onInputAvailable?: Tool<INPUT, OUTPUT>['onInputAvailable'];
|
|
1015
1047
|
}) => Tool<INPUT, OUTPUT>;
|
|
1016
|
-
declare function
|
|
1048
|
+
declare function createProviderToolFactory<INPUT, ARGS extends object>({ id, inputSchema, }: {
|
|
1017
1049
|
id: `${string}.${string}`;
|
|
1018
|
-
name: string;
|
|
1019
1050
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1020
|
-
}):
|
|
1021
|
-
type
|
|
1051
|
+
}): ProviderToolFactory<INPUT, ARGS>;
|
|
1052
|
+
type ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object> = (options: ARGS & {
|
|
1022
1053
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
1023
1054
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
1024
1055
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -1026,12 +1057,11 @@ type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends obje
|
|
|
1026
1057
|
onInputDelta?: Tool<INPUT, OUTPUT>['onInputDelta'];
|
|
1027
1058
|
onInputAvailable?: Tool<INPUT, OUTPUT>['onInputAvailable'];
|
|
1028
1059
|
}) => Tool<INPUT, OUTPUT>;
|
|
1029
|
-
declare function
|
|
1060
|
+
declare function createProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object>({ id, inputSchema, outputSchema, }: {
|
|
1030
1061
|
id: `${string}.${string}`;
|
|
1031
|
-
name: string;
|
|
1032
1062
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1033
1063
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
1034
|
-
}):
|
|
1064
|
+
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1035
1065
|
|
|
1036
1066
|
/**
|
|
1037
1067
|
* Removes entries from a record where the value is null or undefined.
|
|
@@ -1173,4 +1203,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1173
1203
|
dynamic?: boolean;
|
|
1174
1204
|
}
|
|
1175
1205
|
|
|
1176
|
-
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
|
|
1206
|
+
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 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV3FunctionTool, LanguageModelV3ProviderTool, JSONSchema7, JSONParseError, TypeValidationError, JSONValue, APICallError, LanguageModelV3Prompt, SharedV3ProviderOptions } from '@ai-sdk/provider';
|
|
2
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
3
|
export * from '@standard-schema/spec';
|
|
4
4
|
import * as z3 from 'zod/v3';
|
|
@@ -16,6 +16,42 @@ declare function combineHeaders(...headers: Array<Record<string, string | undefi
|
|
|
16
16
|
*/
|
|
17
17
|
declare function convertAsyncIteratorToReadableStream<T>(iterator: AsyncIterator<T>): ReadableStream<T>;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Interface for mapping between custom tool names and provider tool names.
|
|
21
|
+
*/
|
|
22
|
+
interface ToolNameMapping {
|
|
23
|
+
/**
|
|
24
|
+
* Maps a custom tool name (used by the client) to the provider's tool name.
|
|
25
|
+
* If the custom tool name does not have a mapping, returns the input name.
|
|
26
|
+
*
|
|
27
|
+
* @param customToolName - The custom name of the tool defined by the client.
|
|
28
|
+
* @returns The corresponding provider tool name, or the input name if not mapped.
|
|
29
|
+
*/
|
|
30
|
+
toProviderToolName: (customToolName: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Maps a provider tool name to the custom tool name used by the client.
|
|
33
|
+
* If the provider tool name does not have a mapping, returns the input name.
|
|
34
|
+
*
|
|
35
|
+
* @param providerToolName - The name of the tool as understood by the provider.
|
|
36
|
+
* @returns The corresponding custom tool name, or the input name if not mapped.
|
|
37
|
+
*/
|
|
38
|
+
toCustomToolName: (providerToolName: string) => string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param tools - Tools that were passed to the language model.
|
|
42
|
+
* @param providerToolNames - Maps the provider tool ids to the provider tool names.
|
|
43
|
+
*/
|
|
44
|
+
declare function createToolNameMapping({ tools, providerToolNames, }: {
|
|
45
|
+
/**
|
|
46
|
+
* Tools that were passed to the language model.
|
|
47
|
+
*/
|
|
48
|
+
tools: Array<LanguageModelV3FunctionTool | LanguageModelV3ProviderTool> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Maps the provider tool ids to the provider tool names.
|
|
51
|
+
*/
|
|
52
|
+
providerToolNames: Record<`${string}.${string}`, string>;
|
|
53
|
+
}): ToolNameMapping;
|
|
54
|
+
|
|
19
55
|
/**
|
|
20
56
|
* Creates a Promise that resolves after a specified delay
|
|
21
57
|
* @param delayInMs - The delay duration in milliseconds. If null or undefined, resolves immediately.
|
|
@@ -958,16 +994,12 @@ The types of input and output are not known at development time.
|
|
|
958
994
|
/**
|
|
959
995
|
Tool with provider-defined input and output schemas.
|
|
960
996
|
*/
|
|
961
|
-
type: 'provider
|
|
997
|
+
type: 'provider';
|
|
962
998
|
/**
|
|
963
|
-
The ID of the tool.
|
|
999
|
+
The ID of the tool. Must follow the format `<provider-name>.<unique-tool-name>`.
|
|
964
1000
|
*/
|
|
965
1001
|
id: `${string}.${string}`;
|
|
966
1002
|
/**
|
|
967
|
-
The name of the tool that the user must use in the tool set.
|
|
968
|
-
*/
|
|
969
|
-
name: string;
|
|
970
|
-
/**
|
|
971
1003
|
The arguments for configuring the tool. Must match the expected arguments defined by the provider for this tool.
|
|
972
1004
|
*/
|
|
973
1005
|
args: Record<string, unknown>;
|
|
@@ -1005,7 +1037,7 @@ declare function dynamicTool(tool: {
|
|
|
1005
1037
|
type: 'dynamic';
|
|
1006
1038
|
};
|
|
1007
1039
|
|
|
1008
|
-
type
|
|
1040
|
+
type ProviderToolFactory<INPUT, ARGS extends object> = <OUTPUT>(options: ARGS & {
|
|
1009
1041
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
1010
1042
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
1011
1043
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -1013,12 +1045,11 @@ type ProviderDefinedToolFactory<INPUT, ARGS extends object> = <OUTPUT>(options:
|
|
|
1013
1045
|
onInputDelta?: Tool<INPUT, OUTPUT>['onInputDelta'];
|
|
1014
1046
|
onInputAvailable?: Tool<INPUT, OUTPUT>['onInputAvailable'];
|
|
1015
1047
|
}) => Tool<INPUT, OUTPUT>;
|
|
1016
|
-
declare function
|
|
1048
|
+
declare function createProviderToolFactory<INPUT, ARGS extends object>({ id, inputSchema, }: {
|
|
1017
1049
|
id: `${string}.${string}`;
|
|
1018
|
-
name: string;
|
|
1019
1050
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1020
|
-
}):
|
|
1021
|
-
type
|
|
1051
|
+
}): ProviderToolFactory<INPUT, ARGS>;
|
|
1052
|
+
type ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object> = (options: ARGS & {
|
|
1022
1053
|
execute?: ToolExecuteFunction<INPUT, OUTPUT>;
|
|
1023
1054
|
needsApproval?: Tool<INPUT, OUTPUT>['needsApproval'];
|
|
1024
1055
|
toModelOutput?: Tool<INPUT, OUTPUT>['toModelOutput'];
|
|
@@ -1026,12 +1057,11 @@ type ProviderDefinedToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends obje
|
|
|
1026
1057
|
onInputDelta?: Tool<INPUT, OUTPUT>['onInputDelta'];
|
|
1027
1058
|
onInputAvailable?: Tool<INPUT, OUTPUT>['onInputAvailable'];
|
|
1028
1059
|
}) => Tool<INPUT, OUTPUT>;
|
|
1029
|
-
declare function
|
|
1060
|
+
declare function createProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS extends object>({ id, inputSchema, outputSchema, }: {
|
|
1030
1061
|
id: `${string}.${string}`;
|
|
1031
|
-
name: string;
|
|
1032
1062
|
inputSchema: FlexibleSchema<INPUT>;
|
|
1033
1063
|
outputSchema: FlexibleSchema<OUTPUT>;
|
|
1034
|
-
}):
|
|
1064
|
+
}): ProviderToolFactoryWithOutputSchema<INPUT, OUTPUT, ARGS>;
|
|
1035
1065
|
|
|
1036
1066
|
/**
|
|
1037
1067
|
* Removes entries from a record where the value is null or undefined.
|
|
@@ -1173,4 +1203,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
|
|
|
1173
1203
|
dynamic?: boolean;
|
|
1174
1204
|
}
|
|
1175
1205
|
|
|
1176
|
-
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
|
|
1206
|
+
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 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
|
@@ -45,9 +45,10 @@ __export(src_exports, {
|
|
|
45
45
|
createIdGenerator: () => createIdGenerator,
|
|
46
46
|
createJsonErrorResponseHandler: () => createJsonErrorResponseHandler,
|
|
47
47
|
createJsonResponseHandler: () => createJsonResponseHandler,
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
createProviderToolFactory: () => createProviderToolFactory,
|
|
49
|
+
createProviderToolFactoryWithOutputSchema: () => createProviderToolFactoryWithOutputSchema,
|
|
50
50
|
createStatusCodeErrorResponseHandler: () => createStatusCodeErrorResponseHandler,
|
|
51
|
+
createToolNameMapping: () => createToolNameMapping,
|
|
51
52
|
delay: () => delay,
|
|
52
53
|
dynamicTool: () => dynamicTool,
|
|
53
54
|
executeTool: () => executeTool,
|
|
@@ -135,6 +136,32 @@ function convertAsyncIteratorToReadableStream(iterator) {
|
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
// src/create-tool-name-mapping.ts
|
|
140
|
+
function createToolNameMapping({
|
|
141
|
+
tools = [],
|
|
142
|
+
providerToolNames
|
|
143
|
+
}) {
|
|
144
|
+
const customToolNameToProviderToolName = {};
|
|
145
|
+
const providerToolNameToCustomToolName = {};
|
|
146
|
+
for (const tool2 of tools) {
|
|
147
|
+
if (tool2.type === "provider" && tool2.id in providerToolNames) {
|
|
148
|
+
const providerToolName = providerToolNames[tool2.id];
|
|
149
|
+
customToolNameToProviderToolName[tool2.name] = providerToolName;
|
|
150
|
+
providerToolNameToCustomToolName[providerToolName] = tool2.name;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
toProviderToolName: (customToolName) => {
|
|
155
|
+
var _a;
|
|
156
|
+
return (_a = customToolNameToProviderToolName[customToolName]) != null ? _a : customToolName;
|
|
157
|
+
},
|
|
158
|
+
toCustomToolName: (providerToolName) => {
|
|
159
|
+
var _a;
|
|
160
|
+
return (_a = providerToolNameToCustomToolName[providerToolName]) != null ? _a : providerToolName;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
138
165
|
// src/delay.ts
|
|
139
166
|
async function delay(delayInMs, options) {
|
|
140
167
|
if (delayInMs == null) {
|
|
@@ -351,7 +378,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
351
378
|
}
|
|
352
379
|
|
|
353
380
|
// src/version.ts
|
|
354
|
-
var VERSION = true ? "4.0.0-beta.
|
|
381
|
+
var VERSION = true ? "4.0.0-beta.40" : "0.0.0-test";
|
|
355
382
|
|
|
356
383
|
// src/get-from-api.ts
|
|
357
384
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -2223,10 +2250,9 @@ function dynamicTool(tool2) {
|
|
|
2223
2250
|
return { ...tool2, type: "dynamic" };
|
|
2224
2251
|
}
|
|
2225
2252
|
|
|
2226
|
-
// src/provider-
|
|
2227
|
-
function
|
|
2253
|
+
// src/provider-tool-factory.ts
|
|
2254
|
+
function createProviderToolFactory({
|
|
2228
2255
|
id,
|
|
2229
|
-
name,
|
|
2230
2256
|
inputSchema
|
|
2231
2257
|
}) {
|
|
2232
2258
|
return ({
|
|
@@ -2239,9 +2265,8 @@ function createProviderDefinedToolFactory({
|
|
|
2239
2265
|
onInputAvailable,
|
|
2240
2266
|
...args
|
|
2241
2267
|
}) => tool({
|
|
2242
|
-
type: "provider
|
|
2268
|
+
type: "provider",
|
|
2243
2269
|
id,
|
|
2244
|
-
name,
|
|
2245
2270
|
args,
|
|
2246
2271
|
inputSchema,
|
|
2247
2272
|
outputSchema,
|
|
@@ -2253,9 +2278,8 @@ function createProviderDefinedToolFactory({
|
|
|
2253
2278
|
onInputAvailable
|
|
2254
2279
|
});
|
|
2255
2280
|
}
|
|
2256
|
-
function
|
|
2281
|
+
function createProviderToolFactoryWithOutputSchema({
|
|
2257
2282
|
id,
|
|
2258
|
-
name,
|
|
2259
2283
|
inputSchema,
|
|
2260
2284
|
outputSchema
|
|
2261
2285
|
}) {
|
|
@@ -2268,9 +2292,8 @@ function createProviderDefinedToolFactoryWithOutputSchema({
|
|
|
2268
2292
|
onInputAvailable,
|
|
2269
2293
|
...args
|
|
2270
2294
|
}) => tool({
|
|
2271
|
-
type: "provider
|
|
2295
|
+
type: "provider",
|
|
2272
2296
|
id,
|
|
2273
|
-
name,
|
|
2274
2297
|
args,
|
|
2275
2298
|
inputSchema,
|
|
2276
2299
|
outputSchema,
|
|
@@ -2503,9 +2526,10 @@ var import_stream2 = require("eventsource-parser/stream");
|
|
|
2503
2526
|
createIdGenerator,
|
|
2504
2527
|
createJsonErrorResponseHandler,
|
|
2505
2528
|
createJsonResponseHandler,
|
|
2506
|
-
|
|
2507
|
-
|
|
2529
|
+
createProviderToolFactory,
|
|
2530
|
+
createProviderToolFactoryWithOutputSchema,
|
|
2508
2531
|
createStatusCodeErrorResponseHandler,
|
|
2532
|
+
createToolNameMapping,
|
|
2509
2533
|
delay,
|
|
2510
2534
|
dynamicTool,
|
|
2511
2535
|
executeTool,
|