@ai-sdk/openai 3.0.0-beta.71 → 3.0.0-beta.73
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 +18 -0
- package/dist/index.d.mts +4 -20
- package/dist/index.d.ts +4 -20
- package/dist/index.js +90 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -98
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js +255 -240
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +270 -254
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1788,9 +1788,8 @@ var codeInterpreterArgsSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
1788
1788
|
})
|
|
1789
1789
|
)
|
|
1790
1790
|
);
|
|
1791
|
-
var codeInterpreterToolFactory = (0, import_provider_utils14.
|
|
1791
|
+
var codeInterpreterToolFactory = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
1792
1792
|
id: "openai.code_interpreter",
|
|
1793
|
-
name: "code_interpreter",
|
|
1794
1793
|
inputSchema: codeInterpreterInputSchema,
|
|
1795
1794
|
outputSchema: codeInterpreterOutputSchema
|
|
1796
1795
|
});
|
|
@@ -1841,9 +1840,8 @@ var fileSearchOutputSchema = (0, import_provider_utils15.lazySchema)(
|
|
|
1841
1840
|
})
|
|
1842
1841
|
)
|
|
1843
1842
|
);
|
|
1844
|
-
var fileSearch = (0, import_provider_utils15.
|
|
1843
|
+
var fileSearch = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
1845
1844
|
id: "openai.file_search",
|
|
1846
|
-
name: "file_search",
|
|
1847
1845
|
inputSchema: import_v410.z.object({}),
|
|
1848
1846
|
outputSchema: fileSearchOutputSchema
|
|
1849
1847
|
});
|
|
@@ -1874,9 +1872,8 @@ var imageGenerationInputSchema = (0, import_provider_utils16.lazySchema)(() => (
|
|
|
1874
1872
|
var imageGenerationOutputSchema = (0, import_provider_utils16.lazySchema)(
|
|
1875
1873
|
() => (0, import_provider_utils16.zodSchema)(import_v411.z.object({ result: import_v411.z.string() }))
|
|
1876
1874
|
);
|
|
1877
|
-
var imageGenerationToolFactory = (0, import_provider_utils16.
|
|
1875
|
+
var imageGenerationToolFactory = (0, import_provider_utils16.createProviderToolFactoryWithOutputSchema)({
|
|
1878
1876
|
id: "openai.image_generation",
|
|
1879
|
-
name: "image_generation",
|
|
1880
1877
|
inputSchema: imageGenerationInputSchema,
|
|
1881
1878
|
outputSchema: imageGenerationOutputSchema
|
|
1882
1879
|
});
|
|
@@ -1904,9 +1901,8 @@ var localShellInputSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
1904
1901
|
var localShellOutputSchema = (0, import_provider_utils17.lazySchema)(
|
|
1905
1902
|
() => (0, import_provider_utils17.zodSchema)(import_v412.z.object({ output: import_v412.z.string() }))
|
|
1906
1903
|
);
|
|
1907
|
-
var localShell = (0, import_provider_utils17.
|
|
1904
|
+
var localShell = (0, import_provider_utils17.createProviderToolFactoryWithOutputSchema)({
|
|
1908
1905
|
id: "openai.local_shell",
|
|
1909
|
-
name: "local_shell",
|
|
1910
1906
|
inputSchema: localShellInputSchema,
|
|
1911
1907
|
outputSchema: localShellOutputSchema
|
|
1912
1908
|
});
|
|
@@ -1958,9 +1954,8 @@ var webSearchOutputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
1958
1954
|
})
|
|
1959
1955
|
)
|
|
1960
1956
|
);
|
|
1961
|
-
var webSearchToolFactory = (0, import_provider_utils18.
|
|
1957
|
+
var webSearchToolFactory = (0, import_provider_utils18.createProviderToolFactoryWithOutputSchema)({
|
|
1962
1958
|
id: "openai.web_search",
|
|
1963
|
-
name: "web_search",
|
|
1964
1959
|
inputSchema: webSearchInputSchema,
|
|
1965
1960
|
outputSchema: webSearchOutputSchema
|
|
1966
1961
|
});
|
|
@@ -2007,9 +2002,8 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
2007
2002
|
})
|
|
2008
2003
|
)
|
|
2009
2004
|
);
|
|
2010
|
-
var webSearchPreview = (0, import_provider_utils19.
|
|
2005
|
+
var webSearchPreview = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
2011
2006
|
id: "openai.web_search_preview",
|
|
2012
|
-
name: "web_search_preview",
|
|
2013
2007
|
inputSchema: webSearchPreviewInputSchema,
|
|
2014
2008
|
outputSchema: webSearchPreviewOutputSchema
|
|
2015
2009
|
});
|
|
@@ -2094,9 +2088,8 @@ var mcpOutputSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
2094
2088
|
])
|
|
2095
2089
|
)
|
|
2096
2090
|
);
|
|
2097
|
-
var mcpToolFactory = (0, import_provider_utils20.
|
|
2091
|
+
var mcpToolFactory = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchema)({
|
|
2098
2092
|
id: "openai.mcp",
|
|
2099
|
-
name: "mcp",
|
|
2100
2093
|
inputSchema: mcpInputSchema,
|
|
2101
2094
|
outputSchema: mcpOutputSchema
|
|
2102
2095
|
});
|
|
@@ -2110,8 +2103,6 @@ var openaiTools = {
|
|
|
2110
2103
|
* coding, and math.
|
|
2111
2104
|
*
|
|
2112
2105
|
* @param container - The container to use for the code interpreter.
|
|
2113
|
-
*
|
|
2114
|
-
* Must have name `code_interpreter`.
|
|
2115
2106
|
*/
|
|
2116
2107
|
codeInterpreter,
|
|
2117
2108
|
/**
|
|
@@ -2119,8 +2110,6 @@ var openaiTools = {
|
|
|
2119
2110
|
* retrieve information in a knowledge base of previously uploaded files through
|
|
2120
2111
|
* semantic and keyword search.
|
|
2121
2112
|
*
|
|
2122
|
-
* Must have name `file_search`.
|
|
2123
|
-
*
|
|
2124
2113
|
* @param vectorStoreIds - The vector store IDs to use for the file search.
|
|
2125
2114
|
* @param maxNumResults - The maximum number of results to return.
|
|
2126
2115
|
* @param ranking - The ranking options to use for the file search.
|
|
@@ -2132,8 +2121,6 @@ var openaiTools = {
|
|
|
2132
2121
|
* and optionally image inputs. It leverages the GPT Image model,
|
|
2133
2122
|
* and automatically optimizes text inputs for improved performance.
|
|
2134
2123
|
*
|
|
2135
|
-
* Must have name `image_generation`.
|
|
2136
|
-
*
|
|
2137
2124
|
* @param background - Background type for the generated image. One of 'auto', 'opaque', or 'transparent'.
|
|
2138
2125
|
* @param inputFidelity - Input fidelity for the generated image. One of 'low' or 'high'.
|
|
2139
2126
|
* @param inputImageMask - Optional mask for inpainting. Contains fileId and/or imageUrl.
|
|
@@ -2151,28 +2138,20 @@ var openaiTools = {
|
|
|
2151
2138
|
* on a machine you or the user provides.
|
|
2152
2139
|
*
|
|
2153
2140
|
* Supported models: `gpt-5-codex` and `codex-mini-latest`
|
|
2154
|
-
*
|
|
2155
|
-
* Must have name `local_shell`.
|
|
2156
2141
|
*/
|
|
2157
2142
|
localShell,
|
|
2158
2143
|
/**
|
|
2159
2144
|
* Web search allows models to access up-to-date information from the internet
|
|
2160
2145
|
* and provide answers with sourced citations.
|
|
2161
2146
|
*
|
|
2162
|
-
* Must have name `web_search_preview`.
|
|
2163
|
-
*
|
|
2164
2147
|
* @param searchContextSize - The search context size to use for the web search.
|
|
2165
2148
|
* @param userLocation - The user location to use for the web search.
|
|
2166
|
-
*
|
|
2167
|
-
* @deprecated Use `webSearch` instead.
|
|
2168
2149
|
*/
|
|
2169
2150
|
webSearchPreview,
|
|
2170
2151
|
/**
|
|
2171
2152
|
* Web search allows models to access up-to-date information from the internet
|
|
2172
2153
|
* and provide answers with sourced citations.
|
|
2173
2154
|
*
|
|
2174
|
-
* Must have name `web_search`.
|
|
2175
|
-
*
|
|
2176
2155
|
* @param filters - The filters to use for the web search.
|
|
2177
2156
|
* @param searchContextSize - The search context size to use for the web search.
|
|
2178
2157
|
* @param userLocation - The user location to use for the web search.
|
|
@@ -2182,8 +2161,6 @@ var openaiTools = {
|
|
|
2182
2161
|
* MCP (Model Context Protocol) allows models to call tools exposed by
|
|
2183
2162
|
* remote MCP servers or service connectors.
|
|
2184
2163
|
*
|
|
2185
|
-
* Must have name `mcp`.
|
|
2186
|
-
*
|
|
2187
2164
|
* @param serverLabel - Label to identify the MCP server.
|
|
2188
2165
|
* @param allowedTools - Allowed tool names or filter object.
|
|
2189
2166
|
* @param authorization - OAuth access token for the MCP server/connector.
|
|
@@ -2210,6 +2187,7 @@ function isFileId(data, prefixes) {
|
|
|
2210
2187
|
}
|
|
2211
2188
|
async function convertToOpenAIResponsesInput({
|
|
2212
2189
|
prompt,
|
|
2190
|
+
toolNameMapping,
|
|
2213
2191
|
systemMessageMode,
|
|
2214
2192
|
fileIdPrefixes,
|
|
2215
2193
|
store,
|
|
@@ -2292,7 +2270,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2292
2270
|
}
|
|
2293
2271
|
case "assistant": {
|
|
2294
2272
|
const reasoningMessages = {};
|
|
2295
|
-
const toolCallParts = {};
|
|
2296
2273
|
for (const part of content) {
|
|
2297
2274
|
switch (part.type) {
|
|
2298
2275
|
case "text": {
|
|
@@ -2309,7 +2286,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2309
2286
|
break;
|
|
2310
2287
|
}
|
|
2311
2288
|
case "tool-call": {
|
|
2312
|
-
toolCallParts[part.toolCallId] = part;
|
|
2313
2289
|
if (part.providerExecuted) {
|
|
2314
2290
|
break;
|
|
2315
2291
|
}
|
|
@@ -2318,7 +2294,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2318
2294
|
input.push({ type: "item_reference", id });
|
|
2319
2295
|
break;
|
|
2320
2296
|
}
|
|
2321
|
-
|
|
2297
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2298
|
+
part.toolName
|
|
2299
|
+
);
|
|
2300
|
+
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2322
2301
|
const parsedInput = await (0, import_provider_utils21.validateTypes)({
|
|
2323
2302
|
value: part.input,
|
|
2324
2303
|
schema: localShellInputSchema
|
|
@@ -2341,7 +2320,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2341
2320
|
input.push({
|
|
2342
2321
|
type: "function_call",
|
|
2343
2322
|
call_id: part.toolCallId,
|
|
2344
|
-
name:
|
|
2323
|
+
name: resolvedToolName,
|
|
2345
2324
|
arguments: JSON.stringify(part.input),
|
|
2346
2325
|
id
|
|
2347
2326
|
});
|
|
@@ -2420,7 +2399,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2420
2399
|
case "tool": {
|
|
2421
2400
|
for (const part of content) {
|
|
2422
2401
|
const output = part.output;
|
|
2423
|
-
|
|
2402
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2403
|
+
part.toolName
|
|
2404
|
+
);
|
|
2405
|
+
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2424
2406
|
const parsedOutput = await (0, import_provider_utils21.validateTypes)({
|
|
2425
2407
|
value: output.value,
|
|
2426
2408
|
schema: localShellOutputSchema
|
|
@@ -3245,7 +3227,7 @@ async function prepareResponsesTools({
|
|
|
3245
3227
|
strict: strictJsonSchema
|
|
3246
3228
|
});
|
|
3247
3229
|
break;
|
|
3248
|
-
case "provider
|
|
3230
|
+
case "provider": {
|
|
3249
3231
|
switch (tool.id) {
|
|
3250
3232
|
case "openai.file_search": {
|
|
3251
3233
|
const args = await (0, import_provider_utils24.validateTypes)({
|
|
@@ -3345,15 +3327,6 @@ async function prepareResponsesTools({
|
|
|
3345
3327
|
authorization: args.authorization,
|
|
3346
3328
|
connector_id: args.connectorId,
|
|
3347
3329
|
headers: args.headers,
|
|
3348
|
-
// require_approval:
|
|
3349
|
-
// typeof args.requireApproval === 'string'
|
|
3350
|
-
// ? args.requireApproval
|
|
3351
|
-
// : args.requireApproval
|
|
3352
|
-
// ? {
|
|
3353
|
-
// read_only: args.requireApproval.readOnly,
|
|
3354
|
-
// tool_names: args.requireApproval.toolNames,
|
|
3355
|
-
// }
|
|
3356
|
-
// : undefined,
|
|
3357
3330
|
require_approval: "never",
|
|
3358
3331
|
server_description: args.serverDescription,
|
|
3359
3332
|
server_url: args.serverUrl
|
|
@@ -3454,8 +3427,21 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3454
3427
|
details: "conversation and previousResponseId cannot be used together"
|
|
3455
3428
|
});
|
|
3456
3429
|
}
|
|
3430
|
+
const toolNameMapping = (0, import_provider_utils25.createToolNameMapping)({
|
|
3431
|
+
tools,
|
|
3432
|
+
providerToolNames: {
|
|
3433
|
+
"openai.code_interpreter": "code_interpreter",
|
|
3434
|
+
"openai.file_search": "file_search",
|
|
3435
|
+
"openai.image_generation": "image_generation",
|
|
3436
|
+
"openai.local_shell": "local_shell",
|
|
3437
|
+
"openai.web_search": "web_search",
|
|
3438
|
+
"openai.web_search_preview": "web_search_preview",
|
|
3439
|
+
"openai.mcp": "mcp"
|
|
3440
|
+
}
|
|
3441
|
+
});
|
|
3457
3442
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3458
3443
|
prompt,
|
|
3444
|
+
toolNameMapping,
|
|
3459
3445
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
3460
3446
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3461
3447
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
@@ -3472,16 +3458,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3472
3458
|
}
|
|
3473
3459
|
}
|
|
3474
3460
|
function hasOpenAITool(id) {
|
|
3475
|
-
return (tools == null ? void 0 : tools.find(
|
|
3476
|
-
(tool) => tool.type === "provider-defined" && tool.id === id
|
|
3477
|
-
)) != null;
|
|
3461
|
+
return (tools == null ? void 0 : tools.find((tool) => tool.type === "provider" && tool.id === id)) != null;
|
|
3478
3462
|
}
|
|
3479
3463
|
const topLogprobs = typeof (openaiOptions == null ? void 0 : openaiOptions.logprobs) === "number" ? openaiOptions == null ? void 0 : openaiOptions.logprobs : (openaiOptions == null ? void 0 : openaiOptions.logprobs) === true ? TOP_LOGPROBS_MAX : void 0;
|
|
3480
3464
|
if (topLogprobs) {
|
|
3481
3465
|
addInclude("message.output_text.logprobs");
|
|
3482
3466
|
}
|
|
3483
3467
|
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
3484
|
-
(tool) => tool.type === "provider
|
|
3468
|
+
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
3485
3469
|
)) == null ? void 0 : _c.name;
|
|
3486
3470
|
if (webSearchToolName) {
|
|
3487
3471
|
addInclude("web_search_call.action.sources");
|
|
@@ -3609,7 +3593,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3609
3593
|
tool_choice: openaiToolChoice
|
|
3610
3594
|
},
|
|
3611
3595
|
warnings: [...warnings, ...toolWarnings],
|
|
3612
|
-
store
|
|
3596
|
+
store,
|
|
3597
|
+
toolNameMapping
|
|
3613
3598
|
};
|
|
3614
3599
|
}
|
|
3615
3600
|
async doGenerate(options) {
|
|
@@ -3617,7 +3602,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3617
3602
|
const {
|
|
3618
3603
|
args: body,
|
|
3619
3604
|
warnings,
|
|
3620
|
-
webSearchToolName
|
|
3605
|
+
webSearchToolName,
|
|
3606
|
+
toolNameMapping
|
|
3621
3607
|
} = await this.getArgs(options);
|
|
3622
3608
|
const url = this.config.url({
|
|
3623
3609
|
path: "/responses",
|
|
@@ -3677,14 +3663,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3677
3663
|
content.push({
|
|
3678
3664
|
type: "tool-call",
|
|
3679
3665
|
toolCallId: part.id,
|
|
3680
|
-
toolName: "image_generation",
|
|
3666
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
3681
3667
|
input: "{}",
|
|
3682
3668
|
providerExecuted: true
|
|
3683
3669
|
});
|
|
3684
3670
|
content.push({
|
|
3685
3671
|
type: "tool-result",
|
|
3686
3672
|
toolCallId: part.id,
|
|
3687
|
-
toolName: "image_generation",
|
|
3673
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
3688
3674
|
result: {
|
|
3689
3675
|
result: part.result
|
|
3690
3676
|
}
|
|
@@ -3695,7 +3681,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3695
3681
|
content.push({
|
|
3696
3682
|
type: "tool-call",
|
|
3697
3683
|
toolCallId: part.call_id,
|
|
3698
|
-
toolName: "local_shell",
|
|
3684
|
+
toolName: toolNameMapping.toCustomToolName("local_shell"),
|
|
3699
3685
|
input: JSON.stringify({
|
|
3700
3686
|
action: part.action
|
|
3701
3687
|
}),
|
|
@@ -3805,14 +3791,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3805
3791
|
content.push({
|
|
3806
3792
|
type: "tool-call",
|
|
3807
3793
|
toolCallId: part.id,
|
|
3808
|
-
toolName:
|
|
3794
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
3795
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
3796
|
+
),
|
|
3809
3797
|
input: JSON.stringify({}),
|
|
3810
3798
|
providerExecuted: true
|
|
3811
3799
|
});
|
|
3812
3800
|
content.push({
|
|
3813
3801
|
type: "tool-result",
|
|
3814
3802
|
toolCallId: part.id,
|
|
3815
|
-
toolName:
|
|
3803
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
3804
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
3805
|
+
),
|
|
3816
3806
|
result: mapWebSearchOutput(part.action)
|
|
3817
3807
|
});
|
|
3818
3808
|
break;
|
|
@@ -3821,14 +3811,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3821
3811
|
content.push({
|
|
3822
3812
|
type: "tool-call",
|
|
3823
3813
|
toolCallId: part.id,
|
|
3824
|
-
toolName: "mcp",
|
|
3814
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3825
3815
|
input: JSON.stringify({}),
|
|
3826
3816
|
providerExecuted: true
|
|
3827
3817
|
});
|
|
3828
3818
|
content.push({
|
|
3829
3819
|
type: "tool-result",
|
|
3830
3820
|
toolCallId: part.id,
|
|
3831
|
-
toolName: "mcp",
|
|
3821
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3832
3822
|
result: {
|
|
3833
3823
|
type: "call",
|
|
3834
3824
|
serverLabel: part.server_label,
|
|
@@ -3844,14 +3834,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3844
3834
|
content.push({
|
|
3845
3835
|
type: "tool-call",
|
|
3846
3836
|
toolCallId: part.id,
|
|
3847
|
-
toolName: "mcp",
|
|
3837
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3848
3838
|
input: JSON.stringify({}),
|
|
3849
3839
|
providerExecuted: true
|
|
3850
3840
|
});
|
|
3851
3841
|
content.push({
|
|
3852
3842
|
type: "tool-result",
|
|
3853
3843
|
toolCallId: part.id,
|
|
3854
|
-
toolName: "mcp",
|
|
3844
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3855
3845
|
result: {
|
|
3856
3846
|
type: "listTools",
|
|
3857
3847
|
serverLabel: part.server_label,
|
|
@@ -3873,14 +3863,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3873
3863
|
content.push({
|
|
3874
3864
|
type: "tool-call",
|
|
3875
3865
|
toolCallId: part.id,
|
|
3876
|
-
toolName: "mcp",
|
|
3866
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3877
3867
|
input: JSON.stringify({}),
|
|
3878
3868
|
providerExecuted: true
|
|
3879
3869
|
});
|
|
3880
3870
|
content.push({
|
|
3881
3871
|
type: "tool-result",
|
|
3882
3872
|
toolCallId: part.id,
|
|
3883
|
-
toolName: "mcp",
|
|
3873
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
3884
3874
|
result: {
|
|
3885
3875
|
type: "approvalRequest",
|
|
3886
3876
|
serverLabel: part.server_label,
|
|
@@ -3895,14 +3885,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3895
3885
|
content.push({
|
|
3896
3886
|
type: "tool-call",
|
|
3897
3887
|
toolCallId: part.id,
|
|
3898
|
-
toolName: "computer_use",
|
|
3888
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
3899
3889
|
input: "",
|
|
3900
3890
|
providerExecuted: true
|
|
3901
3891
|
});
|
|
3902
3892
|
content.push({
|
|
3903
3893
|
type: "tool-result",
|
|
3904
3894
|
toolCallId: part.id,
|
|
3905
|
-
toolName: "computer_use",
|
|
3895
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
3906
3896
|
result: {
|
|
3907
3897
|
type: "computer_use_tool_result",
|
|
3908
3898
|
status: part.status || "completed"
|
|
@@ -3914,14 +3904,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3914
3904
|
content.push({
|
|
3915
3905
|
type: "tool-call",
|
|
3916
3906
|
toolCallId: part.id,
|
|
3917
|
-
toolName: "file_search",
|
|
3907
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
3918
3908
|
input: "{}",
|
|
3919
3909
|
providerExecuted: true
|
|
3920
3910
|
});
|
|
3921
3911
|
content.push({
|
|
3922
3912
|
type: "tool-result",
|
|
3923
3913
|
toolCallId: part.id,
|
|
3924
|
-
toolName: "file_search",
|
|
3914
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
3925
3915
|
result: {
|
|
3926
3916
|
queries: part.queries,
|
|
3927
3917
|
results: (_w = (_v = part.results) == null ? void 0 : _v.map((result) => ({
|
|
@@ -3939,7 +3929,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3939
3929
|
content.push({
|
|
3940
3930
|
type: "tool-call",
|
|
3941
3931
|
toolCallId: part.id,
|
|
3942
|
-
toolName: "code_interpreter",
|
|
3932
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
3943
3933
|
input: JSON.stringify({
|
|
3944
3934
|
code: part.code,
|
|
3945
3935
|
containerId: part.container_id
|
|
@@ -3949,7 +3939,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3949
3939
|
content.push({
|
|
3950
3940
|
type: "tool-result",
|
|
3951
3941
|
toolCallId: part.id,
|
|
3952
|
-
toolName: "code_interpreter",
|
|
3942
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
3953
3943
|
result: {
|
|
3954
3944
|
outputs: part.outputs
|
|
3955
3945
|
}
|
|
@@ -3998,6 +3988,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3998
3988
|
args: body,
|
|
3999
3989
|
warnings,
|
|
4000
3990
|
webSearchToolName,
|
|
3991
|
+
toolNameMapping,
|
|
4001
3992
|
store
|
|
4002
3993
|
} = await this.getArgs(options);
|
|
4003
3994
|
const { responseHeaders, value: response } = await (0, import_provider_utils25.postJsonToApi)({
|
|
@@ -4062,13 +4053,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4062
4053
|
});
|
|
4063
4054
|
} else if (value.item.type === "web_search_call") {
|
|
4064
4055
|
ongoingToolCalls[value.output_index] = {
|
|
4065
|
-
toolName:
|
|
4056
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4057
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4058
|
+
),
|
|
4066
4059
|
toolCallId: value.item.id
|
|
4067
4060
|
};
|
|
4068
4061
|
controller.enqueue({
|
|
4069
4062
|
type: "tool-input-start",
|
|
4070
4063
|
id: value.item.id,
|
|
4071
|
-
toolName:
|
|
4064
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4065
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4066
|
+
),
|
|
4072
4067
|
providerExecuted: true
|
|
4073
4068
|
});
|
|
4074
4069
|
controller.enqueue({
|
|
@@ -4078,24 +4073,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4078
4073
|
controller.enqueue({
|
|
4079
4074
|
type: "tool-call",
|
|
4080
4075
|
toolCallId: value.item.id,
|
|
4081
|
-
toolName:
|
|
4076
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4077
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4078
|
+
),
|
|
4082
4079
|
input: JSON.stringify({}),
|
|
4083
4080
|
providerExecuted: true
|
|
4084
4081
|
});
|
|
4085
4082
|
} else if (value.item.type === "computer_call") {
|
|
4086
4083
|
ongoingToolCalls[value.output_index] = {
|
|
4087
|
-
toolName: "computer_use",
|
|
4084
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4088
4085
|
toolCallId: value.item.id
|
|
4089
4086
|
};
|
|
4090
4087
|
controller.enqueue({
|
|
4091
4088
|
type: "tool-input-start",
|
|
4092
4089
|
id: value.item.id,
|
|
4093
|
-
toolName: "computer_use",
|
|
4090
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4094
4091
|
providerExecuted: true
|
|
4095
4092
|
});
|
|
4096
4093
|
} else if (value.item.type === "code_interpreter_call") {
|
|
4097
4094
|
ongoingToolCalls[value.output_index] = {
|
|
4098
|
-
toolName: "code_interpreter",
|
|
4095
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4099
4096
|
toolCallId: value.item.id,
|
|
4100
4097
|
codeInterpreter: {
|
|
4101
4098
|
containerId: value.item.container_id
|
|
@@ -4104,7 +4101,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4104
4101
|
controller.enqueue({
|
|
4105
4102
|
type: "tool-input-start",
|
|
4106
4103
|
id: value.item.id,
|
|
4107
|
-
toolName: "code_interpreter",
|
|
4104
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4108
4105
|
providerExecuted: true
|
|
4109
4106
|
});
|
|
4110
4107
|
controller.enqueue({
|
|
@@ -4116,7 +4113,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4116
4113
|
controller.enqueue({
|
|
4117
4114
|
type: "tool-call",
|
|
4118
4115
|
toolCallId: value.item.id,
|
|
4119
|
-
toolName: "file_search",
|
|
4116
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4120
4117
|
input: "{}",
|
|
4121
4118
|
providerExecuted: true
|
|
4122
4119
|
});
|
|
@@ -4124,7 +4121,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4124
4121
|
controller.enqueue({
|
|
4125
4122
|
type: "tool-call",
|
|
4126
4123
|
toolCallId: value.item.id,
|
|
4127
|
-
toolName: "image_generation",
|
|
4124
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4128
4125
|
input: "{}",
|
|
4129
4126
|
providerExecuted: true
|
|
4130
4127
|
});
|
|
@@ -4132,7 +4129,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4132
4129
|
controller.enqueue({
|
|
4133
4130
|
type: "tool-call",
|
|
4134
4131
|
toolCallId: value.item.id,
|
|
4135
|
-
toolName: "mcp",
|
|
4132
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4136
4133
|
input: "{}",
|
|
4137
4134
|
providerExecuted: true
|
|
4138
4135
|
});
|
|
@@ -4200,7 +4197,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4200
4197
|
controller.enqueue({
|
|
4201
4198
|
type: "tool-result",
|
|
4202
4199
|
toolCallId: value.item.id,
|
|
4203
|
-
toolName:
|
|
4200
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4201
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4202
|
+
),
|
|
4204
4203
|
result: mapWebSearchOutput(value.item.action)
|
|
4205
4204
|
});
|
|
4206
4205
|
} else if (value.item.type === "computer_call") {
|
|
@@ -4212,14 +4211,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4212
4211
|
controller.enqueue({
|
|
4213
4212
|
type: "tool-call",
|
|
4214
4213
|
toolCallId: value.item.id,
|
|
4215
|
-
toolName: "computer_use",
|
|
4214
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4216
4215
|
input: "",
|
|
4217
4216
|
providerExecuted: true
|
|
4218
4217
|
});
|
|
4219
4218
|
controller.enqueue({
|
|
4220
4219
|
type: "tool-result",
|
|
4221
4220
|
toolCallId: value.item.id,
|
|
4222
|
-
toolName: "computer_use",
|
|
4221
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4223
4222
|
result: {
|
|
4224
4223
|
type: "computer_use_tool_result",
|
|
4225
4224
|
status: value.item.status || "completed"
|
|
@@ -4230,7 +4229,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4230
4229
|
controller.enqueue({
|
|
4231
4230
|
type: "tool-result",
|
|
4232
4231
|
toolCallId: value.item.id,
|
|
4233
|
-
toolName: "file_search",
|
|
4232
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4234
4233
|
result: {
|
|
4235
4234
|
queries: value.item.queries,
|
|
4236
4235
|
results: (_c = (_b = value.item.results) == null ? void 0 : _b.map((result) => ({
|
|
@@ -4247,7 +4246,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4247
4246
|
controller.enqueue({
|
|
4248
4247
|
type: "tool-result",
|
|
4249
4248
|
toolCallId: value.item.id,
|
|
4250
|
-
toolName: "code_interpreter",
|
|
4249
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4251
4250
|
result: {
|
|
4252
4251
|
outputs: value.item.outputs
|
|
4253
4252
|
}
|
|
@@ -4256,7 +4255,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4256
4255
|
controller.enqueue({
|
|
4257
4256
|
type: "tool-result",
|
|
4258
4257
|
toolCallId: value.item.id,
|
|
4259
|
-
toolName: "image_generation",
|
|
4258
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4260
4259
|
result: {
|
|
4261
4260
|
result: value.item.result
|
|
4262
4261
|
}
|
|
@@ -4266,7 +4265,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4266
4265
|
controller.enqueue({
|
|
4267
4266
|
type: "tool-result",
|
|
4268
4267
|
toolCallId: value.item.id,
|
|
4269
|
-
toolName: "mcp",
|
|
4268
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4270
4269
|
result: {
|
|
4271
4270
|
type: "call",
|
|
4272
4271
|
serverLabel: value.item.server_label,
|
|
@@ -4281,7 +4280,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4281
4280
|
controller.enqueue({
|
|
4282
4281
|
type: "tool-result",
|
|
4283
4282
|
toolCallId: value.item.id,
|
|
4284
|
-
toolName: "mcp",
|
|
4283
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4285
4284
|
result: {
|
|
4286
4285
|
type: "listTools",
|
|
4287
4286
|
serverLabel: value.item.server_label,
|
|
@@ -4302,7 +4301,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4302
4301
|
controller.enqueue({
|
|
4303
4302
|
type: "tool-result",
|
|
4304
4303
|
toolCallId: value.item.id,
|
|
4305
|
-
toolName: "mcp",
|
|
4304
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4306
4305
|
result: {
|
|
4307
4306
|
type: "approvalRequest",
|
|
4308
4307
|
serverLabel: value.item.server_label,
|
|
@@ -4316,7 +4315,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4316
4315
|
controller.enqueue({
|
|
4317
4316
|
type: "tool-call",
|
|
4318
4317
|
toolCallId: value.item.call_id,
|
|
4319
|
-
toolName: "local_shell",
|
|
4318
|
+
toolName: toolNameMapping.toCustomToolName("local_shell"),
|
|
4320
4319
|
input: JSON.stringify({
|
|
4321
4320
|
action: {
|
|
4322
4321
|
type: "exec",
|
|
@@ -4365,7 +4364,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4365
4364
|
controller.enqueue({
|
|
4366
4365
|
type: "tool-result",
|
|
4367
4366
|
toolCallId: value.item_id,
|
|
4368
|
-
toolName: "image_generation",
|
|
4367
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4369
4368
|
result: {
|
|
4370
4369
|
result: value.partial_image_b64
|
|
4371
4370
|
},
|
|
@@ -4397,7 +4396,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4397
4396
|
controller.enqueue({
|
|
4398
4397
|
type: "tool-call",
|
|
4399
4398
|
toolCallId: toolCall.toolCallId,
|
|
4400
|
-
toolName: "code_interpreter",
|
|
4399
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4401
4400
|
input: JSON.stringify({
|
|
4402
4401
|
code: value.code,
|
|
4403
4402
|
containerId: toolCall.codeInterpreter.containerId
|
|
@@ -4992,7 +4991,7 @@ var OpenAITranscriptionModel = class {
|
|
|
4992
4991
|
};
|
|
4993
4992
|
|
|
4994
4993
|
// src/version.ts
|
|
4995
|
-
var VERSION = true ? "3.0.0-beta.
|
|
4994
|
+
var VERSION = true ? "3.0.0-beta.73" : "0.0.0-test";
|
|
4996
4995
|
|
|
4997
4996
|
// src/openai-provider.ts
|
|
4998
4997
|
function createOpenAI(options = {}) {
|