@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/internal/index.mjs
CHANGED
|
@@ -2128,6 +2128,7 @@ import {
|
|
|
2128
2128
|
combineHeaders as combineHeaders7,
|
|
2129
2129
|
createEventSourceResponseHandler as createEventSourceResponseHandler3,
|
|
2130
2130
|
createJsonResponseHandler as createJsonResponseHandler6,
|
|
2131
|
+
createToolNameMapping,
|
|
2131
2132
|
generateId as generateId2,
|
|
2132
2133
|
parseProviderOptions as parseProviderOptions7,
|
|
2133
2134
|
postJsonToApi as postJsonToApi6
|
|
@@ -2147,7 +2148,7 @@ import { z as z13 } from "zod/v4";
|
|
|
2147
2148
|
|
|
2148
2149
|
// src/tool/local-shell.ts
|
|
2149
2150
|
import {
|
|
2150
|
-
|
|
2151
|
+
createProviderToolFactoryWithOutputSchema,
|
|
2151
2152
|
lazySchema as lazySchema11,
|
|
2152
2153
|
zodSchema as zodSchema11
|
|
2153
2154
|
} from "@ai-sdk/provider-utils";
|
|
@@ -2169,9 +2170,8 @@ var localShellInputSchema = lazySchema11(
|
|
|
2169
2170
|
var localShellOutputSchema = lazySchema11(
|
|
2170
2171
|
() => zodSchema11(z12.object({ output: z12.string() }))
|
|
2171
2172
|
);
|
|
2172
|
-
var localShell =
|
|
2173
|
+
var localShell = createProviderToolFactoryWithOutputSchema({
|
|
2173
2174
|
id: "openai.local_shell",
|
|
2174
|
-
name: "local_shell",
|
|
2175
2175
|
inputSchema: localShellInputSchema,
|
|
2176
2176
|
outputSchema: localShellOutputSchema
|
|
2177
2177
|
});
|
|
@@ -2183,6 +2183,7 @@ function isFileId(data, prefixes) {
|
|
|
2183
2183
|
}
|
|
2184
2184
|
async function convertToOpenAIResponsesInput({
|
|
2185
2185
|
prompt,
|
|
2186
|
+
toolNameMapping,
|
|
2186
2187
|
systemMessageMode,
|
|
2187
2188
|
fileIdPrefixes,
|
|
2188
2189
|
store,
|
|
@@ -2265,7 +2266,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2265
2266
|
}
|
|
2266
2267
|
case "assistant": {
|
|
2267
2268
|
const reasoningMessages = {};
|
|
2268
|
-
const toolCallParts = {};
|
|
2269
2269
|
for (const part of content) {
|
|
2270
2270
|
switch (part.type) {
|
|
2271
2271
|
case "text": {
|
|
@@ -2282,7 +2282,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2282
2282
|
break;
|
|
2283
2283
|
}
|
|
2284
2284
|
case "tool-call": {
|
|
2285
|
-
toolCallParts[part.toolCallId] = part;
|
|
2286
2285
|
if (part.providerExecuted) {
|
|
2287
2286
|
break;
|
|
2288
2287
|
}
|
|
@@ -2291,7 +2290,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2291
2290
|
input.push({ type: "item_reference", id });
|
|
2292
2291
|
break;
|
|
2293
2292
|
}
|
|
2294
|
-
|
|
2293
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2294
|
+
part.toolName
|
|
2295
|
+
);
|
|
2296
|
+
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2295
2297
|
const parsedInput = await validateTypes({
|
|
2296
2298
|
value: part.input,
|
|
2297
2299
|
schema: localShellInputSchema
|
|
@@ -2314,7 +2316,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2314
2316
|
input.push({
|
|
2315
2317
|
type: "function_call",
|
|
2316
2318
|
call_id: part.toolCallId,
|
|
2317
|
-
name:
|
|
2319
|
+
name: resolvedToolName,
|
|
2318
2320
|
arguments: JSON.stringify(part.input),
|
|
2319
2321
|
id
|
|
2320
2322
|
});
|
|
@@ -2393,7 +2395,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2393
2395
|
case "tool": {
|
|
2394
2396
|
for (const part of content) {
|
|
2395
2397
|
const output = part.output;
|
|
2396
|
-
|
|
2398
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2399
|
+
part.toolName
|
|
2400
|
+
);
|
|
2401
|
+
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2397
2402
|
const parsedOutput = await validateTypes({
|
|
2398
2403
|
value: output.value,
|
|
2399
2404
|
schema: localShellOutputSchema
|
|
@@ -3197,10 +3202,11 @@ var openaiResponsesProviderOptionsSchema = lazySchema13(
|
|
|
3197
3202
|
import {
|
|
3198
3203
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError5
|
|
3199
3204
|
} from "@ai-sdk/provider";
|
|
3205
|
+
import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
|
|
3200
3206
|
|
|
3201
3207
|
// src/tool/code-interpreter.ts
|
|
3202
3208
|
import {
|
|
3203
|
-
|
|
3209
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
|
|
3204
3210
|
lazySchema as lazySchema14,
|
|
3205
3211
|
zodSchema as zodSchema14
|
|
3206
3212
|
} from "@ai-sdk/provider-utils";
|
|
@@ -3237,9 +3243,8 @@ var codeInterpreterArgsSchema = lazySchema14(
|
|
|
3237
3243
|
})
|
|
3238
3244
|
)
|
|
3239
3245
|
);
|
|
3240
|
-
var codeInterpreterToolFactory =
|
|
3246
|
+
var codeInterpreterToolFactory = createProviderToolFactoryWithOutputSchema2({
|
|
3241
3247
|
id: "openai.code_interpreter",
|
|
3242
|
-
name: "code_interpreter",
|
|
3243
3248
|
inputSchema: codeInterpreterInputSchema,
|
|
3244
3249
|
outputSchema: codeInterpreterOutputSchema
|
|
3245
3250
|
});
|
|
@@ -3249,7 +3254,7 @@ var codeInterpreter = (args = {}) => {
|
|
|
3249
3254
|
|
|
3250
3255
|
// src/tool/file-search.ts
|
|
3251
3256
|
import {
|
|
3252
|
-
|
|
3257
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
|
|
3253
3258
|
lazySchema as lazySchema15,
|
|
3254
3259
|
zodSchema as zodSchema15
|
|
3255
3260
|
} from "@ai-sdk/provider-utils";
|
|
@@ -3294,156 +3299,44 @@ var fileSearchOutputSchema = lazySchema15(
|
|
|
3294
3299
|
})
|
|
3295
3300
|
)
|
|
3296
3301
|
);
|
|
3297
|
-
var fileSearch =
|
|
3302
|
+
var fileSearch = createProviderToolFactoryWithOutputSchema3({
|
|
3298
3303
|
id: "openai.file_search",
|
|
3299
|
-
name: "file_search",
|
|
3300
3304
|
inputSchema: z17.object({}),
|
|
3301
3305
|
outputSchema: fileSearchOutputSchema
|
|
3302
3306
|
});
|
|
3303
3307
|
|
|
3304
|
-
// src/tool/
|
|
3308
|
+
// src/tool/image-generation.ts
|
|
3305
3309
|
import {
|
|
3306
|
-
|
|
3310
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema4,
|
|
3307
3311
|
lazySchema as lazySchema16,
|
|
3308
3312
|
zodSchema as zodSchema16
|
|
3309
3313
|
} from "@ai-sdk/provider-utils";
|
|
3310
3314
|
import { z as z18 } from "zod/v4";
|
|
3311
|
-
var
|
|
3312
|
-
() => zodSchema16(
|
|
3313
|
-
z18.object({
|
|
3314
|
-
externalWebAccess: z18.boolean().optional(),
|
|
3315
|
-
filters: z18.object({ allowedDomains: z18.array(z18.string()).optional() }).optional(),
|
|
3316
|
-
searchContextSize: z18.enum(["low", "medium", "high"]).optional(),
|
|
3317
|
-
userLocation: z18.object({
|
|
3318
|
-
type: z18.literal("approximate"),
|
|
3319
|
-
country: z18.string().optional(),
|
|
3320
|
-
city: z18.string().optional(),
|
|
3321
|
-
region: z18.string().optional(),
|
|
3322
|
-
timezone: z18.string().optional()
|
|
3323
|
-
}).optional()
|
|
3324
|
-
})
|
|
3325
|
-
)
|
|
3326
|
-
);
|
|
3327
|
-
var webSearchInputSchema = lazySchema16(() => zodSchema16(z18.object({})));
|
|
3328
|
-
var webSearchOutputSchema = lazySchema16(
|
|
3315
|
+
var imageGenerationArgsSchema = lazySchema16(
|
|
3329
3316
|
() => zodSchema16(
|
|
3330
3317
|
z18.object({
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
z18.object({
|
|
3337
|
-
type: z18.literal("openPage"),
|
|
3338
|
-
url: z18.string()
|
|
3339
|
-
}),
|
|
3340
|
-
z18.object({
|
|
3341
|
-
type: z18.literal("find"),
|
|
3342
|
-
url: z18.string(),
|
|
3343
|
-
pattern: z18.string()
|
|
3344
|
-
})
|
|
3345
|
-
]),
|
|
3346
|
-
sources: z18.array(
|
|
3347
|
-
z18.discriminatedUnion("type", [
|
|
3348
|
-
z18.object({ type: z18.literal("url"), url: z18.string() }),
|
|
3349
|
-
z18.object({ type: z18.literal("api"), name: z18.string() })
|
|
3350
|
-
])
|
|
3351
|
-
).optional()
|
|
3352
|
-
})
|
|
3353
|
-
)
|
|
3354
|
-
);
|
|
3355
|
-
var webSearchToolFactory = createProviderDefinedToolFactoryWithOutputSchema4({
|
|
3356
|
-
id: "openai.web_search",
|
|
3357
|
-
name: "web_search",
|
|
3358
|
-
inputSchema: webSearchInputSchema,
|
|
3359
|
-
outputSchema: webSearchOutputSchema
|
|
3360
|
-
});
|
|
3361
|
-
|
|
3362
|
-
// src/tool/web-search-preview.ts
|
|
3363
|
-
import {
|
|
3364
|
-
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema5,
|
|
3365
|
-
lazySchema as lazySchema17,
|
|
3366
|
-
zodSchema as zodSchema17
|
|
3367
|
-
} from "@ai-sdk/provider-utils";
|
|
3368
|
-
import { z as z19 } from "zod/v4";
|
|
3369
|
-
var webSearchPreviewArgsSchema = lazySchema17(
|
|
3370
|
-
() => zodSchema17(
|
|
3371
|
-
z19.object({
|
|
3372
|
-
searchContextSize: z19.enum(["low", "medium", "high"]).optional(),
|
|
3373
|
-
userLocation: z19.object({
|
|
3374
|
-
type: z19.literal("approximate"),
|
|
3375
|
-
country: z19.string().optional(),
|
|
3376
|
-
city: z19.string().optional(),
|
|
3377
|
-
region: z19.string().optional(),
|
|
3378
|
-
timezone: z19.string().optional()
|
|
3379
|
-
}).optional()
|
|
3380
|
-
})
|
|
3381
|
-
)
|
|
3382
|
-
);
|
|
3383
|
-
var webSearchPreviewInputSchema = lazySchema17(
|
|
3384
|
-
() => zodSchema17(z19.object({}))
|
|
3385
|
-
);
|
|
3386
|
-
var webSearchPreviewOutputSchema = lazySchema17(
|
|
3387
|
-
() => zodSchema17(
|
|
3388
|
-
z19.object({
|
|
3389
|
-
action: z19.discriminatedUnion("type", [
|
|
3390
|
-
z19.object({
|
|
3391
|
-
type: z19.literal("search"),
|
|
3392
|
-
query: z19.string().optional()
|
|
3393
|
-
}),
|
|
3394
|
-
z19.object({
|
|
3395
|
-
type: z19.literal("openPage"),
|
|
3396
|
-
url: z19.string()
|
|
3397
|
-
}),
|
|
3398
|
-
z19.object({
|
|
3399
|
-
type: z19.literal("find"),
|
|
3400
|
-
url: z19.string(),
|
|
3401
|
-
pattern: z19.string()
|
|
3402
|
-
})
|
|
3403
|
-
])
|
|
3404
|
-
})
|
|
3405
|
-
)
|
|
3406
|
-
);
|
|
3407
|
-
var webSearchPreview = createProviderDefinedToolFactoryWithOutputSchema5({
|
|
3408
|
-
id: "openai.web_search_preview",
|
|
3409
|
-
name: "web_search_preview",
|
|
3410
|
-
inputSchema: webSearchPreviewInputSchema,
|
|
3411
|
-
outputSchema: webSearchPreviewOutputSchema
|
|
3412
|
-
});
|
|
3413
|
-
|
|
3414
|
-
// src/tool/image-generation.ts
|
|
3415
|
-
import {
|
|
3416
|
-
createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema6,
|
|
3417
|
-
lazySchema as lazySchema18,
|
|
3418
|
-
zodSchema as zodSchema18
|
|
3419
|
-
} from "@ai-sdk/provider-utils";
|
|
3420
|
-
import { z as z20 } from "zod/v4";
|
|
3421
|
-
var imageGenerationArgsSchema = lazySchema18(
|
|
3422
|
-
() => zodSchema18(
|
|
3423
|
-
z20.object({
|
|
3424
|
-
background: z20.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3425
|
-
inputFidelity: z20.enum(["low", "high"]).optional(),
|
|
3426
|
-
inputImageMask: z20.object({
|
|
3427
|
-
fileId: z20.string().optional(),
|
|
3428
|
-
imageUrl: z20.string().optional()
|
|
3318
|
+
background: z18.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3319
|
+
inputFidelity: z18.enum(["low", "high"]).optional(),
|
|
3320
|
+
inputImageMask: z18.object({
|
|
3321
|
+
fileId: z18.string().optional(),
|
|
3322
|
+
imageUrl: z18.string().optional()
|
|
3429
3323
|
}).optional(),
|
|
3430
|
-
model:
|
|
3431
|
-
moderation:
|
|
3432
|
-
outputCompression:
|
|
3433
|
-
outputFormat:
|
|
3434
|
-
partialImages:
|
|
3435
|
-
quality:
|
|
3436
|
-
size:
|
|
3324
|
+
model: z18.string().optional(),
|
|
3325
|
+
moderation: z18.enum(["auto"]).optional(),
|
|
3326
|
+
outputCompression: z18.number().int().min(0).max(100).optional(),
|
|
3327
|
+
outputFormat: z18.enum(["png", "jpeg", "webp"]).optional(),
|
|
3328
|
+
partialImages: z18.number().int().min(0).max(3).optional(),
|
|
3329
|
+
quality: z18.enum(["auto", "low", "medium", "high"]).optional(),
|
|
3330
|
+
size: z18.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
3437
3331
|
}).strict()
|
|
3438
3332
|
)
|
|
3439
3333
|
);
|
|
3440
|
-
var imageGenerationInputSchema =
|
|
3441
|
-
var imageGenerationOutputSchema =
|
|
3442
|
-
() =>
|
|
3334
|
+
var imageGenerationInputSchema = lazySchema16(() => zodSchema16(z18.object({})));
|
|
3335
|
+
var imageGenerationOutputSchema = lazySchema16(
|
|
3336
|
+
() => zodSchema16(z18.object({ result: z18.string() }))
|
|
3443
3337
|
);
|
|
3444
|
-
var imageGenerationToolFactory =
|
|
3338
|
+
var imageGenerationToolFactory = createProviderToolFactoryWithOutputSchema4({
|
|
3445
3339
|
id: "openai.image_generation",
|
|
3446
|
-
name: "image_generation",
|
|
3447
3340
|
inputSchema: imageGenerationInputSchema,
|
|
3448
3341
|
outputSchema: imageGenerationOutputSchema
|
|
3449
3342
|
});
|
|
@@ -3453,35 +3346,35 @@ var imageGeneration = (args = {}) => {
|
|
|
3453
3346
|
|
|
3454
3347
|
// src/tool/mcp.ts
|
|
3455
3348
|
import {
|
|
3456
|
-
|
|
3457
|
-
lazySchema as
|
|
3458
|
-
zodSchema as
|
|
3349
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema5,
|
|
3350
|
+
lazySchema as lazySchema17,
|
|
3351
|
+
zodSchema as zodSchema17
|
|
3459
3352
|
} from "@ai-sdk/provider-utils";
|
|
3460
|
-
import { z as
|
|
3461
|
-
var jsonValueSchema =
|
|
3462
|
-
() =>
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3353
|
+
import { z as z19 } from "zod/v4";
|
|
3354
|
+
var jsonValueSchema = z19.lazy(
|
|
3355
|
+
() => z19.union([
|
|
3356
|
+
z19.string(),
|
|
3357
|
+
z19.number(),
|
|
3358
|
+
z19.boolean(),
|
|
3359
|
+
z19.null(),
|
|
3360
|
+
z19.array(jsonValueSchema),
|
|
3361
|
+
z19.record(z19.string(), jsonValueSchema)
|
|
3469
3362
|
])
|
|
3470
3363
|
);
|
|
3471
|
-
var mcpArgsSchema =
|
|
3472
|
-
() =>
|
|
3473
|
-
|
|
3474
|
-
serverLabel:
|
|
3475
|
-
allowedTools:
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
readOnly:
|
|
3479
|
-
toolNames:
|
|
3364
|
+
var mcpArgsSchema = lazySchema17(
|
|
3365
|
+
() => zodSchema17(
|
|
3366
|
+
z19.object({
|
|
3367
|
+
serverLabel: z19.string(),
|
|
3368
|
+
allowedTools: z19.union([
|
|
3369
|
+
z19.array(z19.string()),
|
|
3370
|
+
z19.object({
|
|
3371
|
+
readOnly: z19.boolean().optional(),
|
|
3372
|
+
toolNames: z19.array(z19.string()).optional()
|
|
3480
3373
|
})
|
|
3481
3374
|
]).optional(),
|
|
3482
|
-
authorization:
|
|
3483
|
-
connectorId:
|
|
3484
|
-
headers:
|
|
3375
|
+
authorization: z19.string().optional(),
|
|
3376
|
+
connectorId: z19.string().optional(),
|
|
3377
|
+
headers: z19.record(z19.string(), z19.string()).optional(),
|
|
3485
3378
|
// TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
|
|
3486
3379
|
// requireApproval: z
|
|
3487
3380
|
// .union([
|
|
@@ -3492,58 +3385,164 @@ var mcpArgsSchema = lazySchema19(
|
|
|
3492
3385
|
// }),
|
|
3493
3386
|
// ])
|
|
3494
3387
|
// .optional(),
|
|
3495
|
-
serverDescription:
|
|
3496
|
-
serverUrl:
|
|
3388
|
+
serverDescription: z19.string().optional(),
|
|
3389
|
+
serverUrl: z19.string().optional()
|
|
3497
3390
|
}).refine(
|
|
3498
3391
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
3499
3392
|
"One of serverUrl or connectorId must be provided."
|
|
3500
3393
|
)
|
|
3501
3394
|
)
|
|
3502
3395
|
);
|
|
3503
|
-
var mcpInputSchema =
|
|
3504
|
-
var mcpOutputSchema =
|
|
3505
|
-
() =>
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
type:
|
|
3509
|
-
serverLabel:
|
|
3510
|
-
name:
|
|
3511
|
-
arguments:
|
|
3512
|
-
output:
|
|
3513
|
-
error:
|
|
3396
|
+
var mcpInputSchema = lazySchema17(() => zodSchema17(z19.object({})));
|
|
3397
|
+
var mcpOutputSchema = lazySchema17(
|
|
3398
|
+
() => zodSchema17(
|
|
3399
|
+
z19.discriminatedUnion("type", [
|
|
3400
|
+
z19.object({
|
|
3401
|
+
type: z19.literal("call"),
|
|
3402
|
+
serverLabel: z19.string(),
|
|
3403
|
+
name: z19.string(),
|
|
3404
|
+
arguments: z19.string(),
|
|
3405
|
+
output: z19.string().nullable().optional(),
|
|
3406
|
+
error: z19.union([z19.string(), jsonValueSchema]).optional()
|
|
3514
3407
|
}),
|
|
3515
|
-
|
|
3516
|
-
type:
|
|
3517
|
-
serverLabel:
|
|
3518
|
-
tools:
|
|
3519
|
-
|
|
3520
|
-
name:
|
|
3521
|
-
description:
|
|
3408
|
+
z19.object({
|
|
3409
|
+
type: z19.literal("listTools"),
|
|
3410
|
+
serverLabel: z19.string(),
|
|
3411
|
+
tools: z19.array(
|
|
3412
|
+
z19.object({
|
|
3413
|
+
name: z19.string(),
|
|
3414
|
+
description: z19.string().optional(),
|
|
3522
3415
|
inputSchema: jsonValueSchema,
|
|
3523
|
-
annotations:
|
|
3416
|
+
annotations: z19.record(z19.string(), jsonValueSchema).optional()
|
|
3524
3417
|
})
|
|
3525
3418
|
),
|
|
3526
|
-
error:
|
|
3419
|
+
error: z19.union([z19.string(), jsonValueSchema]).optional()
|
|
3527
3420
|
}),
|
|
3528
|
-
|
|
3529
|
-
type:
|
|
3530
|
-
serverLabel:
|
|
3531
|
-
name:
|
|
3532
|
-
arguments:
|
|
3533
|
-
approvalRequestId:
|
|
3421
|
+
z19.object({
|
|
3422
|
+
type: z19.literal("approvalRequest"),
|
|
3423
|
+
serverLabel: z19.string(),
|
|
3424
|
+
name: z19.string(),
|
|
3425
|
+
arguments: z19.string(),
|
|
3426
|
+
approvalRequestId: z19.string()
|
|
3534
3427
|
})
|
|
3535
3428
|
])
|
|
3536
3429
|
)
|
|
3537
3430
|
);
|
|
3538
|
-
var mcpToolFactory =
|
|
3431
|
+
var mcpToolFactory = createProviderToolFactoryWithOutputSchema5({
|
|
3539
3432
|
id: "openai.mcp",
|
|
3540
|
-
name: "mcp",
|
|
3541
3433
|
inputSchema: mcpInputSchema,
|
|
3542
3434
|
outputSchema: mcpOutputSchema
|
|
3543
3435
|
});
|
|
3544
3436
|
|
|
3437
|
+
// src/tool/web-search.ts
|
|
3438
|
+
import {
|
|
3439
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema6,
|
|
3440
|
+
lazySchema as lazySchema18,
|
|
3441
|
+
zodSchema as zodSchema18
|
|
3442
|
+
} from "@ai-sdk/provider-utils";
|
|
3443
|
+
import { z as z20 } from "zod/v4";
|
|
3444
|
+
var webSearchArgsSchema = lazySchema18(
|
|
3445
|
+
() => zodSchema18(
|
|
3446
|
+
z20.object({
|
|
3447
|
+
externalWebAccess: z20.boolean().optional(),
|
|
3448
|
+
filters: z20.object({ allowedDomains: z20.array(z20.string()).optional() }).optional(),
|
|
3449
|
+
searchContextSize: z20.enum(["low", "medium", "high"]).optional(),
|
|
3450
|
+
userLocation: z20.object({
|
|
3451
|
+
type: z20.literal("approximate"),
|
|
3452
|
+
country: z20.string().optional(),
|
|
3453
|
+
city: z20.string().optional(),
|
|
3454
|
+
region: z20.string().optional(),
|
|
3455
|
+
timezone: z20.string().optional()
|
|
3456
|
+
}).optional()
|
|
3457
|
+
})
|
|
3458
|
+
)
|
|
3459
|
+
);
|
|
3460
|
+
var webSearchInputSchema = lazySchema18(() => zodSchema18(z20.object({})));
|
|
3461
|
+
var webSearchOutputSchema = lazySchema18(
|
|
3462
|
+
() => zodSchema18(
|
|
3463
|
+
z20.object({
|
|
3464
|
+
action: z20.discriminatedUnion("type", [
|
|
3465
|
+
z20.object({
|
|
3466
|
+
type: z20.literal("search"),
|
|
3467
|
+
query: z20.string().optional()
|
|
3468
|
+
}),
|
|
3469
|
+
z20.object({
|
|
3470
|
+
type: z20.literal("openPage"),
|
|
3471
|
+
url: z20.string()
|
|
3472
|
+
}),
|
|
3473
|
+
z20.object({
|
|
3474
|
+
type: z20.literal("find"),
|
|
3475
|
+
url: z20.string(),
|
|
3476
|
+
pattern: z20.string()
|
|
3477
|
+
})
|
|
3478
|
+
]),
|
|
3479
|
+
sources: z20.array(
|
|
3480
|
+
z20.discriminatedUnion("type", [
|
|
3481
|
+
z20.object({ type: z20.literal("url"), url: z20.string() }),
|
|
3482
|
+
z20.object({ type: z20.literal("api"), name: z20.string() })
|
|
3483
|
+
])
|
|
3484
|
+
).optional()
|
|
3485
|
+
})
|
|
3486
|
+
)
|
|
3487
|
+
);
|
|
3488
|
+
var webSearchToolFactory = createProviderToolFactoryWithOutputSchema6({
|
|
3489
|
+
id: "openai.web_search",
|
|
3490
|
+
inputSchema: webSearchInputSchema,
|
|
3491
|
+
outputSchema: webSearchOutputSchema
|
|
3492
|
+
});
|
|
3493
|
+
|
|
3494
|
+
// src/tool/web-search-preview.ts
|
|
3495
|
+
import {
|
|
3496
|
+
createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema7,
|
|
3497
|
+
lazySchema as lazySchema19,
|
|
3498
|
+
zodSchema as zodSchema19
|
|
3499
|
+
} from "@ai-sdk/provider-utils";
|
|
3500
|
+
import { z as z21 } from "zod/v4";
|
|
3501
|
+
var webSearchPreviewArgsSchema = lazySchema19(
|
|
3502
|
+
() => zodSchema19(
|
|
3503
|
+
z21.object({
|
|
3504
|
+
searchContextSize: z21.enum(["low", "medium", "high"]).optional(),
|
|
3505
|
+
userLocation: z21.object({
|
|
3506
|
+
type: z21.literal("approximate"),
|
|
3507
|
+
country: z21.string().optional(),
|
|
3508
|
+
city: z21.string().optional(),
|
|
3509
|
+
region: z21.string().optional(),
|
|
3510
|
+
timezone: z21.string().optional()
|
|
3511
|
+
}).optional()
|
|
3512
|
+
})
|
|
3513
|
+
)
|
|
3514
|
+
);
|
|
3515
|
+
var webSearchPreviewInputSchema = lazySchema19(
|
|
3516
|
+
() => zodSchema19(z21.object({}))
|
|
3517
|
+
);
|
|
3518
|
+
var webSearchPreviewOutputSchema = lazySchema19(
|
|
3519
|
+
() => zodSchema19(
|
|
3520
|
+
z21.object({
|
|
3521
|
+
action: z21.discriminatedUnion("type", [
|
|
3522
|
+
z21.object({
|
|
3523
|
+
type: z21.literal("search"),
|
|
3524
|
+
query: z21.string().optional()
|
|
3525
|
+
}),
|
|
3526
|
+
z21.object({
|
|
3527
|
+
type: z21.literal("openPage"),
|
|
3528
|
+
url: z21.string()
|
|
3529
|
+
}),
|
|
3530
|
+
z21.object({
|
|
3531
|
+
type: z21.literal("find"),
|
|
3532
|
+
url: z21.string(),
|
|
3533
|
+
pattern: z21.string()
|
|
3534
|
+
})
|
|
3535
|
+
])
|
|
3536
|
+
})
|
|
3537
|
+
)
|
|
3538
|
+
);
|
|
3539
|
+
var webSearchPreview = createProviderToolFactoryWithOutputSchema7({
|
|
3540
|
+
id: "openai.web_search_preview",
|
|
3541
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
3542
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
3543
|
+
});
|
|
3544
|
+
|
|
3545
3545
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3546
|
-
import { validateTypes as validateTypes2 } from "@ai-sdk/provider-utils";
|
|
3547
3546
|
async function prepareResponsesTools({
|
|
3548
3547
|
tools,
|
|
3549
3548
|
toolChoice,
|
|
@@ -3566,7 +3565,7 @@ async function prepareResponsesTools({
|
|
|
3566
3565
|
strict: strictJsonSchema
|
|
3567
3566
|
});
|
|
3568
3567
|
break;
|
|
3569
|
-
case "provider
|
|
3568
|
+
case "provider": {
|
|
3570
3569
|
switch (tool.id) {
|
|
3571
3570
|
case "openai.file_search": {
|
|
3572
3571
|
const args = await validateTypes2({
|
|
@@ -3666,15 +3665,6 @@ async function prepareResponsesTools({
|
|
|
3666
3665
|
authorization: args.authorization,
|
|
3667
3666
|
connector_id: args.connectorId,
|
|
3668
3667
|
headers: args.headers,
|
|
3669
|
-
// require_approval:
|
|
3670
|
-
// typeof args.requireApproval === 'string'
|
|
3671
|
-
// ? args.requireApproval
|
|
3672
|
-
// : args.requireApproval
|
|
3673
|
-
// ? {
|
|
3674
|
-
// read_only: args.requireApproval.readOnly,
|
|
3675
|
-
// tool_names: args.requireApproval.toolNames,
|
|
3676
|
-
// }
|
|
3677
|
-
// : undefined,
|
|
3678
3668
|
require_approval: "never",
|
|
3679
3669
|
server_description: args.serverDescription,
|
|
3680
3670
|
server_url: args.serverUrl
|
|
@@ -3775,8 +3765,21 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3775
3765
|
details: "conversation and previousResponseId cannot be used together"
|
|
3776
3766
|
});
|
|
3777
3767
|
}
|
|
3768
|
+
const toolNameMapping = createToolNameMapping({
|
|
3769
|
+
tools,
|
|
3770
|
+
providerToolNames: {
|
|
3771
|
+
"openai.code_interpreter": "code_interpreter",
|
|
3772
|
+
"openai.file_search": "file_search",
|
|
3773
|
+
"openai.image_generation": "image_generation",
|
|
3774
|
+
"openai.local_shell": "local_shell",
|
|
3775
|
+
"openai.web_search": "web_search",
|
|
3776
|
+
"openai.web_search_preview": "web_search_preview",
|
|
3777
|
+
"openai.mcp": "mcp"
|
|
3778
|
+
}
|
|
3779
|
+
});
|
|
3778
3780
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3779
3781
|
prompt,
|
|
3782
|
+
toolNameMapping,
|
|
3780
3783
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
3781
3784
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3782
3785
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
@@ -3793,16 +3796,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3793
3796
|
}
|
|
3794
3797
|
}
|
|
3795
3798
|
function hasOpenAITool(id) {
|
|
3796
|
-
return (tools == null ? void 0 : tools.find(
|
|
3797
|
-
(tool) => tool.type === "provider-defined" && tool.id === id
|
|
3798
|
-
)) != null;
|
|
3799
|
+
return (tools == null ? void 0 : tools.find((tool) => tool.type === "provider" && tool.id === id)) != null;
|
|
3799
3800
|
}
|
|
3800
3801
|
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;
|
|
3801
3802
|
if (topLogprobs) {
|
|
3802
3803
|
addInclude("message.output_text.logprobs");
|
|
3803
3804
|
}
|
|
3804
3805
|
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
3805
|
-
(tool) => tool.type === "provider
|
|
3806
|
+
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
3806
3807
|
)) == null ? void 0 : _c.name;
|
|
3807
3808
|
if (webSearchToolName) {
|
|
3808
3809
|
addInclude("web_search_call.action.sources");
|
|
@@ -3930,7 +3931,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3930
3931
|
tool_choice: openaiToolChoice
|
|
3931
3932
|
},
|
|
3932
3933
|
warnings: [...warnings, ...toolWarnings],
|
|
3933
|
-
store
|
|
3934
|
+
store,
|
|
3935
|
+
toolNameMapping
|
|
3934
3936
|
};
|
|
3935
3937
|
}
|
|
3936
3938
|
async doGenerate(options) {
|
|
@@ -3938,7 +3940,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3938
3940
|
const {
|
|
3939
3941
|
args: body,
|
|
3940
3942
|
warnings,
|
|
3941
|
-
webSearchToolName
|
|
3943
|
+
webSearchToolName,
|
|
3944
|
+
toolNameMapping
|
|
3942
3945
|
} = await this.getArgs(options);
|
|
3943
3946
|
const url = this.config.url({
|
|
3944
3947
|
path: "/responses",
|
|
@@ -3998,14 +4001,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3998
4001
|
content.push({
|
|
3999
4002
|
type: "tool-call",
|
|
4000
4003
|
toolCallId: part.id,
|
|
4001
|
-
toolName: "image_generation",
|
|
4004
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4002
4005
|
input: "{}",
|
|
4003
4006
|
providerExecuted: true
|
|
4004
4007
|
});
|
|
4005
4008
|
content.push({
|
|
4006
4009
|
type: "tool-result",
|
|
4007
4010
|
toolCallId: part.id,
|
|
4008
|
-
toolName: "image_generation",
|
|
4011
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4009
4012
|
result: {
|
|
4010
4013
|
result: part.result
|
|
4011
4014
|
}
|
|
@@ -4016,7 +4019,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4016
4019
|
content.push({
|
|
4017
4020
|
type: "tool-call",
|
|
4018
4021
|
toolCallId: part.call_id,
|
|
4019
|
-
toolName: "local_shell",
|
|
4022
|
+
toolName: toolNameMapping.toCustomToolName("local_shell"),
|
|
4020
4023
|
input: JSON.stringify({
|
|
4021
4024
|
action: part.action
|
|
4022
4025
|
}),
|
|
@@ -4126,14 +4129,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4126
4129
|
content.push({
|
|
4127
4130
|
type: "tool-call",
|
|
4128
4131
|
toolCallId: part.id,
|
|
4129
|
-
toolName:
|
|
4132
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4133
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4134
|
+
),
|
|
4130
4135
|
input: JSON.stringify({}),
|
|
4131
4136
|
providerExecuted: true
|
|
4132
4137
|
});
|
|
4133
4138
|
content.push({
|
|
4134
4139
|
type: "tool-result",
|
|
4135
4140
|
toolCallId: part.id,
|
|
4136
|
-
toolName:
|
|
4141
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4142
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4143
|
+
),
|
|
4137
4144
|
result: mapWebSearchOutput(part.action)
|
|
4138
4145
|
});
|
|
4139
4146
|
break;
|
|
@@ -4142,14 +4149,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4142
4149
|
content.push({
|
|
4143
4150
|
type: "tool-call",
|
|
4144
4151
|
toolCallId: part.id,
|
|
4145
|
-
toolName: "mcp",
|
|
4152
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4146
4153
|
input: JSON.stringify({}),
|
|
4147
4154
|
providerExecuted: true
|
|
4148
4155
|
});
|
|
4149
4156
|
content.push({
|
|
4150
4157
|
type: "tool-result",
|
|
4151
4158
|
toolCallId: part.id,
|
|
4152
|
-
toolName: "mcp",
|
|
4159
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4153
4160
|
result: {
|
|
4154
4161
|
type: "call",
|
|
4155
4162
|
serverLabel: part.server_label,
|
|
@@ -4165,14 +4172,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4165
4172
|
content.push({
|
|
4166
4173
|
type: "tool-call",
|
|
4167
4174
|
toolCallId: part.id,
|
|
4168
|
-
toolName: "mcp",
|
|
4175
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4169
4176
|
input: JSON.stringify({}),
|
|
4170
4177
|
providerExecuted: true
|
|
4171
4178
|
});
|
|
4172
4179
|
content.push({
|
|
4173
4180
|
type: "tool-result",
|
|
4174
4181
|
toolCallId: part.id,
|
|
4175
|
-
toolName: "mcp",
|
|
4182
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4176
4183
|
result: {
|
|
4177
4184
|
type: "listTools",
|
|
4178
4185
|
serverLabel: part.server_label,
|
|
@@ -4194,14 +4201,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4194
4201
|
content.push({
|
|
4195
4202
|
type: "tool-call",
|
|
4196
4203
|
toolCallId: part.id,
|
|
4197
|
-
toolName: "mcp",
|
|
4204
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4198
4205
|
input: JSON.stringify({}),
|
|
4199
4206
|
providerExecuted: true
|
|
4200
4207
|
});
|
|
4201
4208
|
content.push({
|
|
4202
4209
|
type: "tool-result",
|
|
4203
4210
|
toolCallId: part.id,
|
|
4204
|
-
toolName: "mcp",
|
|
4211
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4205
4212
|
result: {
|
|
4206
4213
|
type: "approvalRequest",
|
|
4207
4214
|
serverLabel: part.server_label,
|
|
@@ -4216,14 +4223,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4216
4223
|
content.push({
|
|
4217
4224
|
type: "tool-call",
|
|
4218
4225
|
toolCallId: part.id,
|
|
4219
|
-
toolName: "computer_use",
|
|
4226
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4220
4227
|
input: "",
|
|
4221
4228
|
providerExecuted: true
|
|
4222
4229
|
});
|
|
4223
4230
|
content.push({
|
|
4224
4231
|
type: "tool-result",
|
|
4225
4232
|
toolCallId: part.id,
|
|
4226
|
-
toolName: "computer_use",
|
|
4233
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4227
4234
|
result: {
|
|
4228
4235
|
type: "computer_use_tool_result",
|
|
4229
4236
|
status: part.status || "completed"
|
|
@@ -4235,14 +4242,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4235
4242
|
content.push({
|
|
4236
4243
|
type: "tool-call",
|
|
4237
4244
|
toolCallId: part.id,
|
|
4238
|
-
toolName: "file_search",
|
|
4245
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4239
4246
|
input: "{}",
|
|
4240
4247
|
providerExecuted: true
|
|
4241
4248
|
});
|
|
4242
4249
|
content.push({
|
|
4243
4250
|
type: "tool-result",
|
|
4244
4251
|
toolCallId: part.id,
|
|
4245
|
-
toolName: "file_search",
|
|
4252
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4246
4253
|
result: {
|
|
4247
4254
|
queries: part.queries,
|
|
4248
4255
|
results: (_w = (_v = part.results) == null ? void 0 : _v.map((result) => ({
|
|
@@ -4260,7 +4267,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4260
4267
|
content.push({
|
|
4261
4268
|
type: "tool-call",
|
|
4262
4269
|
toolCallId: part.id,
|
|
4263
|
-
toolName: "code_interpreter",
|
|
4270
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4264
4271
|
input: JSON.stringify({
|
|
4265
4272
|
code: part.code,
|
|
4266
4273
|
containerId: part.container_id
|
|
@@ -4270,7 +4277,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4270
4277
|
content.push({
|
|
4271
4278
|
type: "tool-result",
|
|
4272
4279
|
toolCallId: part.id,
|
|
4273
|
-
toolName: "code_interpreter",
|
|
4280
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4274
4281
|
result: {
|
|
4275
4282
|
outputs: part.outputs
|
|
4276
4283
|
}
|
|
@@ -4319,6 +4326,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4319
4326
|
args: body,
|
|
4320
4327
|
warnings,
|
|
4321
4328
|
webSearchToolName,
|
|
4329
|
+
toolNameMapping,
|
|
4322
4330
|
store
|
|
4323
4331
|
} = await this.getArgs(options);
|
|
4324
4332
|
const { responseHeaders, value: response } = await postJsonToApi6({
|
|
@@ -4383,13 +4391,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4383
4391
|
});
|
|
4384
4392
|
} else if (value.item.type === "web_search_call") {
|
|
4385
4393
|
ongoingToolCalls[value.output_index] = {
|
|
4386
|
-
toolName:
|
|
4394
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4395
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4396
|
+
),
|
|
4387
4397
|
toolCallId: value.item.id
|
|
4388
4398
|
};
|
|
4389
4399
|
controller.enqueue({
|
|
4390
4400
|
type: "tool-input-start",
|
|
4391
4401
|
id: value.item.id,
|
|
4392
|
-
toolName:
|
|
4402
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4403
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4404
|
+
),
|
|
4393
4405
|
providerExecuted: true
|
|
4394
4406
|
});
|
|
4395
4407
|
controller.enqueue({
|
|
@@ -4399,24 +4411,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4399
4411
|
controller.enqueue({
|
|
4400
4412
|
type: "tool-call",
|
|
4401
4413
|
toolCallId: value.item.id,
|
|
4402
|
-
toolName:
|
|
4414
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4415
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4416
|
+
),
|
|
4403
4417
|
input: JSON.stringify({}),
|
|
4404
4418
|
providerExecuted: true
|
|
4405
4419
|
});
|
|
4406
4420
|
} else if (value.item.type === "computer_call") {
|
|
4407
4421
|
ongoingToolCalls[value.output_index] = {
|
|
4408
|
-
toolName: "computer_use",
|
|
4422
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4409
4423
|
toolCallId: value.item.id
|
|
4410
4424
|
};
|
|
4411
4425
|
controller.enqueue({
|
|
4412
4426
|
type: "tool-input-start",
|
|
4413
4427
|
id: value.item.id,
|
|
4414
|
-
toolName: "computer_use",
|
|
4428
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4415
4429
|
providerExecuted: true
|
|
4416
4430
|
});
|
|
4417
4431
|
} else if (value.item.type === "code_interpreter_call") {
|
|
4418
4432
|
ongoingToolCalls[value.output_index] = {
|
|
4419
|
-
toolName: "code_interpreter",
|
|
4433
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4420
4434
|
toolCallId: value.item.id,
|
|
4421
4435
|
codeInterpreter: {
|
|
4422
4436
|
containerId: value.item.container_id
|
|
@@ -4425,7 +4439,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4425
4439
|
controller.enqueue({
|
|
4426
4440
|
type: "tool-input-start",
|
|
4427
4441
|
id: value.item.id,
|
|
4428
|
-
toolName: "code_interpreter",
|
|
4442
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4429
4443
|
providerExecuted: true
|
|
4430
4444
|
});
|
|
4431
4445
|
controller.enqueue({
|
|
@@ -4437,7 +4451,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4437
4451
|
controller.enqueue({
|
|
4438
4452
|
type: "tool-call",
|
|
4439
4453
|
toolCallId: value.item.id,
|
|
4440
|
-
toolName: "file_search",
|
|
4454
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4441
4455
|
input: "{}",
|
|
4442
4456
|
providerExecuted: true
|
|
4443
4457
|
});
|
|
@@ -4445,7 +4459,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4445
4459
|
controller.enqueue({
|
|
4446
4460
|
type: "tool-call",
|
|
4447
4461
|
toolCallId: value.item.id,
|
|
4448
|
-
toolName: "image_generation",
|
|
4462
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4449
4463
|
input: "{}",
|
|
4450
4464
|
providerExecuted: true
|
|
4451
4465
|
});
|
|
@@ -4453,7 +4467,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4453
4467
|
controller.enqueue({
|
|
4454
4468
|
type: "tool-call",
|
|
4455
4469
|
toolCallId: value.item.id,
|
|
4456
|
-
toolName: "mcp",
|
|
4470
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4457
4471
|
input: "{}",
|
|
4458
4472
|
providerExecuted: true
|
|
4459
4473
|
});
|
|
@@ -4521,7 +4535,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4521
4535
|
controller.enqueue({
|
|
4522
4536
|
type: "tool-result",
|
|
4523
4537
|
toolCallId: value.item.id,
|
|
4524
|
-
toolName:
|
|
4538
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4539
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4540
|
+
),
|
|
4525
4541
|
result: mapWebSearchOutput(value.item.action)
|
|
4526
4542
|
});
|
|
4527
4543
|
} else if (value.item.type === "computer_call") {
|
|
@@ -4533,14 +4549,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4533
4549
|
controller.enqueue({
|
|
4534
4550
|
type: "tool-call",
|
|
4535
4551
|
toolCallId: value.item.id,
|
|
4536
|
-
toolName: "computer_use",
|
|
4552
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4537
4553
|
input: "",
|
|
4538
4554
|
providerExecuted: true
|
|
4539
4555
|
});
|
|
4540
4556
|
controller.enqueue({
|
|
4541
4557
|
type: "tool-result",
|
|
4542
4558
|
toolCallId: value.item.id,
|
|
4543
|
-
toolName: "computer_use",
|
|
4559
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4544
4560
|
result: {
|
|
4545
4561
|
type: "computer_use_tool_result",
|
|
4546
4562
|
status: value.item.status || "completed"
|
|
@@ -4551,7 +4567,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4551
4567
|
controller.enqueue({
|
|
4552
4568
|
type: "tool-result",
|
|
4553
4569
|
toolCallId: value.item.id,
|
|
4554
|
-
toolName: "file_search",
|
|
4570
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4555
4571
|
result: {
|
|
4556
4572
|
queries: value.item.queries,
|
|
4557
4573
|
results: (_c = (_b = value.item.results) == null ? void 0 : _b.map((result) => ({
|
|
@@ -4568,7 +4584,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4568
4584
|
controller.enqueue({
|
|
4569
4585
|
type: "tool-result",
|
|
4570
4586
|
toolCallId: value.item.id,
|
|
4571
|
-
toolName: "code_interpreter",
|
|
4587
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4572
4588
|
result: {
|
|
4573
4589
|
outputs: value.item.outputs
|
|
4574
4590
|
}
|
|
@@ -4577,7 +4593,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4577
4593
|
controller.enqueue({
|
|
4578
4594
|
type: "tool-result",
|
|
4579
4595
|
toolCallId: value.item.id,
|
|
4580
|
-
toolName: "image_generation",
|
|
4596
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4581
4597
|
result: {
|
|
4582
4598
|
result: value.item.result
|
|
4583
4599
|
}
|
|
@@ -4587,7 +4603,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4587
4603
|
controller.enqueue({
|
|
4588
4604
|
type: "tool-result",
|
|
4589
4605
|
toolCallId: value.item.id,
|
|
4590
|
-
toolName: "mcp",
|
|
4606
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4591
4607
|
result: {
|
|
4592
4608
|
type: "call",
|
|
4593
4609
|
serverLabel: value.item.server_label,
|
|
@@ -4602,7 +4618,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4602
4618
|
controller.enqueue({
|
|
4603
4619
|
type: "tool-result",
|
|
4604
4620
|
toolCallId: value.item.id,
|
|
4605
|
-
toolName: "mcp",
|
|
4621
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4606
4622
|
result: {
|
|
4607
4623
|
type: "listTools",
|
|
4608
4624
|
serverLabel: value.item.server_label,
|
|
@@ -4623,7 +4639,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4623
4639
|
controller.enqueue({
|
|
4624
4640
|
type: "tool-result",
|
|
4625
4641
|
toolCallId: value.item.id,
|
|
4626
|
-
toolName: "mcp",
|
|
4642
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4627
4643
|
result: {
|
|
4628
4644
|
type: "approvalRequest",
|
|
4629
4645
|
serverLabel: value.item.server_label,
|
|
@@ -4637,7 +4653,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4637
4653
|
controller.enqueue({
|
|
4638
4654
|
type: "tool-call",
|
|
4639
4655
|
toolCallId: value.item.call_id,
|
|
4640
|
-
toolName: "local_shell",
|
|
4656
|
+
toolName: toolNameMapping.toCustomToolName("local_shell"),
|
|
4641
4657
|
input: JSON.stringify({
|
|
4642
4658
|
action: {
|
|
4643
4659
|
type: "exec",
|
|
@@ -4686,7 +4702,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4686
4702
|
controller.enqueue({
|
|
4687
4703
|
type: "tool-result",
|
|
4688
4704
|
toolCallId: value.item_id,
|
|
4689
|
-
toolName: "image_generation",
|
|
4705
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4690
4706
|
result: {
|
|
4691
4707
|
result: value.partial_image_b64
|
|
4692
4708
|
},
|
|
@@ -4718,7 +4734,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4718
4734
|
controller.enqueue({
|
|
4719
4735
|
type: "tool-call",
|
|
4720
4736
|
toolCallId: toolCall.toolCallId,
|
|
4721
|
-
toolName: "code_interpreter",
|
|
4737
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4722
4738
|
input: JSON.stringify({
|
|
4723
4739
|
code: value.code,
|
|
4724
4740
|
containerId: toolCall.codeInterpreter.containerId
|