@ai-sdk/openai 3.0.0-beta.71 → 3.0.0-beta.72
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 +9 -0
- package/dist/index.d.mts +0 -16
- package/dist/index.d.ts +0 -16
- package/dist/index.js +80 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -79
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +249 -232
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +260 -242
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1805,7 +1805,6 @@ var codeInterpreterArgsSchema = lazySchema8(
|
|
|
1805
1805
|
);
|
|
1806
1806
|
var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchema({
|
|
1807
1807
|
id: "openai.code_interpreter",
|
|
1808
|
-
name: "code_interpreter",
|
|
1809
1808
|
inputSchema: codeInterpreterInputSchema,
|
|
1810
1809
|
outputSchema: codeInterpreterOutputSchema
|
|
1811
1810
|
});
|
|
@@ -1862,7 +1861,6 @@ var fileSearchOutputSchema = lazySchema9(
|
|
|
1862
1861
|
);
|
|
1863
1862
|
var fileSearch = createProviderDefinedToolFactoryWithOutputSchema2({
|
|
1864
1863
|
id: "openai.file_search",
|
|
1865
|
-
name: "file_search",
|
|
1866
1864
|
inputSchema: z10.object({}),
|
|
1867
1865
|
outputSchema: fileSearchOutputSchema
|
|
1868
1866
|
});
|
|
@@ -1899,7 +1897,6 @@ var imageGenerationOutputSchema = lazySchema10(
|
|
|
1899
1897
|
);
|
|
1900
1898
|
var imageGenerationToolFactory = createProviderDefinedToolFactoryWithOutputSchema3({
|
|
1901
1899
|
id: "openai.image_generation",
|
|
1902
|
-
name: "image_generation",
|
|
1903
1900
|
inputSchema: imageGenerationInputSchema,
|
|
1904
1901
|
outputSchema: imageGenerationOutputSchema
|
|
1905
1902
|
});
|
|
@@ -1933,7 +1930,6 @@ var localShellOutputSchema = lazySchema11(
|
|
|
1933
1930
|
);
|
|
1934
1931
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
1935
1932
|
id: "openai.local_shell",
|
|
1936
|
-
name: "local_shell",
|
|
1937
1933
|
inputSchema: localShellInputSchema,
|
|
1938
1934
|
outputSchema: localShellOutputSchema
|
|
1939
1935
|
});
|
|
@@ -1991,7 +1987,6 @@ var webSearchOutputSchema = lazySchema12(
|
|
|
1991
1987
|
);
|
|
1992
1988
|
var webSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema5({
|
|
1993
1989
|
id: "openai.web_search",
|
|
1994
|
-
name: "web_search",
|
|
1995
1990
|
inputSchema: webSearchInputSchema,
|
|
1996
1991
|
outputSchema: webSearchOutputSchema
|
|
1997
1992
|
});
|
|
@@ -2044,7 +2039,6 @@ var webSearchPreviewOutputSchema = lazySchema13(
|
|
|
2044
2039
|
);
|
|
2045
2040
|
var webSearchPreview = createProviderDefinedToolFactoryWithOutputSchema6({
|
|
2046
2041
|
id: "openai.web_search_preview",
|
|
2047
|
-
name: "web_search_preview",
|
|
2048
2042
|
inputSchema: webSearchPreviewInputSchema,
|
|
2049
2043
|
outputSchema: webSearchPreviewOutputSchema
|
|
2050
2044
|
});
|
|
@@ -2135,7 +2129,6 @@ var mcpOutputSchema = lazySchema14(
|
|
|
2135
2129
|
);
|
|
2136
2130
|
var mcpToolFactory = createProviderDefinedToolFactoryWithOutputSchema7({
|
|
2137
2131
|
id: "openai.mcp",
|
|
2138
|
-
name: "mcp",
|
|
2139
2132
|
inputSchema: mcpInputSchema,
|
|
2140
2133
|
outputSchema: mcpOutputSchema
|
|
2141
2134
|
});
|
|
@@ -2149,8 +2142,6 @@ var openaiTools = {
|
|
|
2149
2142
|
* coding, and math.
|
|
2150
2143
|
*
|
|
2151
2144
|
* @param container - The container to use for the code interpreter.
|
|
2152
|
-
*
|
|
2153
|
-
* Must have name `code_interpreter`.
|
|
2154
2145
|
*/
|
|
2155
2146
|
codeInterpreter,
|
|
2156
2147
|
/**
|
|
@@ -2158,8 +2149,6 @@ var openaiTools = {
|
|
|
2158
2149
|
* retrieve information in a knowledge base of previously uploaded files through
|
|
2159
2150
|
* semantic and keyword search.
|
|
2160
2151
|
*
|
|
2161
|
-
* Must have name `file_search`.
|
|
2162
|
-
*
|
|
2163
2152
|
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
2164
2153
|
* @param maxNumResults - The maximum number of results to return.
|
|
2165
2154
|
* @param ranking - The ranking options to use for the file search.
|
|
@@ -2171,8 +2160,6 @@ var openaiTools = {
|
|
|
2171
2160
|
* and optionally image inputs. It leverages the GPT Image model,
|
|
2172
2161
|
* and automatically optimizes text inputs for improved performance.
|
|
2173
2162
|
*
|
|
2174
|
-
* Must have name `image_generation`.
|
|
2175
|
-
*
|
|
2176
2163
|
* @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
|
|
2177
2164
|
* @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
|
|
2178
2165
|
* @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
|
|
@@ -2190,28 +2177,20 @@ var openaiTools = {
|
|
|
2190
2177
|
* on a machine you or the user provides.
|
|
2191
2178
|
*
|
|
2192
2179
|
* Supported models: `gpt-5-codex` and `codex-mini-latest`
|
|
2193
|
-
*
|
|
2194
|
-
* Must have name `local_shell`.
|
|
2195
2180
|
*/
|
|
2196
2181
|
localShell,
|
|
2197
2182
|
/**
|
|
2198
2183
|
* Web search allows models to access up-to-date information from the internet
|
|
2199
2184
|
* and provide answers with sourced citations.
|
|
2200
2185
|
*
|
|
2201
|
-
* Must have name `web_search_preview`.
|
|
2202
|
-
*
|
|
2203
2186
|
* @param searchContextSize - The search context size to use for the web search.
|
|
2204
2187
|
* @param userLocation - The user location to use for the web search.
|
|
2205
|
-
*
|
|
2206
|
-
* @deprecated Use `webSearch` instead.
|
|
2207
2188
|
*/
|
|
2208
2189
|
webSearchPreview,
|
|
2209
2190
|
/**
|
|
2210
2191
|
* Web search allows models to access up-to-date information from the internet
|
|
2211
2192
|
* and provide answers with sourced citations.
|
|
2212
2193
|
*
|
|
2213
|
-
* Must have name `web_search`.
|
|
2214
|
-
*
|
|
2215
2194
|
* @param filters - The filters to use for the web search.
|
|
2216
2195
|
* @param searchContextSize - The search context size to use for the web search.
|
|
2217
2196
|
* @param userLocation - The user location to use for the web search.
|
|
@@ -2221,8 +2200,6 @@ var openaiTools = {
|
|
|
2221
2200
|
* MCP (Model Context Protocol) allows models to call tools exposed by
|
|
2222
2201
|
* remote MCP servers or service connectors.
|
|
2223
2202
|
*
|
|
2224
|
-
* Must have name `mcp`.
|
|
2225
|
-
*
|
|
2226
2203
|
* @param serverLabel - Label to identify the MCP server.
|
|
2227
2204
|
* @param allowedTools - Allowed tool names or filter object.
|
|
2228
2205
|
* @param authorization - OAuth access token for the MCP server/connector.
|
|
@@ -2243,6 +2220,7 @@ import {
|
|
|
2243
2220
|
combineHeaders as combineHeaders5,
|
|
2244
2221
|
createEventSourceResponseHandler as createEventSourceResponseHandler3,
|
|
2245
2222
|
createJsonResponseHandler as createJsonResponseHandler5,
|
|
2223
|
+
createToolNameMapping,
|
|
2246
2224
|
generateId as generateId2,
|
|
2247
2225
|
parseProviderOptions as parseProviderOptions5,
|
|
2248
2226
|
postJsonToApi as postJsonToApi5
|
|
@@ -2265,6 +2243,7 @@ function isFileId(data, prefixes) {
|
|
|
2265
2243
|
}
|
|
2266
2244
|
async function convertToOpenAIResponsesInput({
|
|
2267
2245
|
prompt,
|
|
2246
|
+
toolNameMapping,
|
|
2268
2247
|
systemMessageMode,
|
|
2269
2248
|
fileIdPrefixes,
|
|
2270
2249
|
store,
|
|
@@ -2347,7 +2326,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2347
2326
|
}
|
|
2348
2327
|
case "assistant": {
|
|
2349
2328
|
const reasoningMessages = {};
|
|
2350
|
-
const toolCallParts = {};
|
|
2351
2329
|
for (const part of content) {
|
|
2352
2330
|
switch (part.type) {
|
|
2353
2331
|
case "text": {
|
|
@@ -2364,7 +2342,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2364
2342
|
break;
|
|
2365
2343
|
}
|
|
2366
2344
|
case "tool-call": {
|
|
2367
|
-
toolCallParts[part.toolCallId] = part;
|
|
2368
2345
|
if (part.providerExecuted) {
|
|
2369
2346
|
break;
|
|
2370
2347
|
}
|
|
@@ -2373,7 +2350,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2373
2350
|
input.push({ type: "item_reference", id });
|
|
2374
2351
|
break;
|
|
2375
2352
|
}
|
|
2376
|
-
|
|
2353
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2354
|
+
part.toolName
|
|
2355
|
+
);
|
|
2356
|
+
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2377
2357
|
const parsedInput = await validateTypes({
|
|
2378
2358
|
value: part.input,
|
|
2379
2359
|
schema: localShellInputSchema
|
|
@@ -2396,7 +2376,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2396
2376
|
input.push({
|
|
2397
2377
|
type: "function_call",
|
|
2398
2378
|
call_id: part.toolCallId,
|
|
2399
|
-
name:
|
|
2379
|
+
name: resolvedToolName,
|
|
2400
2380
|
arguments: JSON.stringify(part.input),
|
|
2401
2381
|
id
|
|
2402
2382
|
});
|
|
@@ -2475,7 +2455,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2475
2455
|
case "tool": {
|
|
2476
2456
|
for (const part of content) {
|
|
2477
2457
|
const output = part.output;
|
|
2478
|
-
|
|
2458
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2459
|
+
part.toolName
|
|
2460
|
+
);
|
|
2461
|
+
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2479
2462
|
const parsedOutput = await validateTypes({
|
|
2480
2463
|
value: output.value,
|
|
2481
2464
|
schema: localShellOutputSchema
|
|
@@ -3402,15 +3385,6 @@ async function prepareResponsesTools({
|
|
|
3402
3385
|
authorization: args.authorization,
|
|
3403
3386
|
connector_id: args.connectorId,
|
|
3404
3387
|
headers: args.headers,
|
|
3405
|
-
// require_approval:
|
|
3406
|
-
// typeof args.requireApproval === 'string'
|
|
3407
|
-
// ? args.requireApproval
|
|
3408
|
-
// : args.requireApproval
|
|
3409
|
-
// ? {
|
|
3410
|
-
// read_only: args.requireApproval.readOnly,
|
|
3411
|
-
// tool_names: args.requireApproval.toolNames,
|
|
3412
|
-
// }
|
|
3413
|
-
// : undefined,
|
|
3414
3388
|
require_approval: "never",
|
|
3415
3389
|
server_description: args.serverDescription,
|
|
3416
3390
|
server_url: args.serverUrl
|
|
@@ -3511,8 +3485,21 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3511
3485
|
details: "conversation and previousResponseId cannot be used together"
|
|
3512
3486
|
});
|
|
3513
3487
|
}
|
|
3488
|
+
const toolNameMapping = createToolNameMapping({
|
|
3489
|
+
tools,
|
|
3490
|
+
providerToolNames: {
|
|
3491
|
+
"openai.code_interpreter": "code_interpreter",
|
|
3492
|
+
"openai.file_search": "file_search",
|
|
3493
|
+
"openai.image_generation": "image_generation",
|
|
3494
|
+
"openai.local_shell": "local_shell",
|
|
3495
|
+
"openai.web_search": "web_search",
|
|
3496
|
+
"openai.web_search_preview": "web_search_preview",
|
|
3497
|
+
"openai.mcp": "mcp"
|
|
3498
|
+
}
|
|
3499
|
+
});
|
|
3514
3500
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3515
3501
|
prompt,
|
|
3502
|
+
toolNameMapping,
|
|
3516
3503
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
3517
3504
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3518
3505
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
@@ -3666,7 +3653,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3666
3653
|
tool_choice: openaiToolChoice
|
|
3667
3654
|
},
|
|
3668
3655
|
warnings: [...warnings, ...toolWarnings],
|
|
3669
|
-
store
|
|
3656
|
+
store,
|
|
3657
|
+
toolNameMapping
|
|
3670
3658
|
};
|
|
3671
3659
|
}
|
|
3672
3660
|
async doGenerate(options) {
|
|
@@ -3674,7 +3662,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3674
3662
|
const {
|
|
3675
3663
|
args: body,
|
|
3676
3664
|
warnings,
|
|
3677
|
-
webSearchToolName
|
|
3665
|
+
webSearchToolName,
|
|
3666
|
+
toolNameMapping
|
|
3678
3667
|
} = await this.getArgs(options);
|
|
3679
3668
|
const url = this.config.url({
|
|
3680
3669
|
path: "/responses",
|
|
@@ -3734,14 +3723,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3734
3723
|
content.push({
|
|
3735
3724
|
type: "tool-call",
|
|
3736
3725
|
toolCallId: part.id,
|
|
3737
|
-
toolName: "image_generation",
|
|
3726
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
3738
3727
|
input: "{}",
|
|
3739
3728
|
providerExecuted: true
|
|
3740
3729
|
});
|
|
3741
3730
|
content.push({
|
|
3742
3731
|
type: "tool-result",
|
|
3743
3732
|
toolCallId: part.id,
|
|
3744
|
-
toolName: "image_generation",
|
|
3733
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
3745
3734
|
result: {
|
|
3746
3735
|
result: part.result
|
|
3747
3736
|
}
|
|
@@ -3752,7 +3741,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3752
3741
|
content.push({
|
|
3753
3742
|
type: "tool-call",
|
|
3754
3743
|
toolCallId: part.call_id,
|
|
3755
|
-
toolName: "local_shell",
|
|
3744
|
+
toolName: toolNameMapping.toCustomToolName("local_shell"),
|
|
3756
3745
|
input: JSON.stringify({
|
|
3757
3746
|
action: part.action
|
|
3758
3747
|
}),
|
|
@@ -3862,14 +3851,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3862
3851
|
content.push({
|
|
3863
3852
|
type: "tool-call",
|
|
3864
3853
|
toolCallId: part.id,
|
|
3865
|
-
toolName:
|
|
3854
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
3855
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
3856
|
+
),
|
|
3866
3857
|
input: JSON.stringify({}),
|
|
3867
3858
|
providerExecuted: true
|
|
3868
3859
|
});
|
|
3869
3860
|
content.push({
|
|
3870
3861
|
type: "tool-result",
|
|
3871
3862
|
toolCallId: part.id,
|
|
3872
|
-
toolName:
|
|
3863
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
3864
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
3865
|
+
),
|
|
3873
3866
|
result: mapWebSearchOutput(part.action)
|
|
3874
3867
|
});
|
|
3875
3868
|
break;
|
|
@@ -3878,14 +3871,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3878
3871
|
content.push({
|
|
3879
3872
|
type: "tool-call",
|
|
3880
3873
|
toolCallId: part.id,
|
|
3881
|
-
toolName: "mcp",
|
|
3874
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3882
3875
|
input: JSON.stringify({}),
|
|
3883
3876
|
providerExecuted: true
|
|
3884
3877
|
});
|
|
3885
3878
|
content.push({
|
|
3886
3879
|
type: "tool-result",
|
|
3887
3880
|
toolCallId: part.id,
|
|
3888
|
-
toolName: "mcp",
|
|
3881
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3889
3882
|
result: {
|
|
3890
3883
|
type: "call",
|
|
3891
3884
|
serverLabel: part.server_label,
|
|
@@ -3901,14 +3894,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3901
3894
|
content.push({
|
|
3902
3895
|
type: "tool-call",
|
|
3903
3896
|
toolCallId: part.id,
|
|
3904
|
-
toolName: "mcp",
|
|
3897
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3905
3898
|
input: JSON.stringify({}),
|
|
3906
3899
|
providerExecuted: true
|
|
3907
3900
|
});
|
|
3908
3901
|
content.push({
|
|
3909
3902
|
type: "tool-result",
|
|
3910
3903
|
toolCallId: part.id,
|
|
3911
|
-
toolName: "mcp",
|
|
3904
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3912
3905
|
result: {
|
|
3913
3906
|
type: "listTools",
|
|
3914
3907
|
serverLabel: part.server_label,
|
|
@@ -3930,14 +3923,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3930
3923
|
content.push({
|
|
3931
3924
|
type: "tool-call",
|
|
3932
3925
|
toolCallId: part.id,
|
|
3933
|
-
toolName: "mcp",
|
|
3926
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3934
3927
|
input: JSON.stringify({}),
|
|
3935
3928
|
providerExecuted: true
|
|
3936
3929
|
});
|
|
3937
3930
|
content.push({
|
|
3938
3931
|
type: "tool-result",
|
|
3939
3932
|
toolCallId: part.id,
|
|
3940
|
-
toolName: "mcp",
|
|
3933
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3941
3934
|
result: {
|
|
3942
3935
|
type: "approvalRequest",
|
|
3943
3936
|
serverLabel: part.server_label,
|
|
@@ -3952,14 +3945,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3952
3945
|
content.push({
|
|
3953
3946
|
type: "tool-call",
|
|
3954
3947
|
toolCallId: part.id,
|
|
3955
|
-
toolName: "computer_use",
|
|
3948
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
3956
3949
|
input: "",
|
|
3957
3950
|
providerExecuted: true
|
|
3958
3951
|
});
|
|
3959
3952
|
content.push({
|
|
3960
3953
|
type: "tool-result",
|
|
3961
3954
|
toolCallId: part.id,
|
|
3962
|
-
toolName: "computer_use",
|
|
3955
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
3963
3956
|
result: {
|
|
3964
3957
|
type: "computer_use_tool_result",
|
|
3965
3958
|
status: part.status || "completed"
|
|
@@ -3971,14 +3964,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3971
3964
|
content.push({
|
|
3972
3965
|
type: "tool-call",
|
|
3973
3966
|
toolCallId: part.id,
|
|
3974
|
-
toolName: "file_search",
|
|
3967
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
3975
3968
|
input: "{}",
|
|
3976
3969
|
providerExecuted: true
|
|
3977
3970
|
});
|
|
3978
3971
|
content.push({
|
|
3979
3972
|
type: "tool-result",
|
|
3980
3973
|
toolCallId: part.id,
|
|
3981
|
-
toolName: "file_search",
|
|
3974
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
3982
3975
|
result: {
|
|
3983
3976
|
queries: part.queries,
|
|
3984
3977
|
results: (_w = (_v = part.results) == null ? void 0 : _v.map((result) => ({
|
|
@@ -3996,7 +3989,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3996
3989
|
content.push({
|
|
3997
3990
|
type: "tool-call",
|
|
3998
3991
|
toolCallId: part.id,
|
|
3999
|
-
toolName: "code_interpreter",
|
|
3992
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4000
3993
|
input: JSON.stringify({
|
|
4001
3994
|
code: part.code,
|
|
4002
3995
|
containerId: part.container_id
|
|
@@ -4006,7 +3999,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4006
3999
|
content.push({
|
|
4007
4000
|
type: "tool-result",
|
|
4008
4001
|
toolCallId: part.id,
|
|
4009
|
-
toolName: "code_interpreter",
|
|
4002
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4010
4003
|
result: {
|
|
4011
4004
|
outputs: part.outputs
|
|
4012
4005
|
}
|
|
@@ -4055,6 +4048,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4055
4048
|
args: body,
|
|
4056
4049
|
warnings,
|
|
4057
4050
|
webSearchToolName,
|
|
4051
|
+
toolNameMapping,
|
|
4058
4052
|
store
|
|
4059
4053
|
} = await this.getArgs(options);
|
|
4060
4054
|
const { responseHeaders, value: response } = await postJsonToApi5({
|
|
@@ -4119,13 +4113,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4119
4113
|
});
|
|
4120
4114
|
} else if (value.item.type === "web_search_call") {
|
|
4121
4115
|
ongoingToolCalls[value.output_index] = {
|
|
4122
|
-
toolName:
|
|
4116
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4117
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4118
|
+
),
|
|
4123
4119
|
toolCallId: value.item.id
|
|
4124
4120
|
};
|
|
4125
4121
|
controller.enqueue({
|
|
4126
4122
|
type: "tool-input-start",
|
|
4127
4123
|
id: value.item.id,
|
|
4128
|
-
toolName:
|
|
4124
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4125
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4126
|
+
),
|
|
4129
4127
|
providerExecuted: true
|
|
4130
4128
|
});
|
|
4131
4129
|
controller.enqueue({
|
|
@@ -4135,24 +4133,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4135
4133
|
controller.enqueue({
|
|
4136
4134
|
type: "tool-call",
|
|
4137
4135
|
toolCallId: value.item.id,
|
|
4138
|
-
toolName:
|
|
4136
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4137
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4138
|
+
),
|
|
4139
4139
|
input: JSON.stringify({}),
|
|
4140
4140
|
providerExecuted: true
|
|
4141
4141
|
});
|
|
4142
4142
|
} else if (value.item.type === "computer_call") {
|
|
4143
4143
|
ongoingToolCalls[value.output_index] = {
|
|
4144
|
-
toolName: "computer_use",
|
|
4144
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4145
4145
|
toolCallId: value.item.id
|
|
4146
4146
|
};
|
|
4147
4147
|
controller.enqueue({
|
|
4148
4148
|
type: "tool-input-start",
|
|
4149
4149
|
id: value.item.id,
|
|
4150
|
-
toolName: "computer_use",
|
|
4150
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4151
4151
|
providerExecuted: true
|
|
4152
4152
|
});
|
|
4153
4153
|
} else if (value.item.type === "code_interpreter_call") {
|
|
4154
4154
|
ongoingToolCalls[value.output_index] = {
|
|
4155
|
-
toolName: "code_interpreter",
|
|
4155
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4156
4156
|
toolCallId: value.item.id,
|
|
4157
4157
|
codeInterpreter: {
|
|
4158
4158
|
containerId: value.item.container_id
|
|
@@ -4161,7 +4161,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4161
4161
|
controller.enqueue({
|
|
4162
4162
|
type: "tool-input-start",
|
|
4163
4163
|
id: value.item.id,
|
|
4164
|
-
toolName: "code_interpreter",
|
|
4164
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4165
4165
|
providerExecuted: true
|
|
4166
4166
|
});
|
|
4167
4167
|
controller.enqueue({
|
|
@@ -4173,7 +4173,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4173
4173
|
controller.enqueue({
|
|
4174
4174
|
type: "tool-call",
|
|
4175
4175
|
toolCallId: value.item.id,
|
|
4176
|
-
toolName: "file_search",
|
|
4176
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4177
4177
|
input: "{}",
|
|
4178
4178
|
providerExecuted: true
|
|
4179
4179
|
});
|
|
@@ -4181,7 +4181,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4181
4181
|
controller.enqueue({
|
|
4182
4182
|
type: "tool-call",
|
|
4183
4183
|
toolCallId: value.item.id,
|
|
4184
|
-
toolName: "image_generation",
|
|
4184
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4185
4185
|
input: "{}",
|
|
4186
4186
|
providerExecuted: true
|
|
4187
4187
|
});
|
|
@@ -4189,7 +4189,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4189
4189
|
controller.enqueue({
|
|
4190
4190
|
type: "tool-call",
|
|
4191
4191
|
toolCallId: value.item.id,
|
|
4192
|
-
toolName: "mcp",
|
|
4192
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4193
4193
|
input: "{}",
|
|
4194
4194
|
providerExecuted: true
|
|
4195
4195
|
});
|
|
@@ -4257,7 +4257,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4257
4257
|
controller.enqueue({
|
|
4258
4258
|
type: "tool-result",
|
|
4259
4259
|
toolCallId: value.item.id,
|
|
4260
|
-
toolName:
|
|
4260
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4261
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4262
|
+
),
|
|
4261
4263
|
result: mapWebSearchOutput(value.item.action)
|
|
4262
4264
|
});
|
|
4263
4265
|
} else if (value.item.type === "computer_call") {
|
|
@@ -4269,14 +4271,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4269
4271
|
controller.enqueue({
|
|
4270
4272
|
type: "tool-call",
|
|
4271
4273
|
toolCallId: value.item.id,
|
|
4272
|
-
toolName: "computer_use",
|
|
4274
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4273
4275
|
input: "",
|
|
4274
4276
|
providerExecuted: true
|
|
4275
4277
|
});
|
|
4276
4278
|
controller.enqueue({
|
|
4277
4279
|
type: "tool-result",
|
|
4278
4280
|
toolCallId: value.item.id,
|
|
4279
|
-
toolName: "computer_use",
|
|
4281
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4280
4282
|
result: {
|
|
4281
4283
|
type: "computer_use_tool_result",
|
|
4282
4284
|
status: value.item.status || "completed"
|
|
@@ -4287,7 +4289,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4287
4289
|
controller.enqueue({
|
|
4288
4290
|
type: "tool-result",
|
|
4289
4291
|
toolCallId: value.item.id,
|
|
4290
|
-
toolName: "file_search",
|
|
4292
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4291
4293
|
result: {
|
|
4292
4294
|
queries: value.item.queries,
|
|
4293
4295
|
results: (_c = (_b = value.item.results) == null ? void 0 : _b.map((result) => ({
|
|
@@ -4304,7 +4306,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4304
4306
|
controller.enqueue({
|
|
4305
4307
|
type: "tool-result",
|
|
4306
4308
|
toolCallId: value.item.id,
|
|
4307
|
-
toolName: "code_interpreter",
|
|
4309
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4308
4310
|
result: {
|
|
4309
4311
|
outputs: value.item.outputs
|
|
4310
4312
|
}
|
|
@@ -4313,7 +4315,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4313
4315
|
controller.enqueue({
|
|
4314
4316
|
type: "tool-result",
|
|
4315
4317
|
toolCallId: value.item.id,
|
|
4316
|
-
toolName: "image_generation",
|
|
4318
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4317
4319
|
result: {
|
|
4318
4320
|
result: value.item.result
|
|
4319
4321
|
}
|
|
@@ -4323,7 +4325,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4323
4325
|
controller.enqueue({
|
|
4324
4326
|
type: "tool-result",
|
|
4325
4327
|
toolCallId: value.item.id,
|
|
4326
|
-
toolName: "mcp",
|
|
4328
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4327
4329
|
result: {
|
|
4328
4330
|
type: "call",
|
|
4329
4331
|
serverLabel: value.item.server_label,
|
|
@@ -4338,7 +4340,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4338
4340
|
controller.enqueue({
|
|
4339
4341
|
type: "tool-result",
|
|
4340
4342
|
toolCallId: value.item.id,
|
|
4341
|
-
toolName: "mcp",
|
|
4343
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4342
4344
|
result: {
|
|
4343
4345
|
type: "listTools",
|
|
4344
4346
|
serverLabel: value.item.server_label,
|
|
@@ -4359,7 +4361,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4359
4361
|
controller.enqueue({
|
|
4360
4362
|
type: "tool-result",
|
|
4361
4363
|
toolCallId: value.item.id,
|
|
4362
|
-
toolName: "mcp",
|
|
4364
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4363
4365
|
result: {
|
|
4364
4366
|
type: "approvalRequest",
|
|
4365
4367
|
serverLabel: value.item.server_label,
|
|
@@ -4373,7 +4375,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4373
4375
|
controller.enqueue({
|
|
4374
4376
|
type: "tool-call",
|
|
4375
4377
|
toolCallId: value.item.call_id,
|
|
4376
|
-
toolName: "local_shell",
|
|
4378
|
+
toolName: toolNameMapping.toCustomToolName("local_shell"),
|
|
4377
4379
|
input: JSON.stringify({
|
|
4378
4380
|
action: {
|
|
4379
4381
|
type: "exec",
|
|
@@ -4422,7 +4424,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4422
4424
|
controller.enqueue({
|
|
4423
4425
|
type: "tool-result",
|
|
4424
4426
|
toolCallId: value.item_id,
|
|
4425
|
-
toolName: "image_generation",
|
|
4427
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4426
4428
|
result: {
|
|
4427
4429
|
result: value.partial_image_b64
|
|
4428
4430
|
},
|
|
@@ -4454,7 +4456,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4454
4456
|
controller.enqueue({
|
|
4455
4457
|
type: "tool-call",
|
|
4456
4458
|
toolCallId: toolCall.toolCallId,
|
|
4457
|
-
toolName: "code_interpreter",
|
|
4459
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4458
4460
|
input: JSON.stringify({
|
|
4459
4461
|
code: value.code,
|
|
4460
4462
|
containerId: toolCall.codeInterpreter.containerId
|
|
@@ -5061,7 +5063,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5061
5063
|
};
|
|
5062
5064
|
|
|
5063
5065
|
// src/version.ts
|
|
5064
|
-
var VERSION = true ? "3.0.0-beta.
|
|
5066
|
+
var VERSION = true ? "3.0.0-beta.72" : "0.0.0-test";
|
|
5065
5067
|
|
|
5066
5068
|
// src/openai-provider.ts
|
|
5067
5069
|
function createOpenAI(options = {}) {
|