@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.js
CHANGED
|
@@ -2156,9 +2156,8 @@ var localShellInputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
2156
2156
|
var localShellOutputSchema = (0, import_provider_utils19.lazySchema)(
|
|
2157
2157
|
() => (0, import_provider_utils19.zodSchema)(import_v412.z.object({ output: import_v412.z.string() }))
|
|
2158
2158
|
);
|
|
2159
|
-
var localShell = (0, import_provider_utils19.
|
|
2159
|
+
var localShell = (0, import_provider_utils19.createProviderToolFactoryWithOutputSchema)({
|
|
2160
2160
|
id: "openai.local_shell",
|
|
2161
|
-
name: "local_shell",
|
|
2162
2161
|
inputSchema: localShellInputSchema,
|
|
2163
2162
|
outputSchema: localShellOutputSchema
|
|
2164
2163
|
});
|
|
@@ -2170,6 +2169,7 @@ function isFileId(data, prefixes) {
|
|
|
2170
2169
|
}
|
|
2171
2170
|
async function convertToOpenAIResponsesInput({
|
|
2172
2171
|
prompt,
|
|
2172
|
+
toolNameMapping,
|
|
2173
2173
|
systemMessageMode,
|
|
2174
2174
|
fileIdPrefixes,
|
|
2175
2175
|
store,
|
|
@@ -2252,7 +2252,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2252
2252
|
}
|
|
2253
2253
|
case "assistant": {
|
|
2254
2254
|
const reasoningMessages = {};
|
|
2255
|
-
const toolCallParts = {};
|
|
2256
2255
|
for (const part of content) {
|
|
2257
2256
|
switch (part.type) {
|
|
2258
2257
|
case "text": {
|
|
@@ -2269,7 +2268,6 @@ async function convertToOpenAIResponsesInput({
|
|
|
2269
2268
|
break;
|
|
2270
2269
|
}
|
|
2271
2270
|
case "tool-call": {
|
|
2272
|
-
toolCallParts[part.toolCallId] = part;
|
|
2273
2271
|
if (part.providerExecuted) {
|
|
2274
2272
|
break;
|
|
2275
2273
|
}
|
|
@@ -2278,7 +2276,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2278
2276
|
input.push({ type: "item_reference", id });
|
|
2279
2277
|
break;
|
|
2280
2278
|
}
|
|
2281
|
-
|
|
2279
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2280
|
+
part.toolName
|
|
2281
|
+
);
|
|
2282
|
+
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2282
2283
|
const parsedInput = await (0, import_provider_utils20.validateTypes)({
|
|
2283
2284
|
value: part.input,
|
|
2284
2285
|
schema: localShellInputSchema
|
|
@@ -2301,7 +2302,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2301
2302
|
input.push({
|
|
2302
2303
|
type: "function_call",
|
|
2303
2304
|
call_id: part.toolCallId,
|
|
2304
|
-
name:
|
|
2305
|
+
name: resolvedToolName,
|
|
2305
2306
|
arguments: JSON.stringify(part.input),
|
|
2306
2307
|
id
|
|
2307
2308
|
});
|
|
@@ -2380,7 +2381,10 @@ async function convertToOpenAIResponsesInput({
|
|
|
2380
2381
|
case "tool": {
|
|
2381
2382
|
for (const part of content) {
|
|
2382
2383
|
const output = part.output;
|
|
2383
|
-
|
|
2384
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2385
|
+
part.toolName
|
|
2386
|
+
);
|
|
2387
|
+
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2384
2388
|
const parsedOutput = await (0, import_provider_utils20.validateTypes)({
|
|
2385
2389
|
value: output.value,
|
|
2386
2390
|
schema: localShellOutputSchema
|
|
@@ -3182,6 +3186,7 @@ var openaiResponsesProviderOptionsSchema = (0, import_provider_utils22.lazySchem
|
|
|
3182
3186
|
|
|
3183
3187
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3184
3188
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3189
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
3185
3190
|
|
|
3186
3191
|
// src/tool/code-interpreter.ts
|
|
3187
3192
|
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
@@ -3218,9 +3223,8 @@ var codeInterpreterArgsSchema = (0, import_provider_utils23.lazySchema)(
|
|
|
3218
3223
|
})
|
|
3219
3224
|
)
|
|
3220
3225
|
);
|
|
3221
|
-
var codeInterpreterToolFactory = (0, import_provider_utils23.
|
|
3226
|
+
var codeInterpreterToolFactory = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
3222
3227
|
id: "openai.code_interpreter",
|
|
3223
|
-
name: "code_interpreter",
|
|
3224
3228
|
inputSchema: codeInterpreterInputSchema,
|
|
3225
3229
|
outputSchema: codeInterpreterOutputSchema
|
|
3226
3230
|
});
|
|
@@ -3271,144 +3275,40 @@ var fileSearchOutputSchema = (0, import_provider_utils24.lazySchema)(
|
|
|
3271
3275
|
})
|
|
3272
3276
|
)
|
|
3273
3277
|
);
|
|
3274
|
-
var fileSearch = (0, import_provider_utils24.
|
|
3278
|
+
var fileSearch = (0, import_provider_utils24.createProviderToolFactoryWithOutputSchema)({
|
|
3275
3279
|
id: "openai.file_search",
|
|
3276
|
-
name: "file_search",
|
|
3277
3280
|
inputSchema: import_v417.z.object({}),
|
|
3278
3281
|
outputSchema: fileSearchOutputSchema
|
|
3279
3282
|
});
|
|
3280
3283
|
|
|
3281
|
-
// src/tool/
|
|
3284
|
+
// src/tool/image-generation.ts
|
|
3282
3285
|
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
3283
3286
|
var import_v418 = require("zod/v4");
|
|
3284
|
-
var
|
|
3285
|
-
() => (0, import_provider_utils25.zodSchema)(
|
|
3286
|
-
import_v418.z.object({
|
|
3287
|
-
externalWebAccess: import_v418.z.boolean().optional(),
|
|
3288
|
-
filters: import_v418.z.object({ allowedDomains: import_v418.z.array(import_v418.z.string()).optional() }).optional(),
|
|
3289
|
-
searchContextSize: import_v418.z.enum(["low", "medium", "high"]).optional(),
|
|
3290
|
-
userLocation: import_v418.z.object({
|
|
3291
|
-
type: import_v418.z.literal("approximate"),
|
|
3292
|
-
country: import_v418.z.string().optional(),
|
|
3293
|
-
city: import_v418.z.string().optional(),
|
|
3294
|
-
region: import_v418.z.string().optional(),
|
|
3295
|
-
timezone: import_v418.z.string().optional()
|
|
3296
|
-
}).optional()
|
|
3297
|
-
})
|
|
3298
|
-
)
|
|
3299
|
-
);
|
|
3300
|
-
var webSearchInputSchema = (0, import_provider_utils25.lazySchema)(() => (0, import_provider_utils25.zodSchema)(import_v418.z.object({})));
|
|
3301
|
-
var webSearchOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3287
|
+
var imageGenerationArgsSchema = (0, import_provider_utils25.lazySchema)(
|
|
3302
3288
|
() => (0, import_provider_utils25.zodSchema)(
|
|
3303
3289
|
import_v418.z.object({
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
import_v418.z.object({
|
|
3310
|
-
type: import_v418.z.literal("openPage"),
|
|
3311
|
-
url: import_v418.z.string()
|
|
3312
|
-
}),
|
|
3313
|
-
import_v418.z.object({
|
|
3314
|
-
type: import_v418.z.literal("find"),
|
|
3315
|
-
url: import_v418.z.string(),
|
|
3316
|
-
pattern: import_v418.z.string()
|
|
3317
|
-
})
|
|
3318
|
-
]),
|
|
3319
|
-
sources: import_v418.z.array(
|
|
3320
|
-
import_v418.z.discriminatedUnion("type", [
|
|
3321
|
-
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
3322
|
-
import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
|
|
3323
|
-
])
|
|
3324
|
-
).optional()
|
|
3325
|
-
})
|
|
3326
|
-
)
|
|
3327
|
-
);
|
|
3328
|
-
var webSearchToolFactory = (0, import_provider_utils25.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3329
|
-
id: "openai.web_search",
|
|
3330
|
-
name: "web_search",
|
|
3331
|
-
inputSchema: webSearchInputSchema,
|
|
3332
|
-
outputSchema: webSearchOutputSchema
|
|
3333
|
-
});
|
|
3334
|
-
|
|
3335
|
-
// src/tool/web-search-preview.ts
|
|
3336
|
-
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3337
|
-
var import_v419 = require("zod/v4");
|
|
3338
|
-
var webSearchPreviewArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3339
|
-
() => (0, import_provider_utils26.zodSchema)(
|
|
3340
|
-
import_v419.z.object({
|
|
3341
|
-
searchContextSize: import_v419.z.enum(["low", "medium", "high"]).optional(),
|
|
3342
|
-
userLocation: import_v419.z.object({
|
|
3343
|
-
type: import_v419.z.literal("approximate"),
|
|
3344
|
-
country: import_v419.z.string().optional(),
|
|
3345
|
-
city: import_v419.z.string().optional(),
|
|
3346
|
-
region: import_v419.z.string().optional(),
|
|
3347
|
-
timezone: import_v419.z.string().optional()
|
|
3348
|
-
}).optional()
|
|
3349
|
-
})
|
|
3350
|
-
)
|
|
3351
|
-
);
|
|
3352
|
-
var webSearchPreviewInputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3353
|
-
() => (0, import_provider_utils26.zodSchema)(import_v419.z.object({}))
|
|
3354
|
-
);
|
|
3355
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3356
|
-
() => (0, import_provider_utils26.zodSchema)(
|
|
3357
|
-
import_v419.z.object({
|
|
3358
|
-
action: import_v419.z.discriminatedUnion("type", [
|
|
3359
|
-
import_v419.z.object({
|
|
3360
|
-
type: import_v419.z.literal("search"),
|
|
3361
|
-
query: import_v419.z.string().optional()
|
|
3362
|
-
}),
|
|
3363
|
-
import_v419.z.object({
|
|
3364
|
-
type: import_v419.z.literal("openPage"),
|
|
3365
|
-
url: import_v419.z.string()
|
|
3366
|
-
}),
|
|
3367
|
-
import_v419.z.object({
|
|
3368
|
-
type: import_v419.z.literal("find"),
|
|
3369
|
-
url: import_v419.z.string(),
|
|
3370
|
-
pattern: import_v419.z.string()
|
|
3371
|
-
})
|
|
3372
|
-
])
|
|
3373
|
-
})
|
|
3374
|
-
)
|
|
3375
|
-
);
|
|
3376
|
-
var webSearchPreview = (0, import_provider_utils26.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
3377
|
-
id: "openai.web_search_preview",
|
|
3378
|
-
name: "web_search_preview",
|
|
3379
|
-
inputSchema: webSearchPreviewInputSchema,
|
|
3380
|
-
outputSchema: webSearchPreviewOutputSchema
|
|
3381
|
-
});
|
|
3382
|
-
|
|
3383
|
-
// src/tool/image-generation.ts
|
|
3384
|
-
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
3385
|
-
var import_v420 = require("zod/v4");
|
|
3386
|
-
var imageGenerationArgsSchema = (0, import_provider_utils27.lazySchema)(
|
|
3387
|
-
() => (0, import_provider_utils27.zodSchema)(
|
|
3388
|
-
import_v420.z.object({
|
|
3389
|
-
background: import_v420.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3390
|
-
inputFidelity: import_v420.z.enum(["low", "high"]).optional(),
|
|
3391
|
-
inputImageMask: import_v420.z.object({
|
|
3392
|
-
fileId: import_v420.z.string().optional(),
|
|
3393
|
-
imageUrl: import_v420.z.string().optional()
|
|
3290
|
+
background: import_v418.z.enum(["auto", "opaque", "transparent"]).optional(),
|
|
3291
|
+
inputFidelity: import_v418.z.enum(["low", "high"]).optional(),
|
|
3292
|
+
inputImageMask: import_v418.z.object({
|
|
3293
|
+
fileId: import_v418.z.string().optional(),
|
|
3294
|
+
imageUrl: import_v418.z.string().optional()
|
|
3394
3295
|
}).optional(),
|
|
3395
|
-
model:
|
|
3396
|
-
moderation:
|
|
3397
|
-
outputCompression:
|
|
3398
|
-
outputFormat:
|
|
3399
|
-
partialImages:
|
|
3400
|
-
quality:
|
|
3401
|
-
size:
|
|
3296
|
+
model: import_v418.z.string().optional(),
|
|
3297
|
+
moderation: import_v418.z.enum(["auto"]).optional(),
|
|
3298
|
+
outputCompression: import_v418.z.number().int().min(0).max(100).optional(),
|
|
3299
|
+
outputFormat: import_v418.z.enum(["png", "jpeg", "webp"]).optional(),
|
|
3300
|
+
partialImages: import_v418.z.number().int().min(0).max(3).optional(),
|
|
3301
|
+
quality: import_v418.z.enum(["auto", "low", "medium", "high"]).optional(),
|
|
3302
|
+
size: import_v418.z.enum(["1024x1024", "1024x1536", "1536x1024", "auto"]).optional()
|
|
3402
3303
|
}).strict()
|
|
3403
3304
|
)
|
|
3404
3305
|
);
|
|
3405
|
-
var imageGenerationInputSchema = (0,
|
|
3406
|
-
var imageGenerationOutputSchema = (0,
|
|
3407
|
-
() => (0,
|
|
3306
|
+
var imageGenerationInputSchema = (0, import_provider_utils25.lazySchema)(() => (0, import_provider_utils25.zodSchema)(import_v418.z.object({})));
|
|
3307
|
+
var imageGenerationOutputSchema = (0, import_provider_utils25.lazySchema)(
|
|
3308
|
+
() => (0, import_provider_utils25.zodSchema)(import_v418.z.object({ result: import_v418.z.string() }))
|
|
3408
3309
|
);
|
|
3409
|
-
var imageGenerationToolFactory = (0,
|
|
3310
|
+
var imageGenerationToolFactory = (0, import_provider_utils25.createProviderToolFactoryWithOutputSchema)({
|
|
3410
3311
|
id: "openai.image_generation",
|
|
3411
|
-
name: "image_generation",
|
|
3412
3312
|
inputSchema: imageGenerationInputSchema,
|
|
3413
3313
|
outputSchema: imageGenerationOutputSchema
|
|
3414
3314
|
});
|
|
@@ -3417,32 +3317,32 @@ var imageGeneration = (args = {}) => {
|
|
|
3417
3317
|
};
|
|
3418
3318
|
|
|
3419
3319
|
// src/tool/mcp.ts
|
|
3420
|
-
var
|
|
3421
|
-
var
|
|
3422
|
-
var jsonValueSchema =
|
|
3423
|
-
() =>
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3320
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3321
|
+
var import_v419 = require("zod/v4");
|
|
3322
|
+
var jsonValueSchema = import_v419.z.lazy(
|
|
3323
|
+
() => import_v419.z.union([
|
|
3324
|
+
import_v419.z.string(),
|
|
3325
|
+
import_v419.z.number(),
|
|
3326
|
+
import_v419.z.boolean(),
|
|
3327
|
+
import_v419.z.null(),
|
|
3328
|
+
import_v419.z.array(jsonValueSchema),
|
|
3329
|
+
import_v419.z.record(import_v419.z.string(), jsonValueSchema)
|
|
3430
3330
|
])
|
|
3431
3331
|
);
|
|
3432
|
-
var mcpArgsSchema = (0,
|
|
3433
|
-
() => (0,
|
|
3434
|
-
|
|
3435
|
-
serverLabel:
|
|
3436
|
-
allowedTools:
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
readOnly:
|
|
3440
|
-
toolNames:
|
|
3332
|
+
var mcpArgsSchema = (0, import_provider_utils26.lazySchema)(
|
|
3333
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3334
|
+
import_v419.z.object({
|
|
3335
|
+
serverLabel: import_v419.z.string(),
|
|
3336
|
+
allowedTools: import_v419.z.union([
|
|
3337
|
+
import_v419.z.array(import_v419.z.string()),
|
|
3338
|
+
import_v419.z.object({
|
|
3339
|
+
readOnly: import_v419.z.boolean().optional(),
|
|
3340
|
+
toolNames: import_v419.z.array(import_v419.z.string()).optional()
|
|
3441
3341
|
})
|
|
3442
3342
|
]).optional(),
|
|
3443
|
-
authorization:
|
|
3444
|
-
connectorId:
|
|
3445
|
-
headers:
|
|
3343
|
+
authorization: import_v419.z.string().optional(),
|
|
3344
|
+
connectorId: import_v419.z.string().optional(),
|
|
3345
|
+
headers: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional(),
|
|
3446
3346
|
// TODO: Integrate this MCP tool approval with our SDK's existing tool approval architecture
|
|
3447
3347
|
// requireApproval: z
|
|
3448
3348
|
// .union([
|
|
@@ -3453,58 +3353,156 @@ var mcpArgsSchema = (0, import_provider_utils28.lazySchema)(
|
|
|
3453
3353
|
// }),
|
|
3454
3354
|
// ])
|
|
3455
3355
|
// .optional(),
|
|
3456
|
-
serverDescription:
|
|
3457
|
-
serverUrl:
|
|
3356
|
+
serverDescription: import_v419.z.string().optional(),
|
|
3357
|
+
serverUrl: import_v419.z.string().optional()
|
|
3458
3358
|
}).refine(
|
|
3459
3359
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
3460
3360
|
"One of serverUrl or connectorId must be provided."
|
|
3461
3361
|
)
|
|
3462
3362
|
)
|
|
3463
3363
|
);
|
|
3464
|
-
var mcpInputSchema = (0,
|
|
3465
|
-
var mcpOutputSchema = (0,
|
|
3466
|
-
() => (0,
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
type:
|
|
3470
|
-
serverLabel:
|
|
3471
|
-
name:
|
|
3472
|
-
arguments:
|
|
3473
|
-
output:
|
|
3474
|
-
error:
|
|
3364
|
+
var mcpInputSchema = (0, import_provider_utils26.lazySchema)(() => (0, import_provider_utils26.zodSchema)(import_v419.z.object({})));
|
|
3365
|
+
var mcpOutputSchema = (0, import_provider_utils26.lazySchema)(
|
|
3366
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3367
|
+
import_v419.z.discriminatedUnion("type", [
|
|
3368
|
+
import_v419.z.object({
|
|
3369
|
+
type: import_v419.z.literal("call"),
|
|
3370
|
+
serverLabel: import_v419.z.string(),
|
|
3371
|
+
name: import_v419.z.string(),
|
|
3372
|
+
arguments: import_v419.z.string(),
|
|
3373
|
+
output: import_v419.z.string().nullable().optional(),
|
|
3374
|
+
error: import_v419.z.union([import_v419.z.string(), jsonValueSchema]).optional()
|
|
3475
3375
|
}),
|
|
3476
|
-
|
|
3477
|
-
type:
|
|
3478
|
-
serverLabel:
|
|
3479
|
-
tools:
|
|
3480
|
-
|
|
3481
|
-
name:
|
|
3482
|
-
description:
|
|
3376
|
+
import_v419.z.object({
|
|
3377
|
+
type: import_v419.z.literal("listTools"),
|
|
3378
|
+
serverLabel: import_v419.z.string(),
|
|
3379
|
+
tools: import_v419.z.array(
|
|
3380
|
+
import_v419.z.object({
|
|
3381
|
+
name: import_v419.z.string(),
|
|
3382
|
+
description: import_v419.z.string().optional(),
|
|
3483
3383
|
inputSchema: jsonValueSchema,
|
|
3484
|
-
annotations:
|
|
3384
|
+
annotations: import_v419.z.record(import_v419.z.string(), jsonValueSchema).optional()
|
|
3485
3385
|
})
|
|
3486
3386
|
),
|
|
3487
|
-
error:
|
|
3387
|
+
error: import_v419.z.union([import_v419.z.string(), jsonValueSchema]).optional()
|
|
3488
3388
|
}),
|
|
3489
|
-
|
|
3490
|
-
type:
|
|
3491
|
-
serverLabel:
|
|
3492
|
-
name:
|
|
3493
|
-
arguments:
|
|
3494
|
-
approvalRequestId:
|
|
3389
|
+
import_v419.z.object({
|
|
3390
|
+
type: import_v419.z.literal("approvalRequest"),
|
|
3391
|
+
serverLabel: import_v419.z.string(),
|
|
3392
|
+
name: import_v419.z.string(),
|
|
3393
|
+
arguments: import_v419.z.string(),
|
|
3394
|
+
approvalRequestId: import_v419.z.string()
|
|
3495
3395
|
})
|
|
3496
3396
|
])
|
|
3497
3397
|
)
|
|
3498
3398
|
);
|
|
3499
|
-
var mcpToolFactory = (0,
|
|
3399
|
+
var mcpToolFactory = (0, import_provider_utils26.createProviderToolFactoryWithOutputSchema)({
|
|
3500
3400
|
id: "openai.mcp",
|
|
3501
|
-
name: "mcp",
|
|
3502
3401
|
inputSchema: mcpInputSchema,
|
|
3503
3402
|
outputSchema: mcpOutputSchema
|
|
3504
3403
|
});
|
|
3505
3404
|
|
|
3405
|
+
// src/tool/web-search.ts
|
|
3406
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
3407
|
+
var import_v420 = require("zod/v4");
|
|
3408
|
+
var webSearchArgsSchema = (0, import_provider_utils27.lazySchema)(
|
|
3409
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
3410
|
+
import_v420.z.object({
|
|
3411
|
+
externalWebAccess: import_v420.z.boolean().optional(),
|
|
3412
|
+
filters: import_v420.z.object({ allowedDomains: import_v420.z.array(import_v420.z.string()).optional() }).optional(),
|
|
3413
|
+
searchContextSize: import_v420.z.enum(["low", "medium", "high"]).optional(),
|
|
3414
|
+
userLocation: import_v420.z.object({
|
|
3415
|
+
type: import_v420.z.literal("approximate"),
|
|
3416
|
+
country: import_v420.z.string().optional(),
|
|
3417
|
+
city: import_v420.z.string().optional(),
|
|
3418
|
+
region: import_v420.z.string().optional(),
|
|
3419
|
+
timezone: import_v420.z.string().optional()
|
|
3420
|
+
}).optional()
|
|
3421
|
+
})
|
|
3422
|
+
)
|
|
3423
|
+
);
|
|
3424
|
+
var webSearchInputSchema = (0, import_provider_utils27.lazySchema)(() => (0, import_provider_utils27.zodSchema)(import_v420.z.object({})));
|
|
3425
|
+
var webSearchOutputSchema = (0, import_provider_utils27.lazySchema)(
|
|
3426
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
3427
|
+
import_v420.z.object({
|
|
3428
|
+
action: import_v420.z.discriminatedUnion("type", [
|
|
3429
|
+
import_v420.z.object({
|
|
3430
|
+
type: import_v420.z.literal("search"),
|
|
3431
|
+
query: import_v420.z.string().optional()
|
|
3432
|
+
}),
|
|
3433
|
+
import_v420.z.object({
|
|
3434
|
+
type: import_v420.z.literal("openPage"),
|
|
3435
|
+
url: import_v420.z.string()
|
|
3436
|
+
}),
|
|
3437
|
+
import_v420.z.object({
|
|
3438
|
+
type: import_v420.z.literal("find"),
|
|
3439
|
+
url: import_v420.z.string(),
|
|
3440
|
+
pattern: import_v420.z.string()
|
|
3441
|
+
})
|
|
3442
|
+
]),
|
|
3443
|
+
sources: import_v420.z.array(
|
|
3444
|
+
import_v420.z.discriminatedUnion("type", [
|
|
3445
|
+
import_v420.z.object({ type: import_v420.z.literal("url"), url: import_v420.z.string() }),
|
|
3446
|
+
import_v420.z.object({ type: import_v420.z.literal("api"), name: import_v420.z.string() })
|
|
3447
|
+
])
|
|
3448
|
+
).optional()
|
|
3449
|
+
})
|
|
3450
|
+
)
|
|
3451
|
+
);
|
|
3452
|
+
var webSearchToolFactory = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
3453
|
+
id: "openai.web_search",
|
|
3454
|
+
inputSchema: webSearchInputSchema,
|
|
3455
|
+
outputSchema: webSearchOutputSchema
|
|
3456
|
+
});
|
|
3457
|
+
|
|
3458
|
+
// src/tool/web-search-preview.ts
|
|
3459
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
3460
|
+
var import_v421 = require("zod/v4");
|
|
3461
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils28.lazySchema)(
|
|
3462
|
+
() => (0, import_provider_utils28.zodSchema)(
|
|
3463
|
+
import_v421.z.object({
|
|
3464
|
+
searchContextSize: import_v421.z.enum(["low", "medium", "high"]).optional(),
|
|
3465
|
+
userLocation: import_v421.z.object({
|
|
3466
|
+
type: import_v421.z.literal("approximate"),
|
|
3467
|
+
country: import_v421.z.string().optional(),
|
|
3468
|
+
city: import_v421.z.string().optional(),
|
|
3469
|
+
region: import_v421.z.string().optional(),
|
|
3470
|
+
timezone: import_v421.z.string().optional()
|
|
3471
|
+
}).optional()
|
|
3472
|
+
})
|
|
3473
|
+
)
|
|
3474
|
+
);
|
|
3475
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils28.lazySchema)(
|
|
3476
|
+
() => (0, import_provider_utils28.zodSchema)(import_v421.z.object({}))
|
|
3477
|
+
);
|
|
3478
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils28.lazySchema)(
|
|
3479
|
+
() => (0, import_provider_utils28.zodSchema)(
|
|
3480
|
+
import_v421.z.object({
|
|
3481
|
+
action: import_v421.z.discriminatedUnion("type", [
|
|
3482
|
+
import_v421.z.object({
|
|
3483
|
+
type: import_v421.z.literal("search"),
|
|
3484
|
+
query: import_v421.z.string().optional()
|
|
3485
|
+
}),
|
|
3486
|
+
import_v421.z.object({
|
|
3487
|
+
type: import_v421.z.literal("openPage"),
|
|
3488
|
+
url: import_v421.z.string()
|
|
3489
|
+
}),
|
|
3490
|
+
import_v421.z.object({
|
|
3491
|
+
type: import_v421.z.literal("find"),
|
|
3492
|
+
url: import_v421.z.string(),
|
|
3493
|
+
pattern: import_v421.z.string()
|
|
3494
|
+
})
|
|
3495
|
+
])
|
|
3496
|
+
})
|
|
3497
|
+
)
|
|
3498
|
+
);
|
|
3499
|
+
var webSearchPreview = (0, import_provider_utils28.createProviderToolFactoryWithOutputSchema)({
|
|
3500
|
+
id: "openai.web_search_preview",
|
|
3501
|
+
inputSchema: webSearchPreviewInputSchema,
|
|
3502
|
+
outputSchema: webSearchPreviewOutputSchema
|
|
3503
|
+
});
|
|
3504
|
+
|
|
3506
3505
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3507
|
-
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
3508
3506
|
async function prepareResponsesTools({
|
|
3509
3507
|
tools,
|
|
3510
3508
|
toolChoice,
|
|
@@ -3527,7 +3525,7 @@ async function prepareResponsesTools({
|
|
|
3527
3525
|
strict: strictJsonSchema
|
|
3528
3526
|
});
|
|
3529
3527
|
break;
|
|
3530
|
-
case "provider
|
|
3528
|
+
case "provider": {
|
|
3531
3529
|
switch (tool.id) {
|
|
3532
3530
|
case "openai.file_search": {
|
|
3533
3531
|
const args = await (0, import_provider_utils29.validateTypes)({
|
|
@@ -3627,15 +3625,6 @@ async function prepareResponsesTools({
|
|
|
3627
3625
|
authorization: args.authorization,
|
|
3628
3626
|
connector_id: args.connectorId,
|
|
3629
3627
|
headers: args.headers,
|
|
3630
|
-
// require_approval:
|
|
3631
|
-
// typeof args.requireApproval === 'string'
|
|
3632
|
-
// ? args.requireApproval
|
|
3633
|
-
// : args.requireApproval
|
|
3634
|
-
// ? {
|
|
3635
|
-
// read_only: args.requireApproval.readOnly,
|
|
3636
|
-
// tool_names: args.requireApproval.toolNames,
|
|
3637
|
-
// }
|
|
3638
|
-
// : undefined,
|
|
3639
3628
|
require_approval: "never",
|
|
3640
3629
|
server_description: args.serverDescription,
|
|
3641
3630
|
server_url: args.serverUrl
|
|
@@ -3736,8 +3725,21 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3736
3725
|
details: "conversation and previousResponseId cannot be used together"
|
|
3737
3726
|
});
|
|
3738
3727
|
}
|
|
3728
|
+
const toolNameMapping = (0, import_provider_utils30.createToolNameMapping)({
|
|
3729
|
+
tools,
|
|
3730
|
+
providerToolNames: {
|
|
3731
|
+
"openai.code_interpreter": "code_interpreter",
|
|
3732
|
+
"openai.file_search": "file_search",
|
|
3733
|
+
"openai.image_generation": "image_generation",
|
|
3734
|
+
"openai.local_shell": "local_shell",
|
|
3735
|
+
"openai.web_search": "web_search",
|
|
3736
|
+
"openai.web_search_preview": "web_search_preview",
|
|
3737
|
+
"openai.mcp": "mcp"
|
|
3738
|
+
}
|
|
3739
|
+
});
|
|
3739
3740
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3740
3741
|
prompt,
|
|
3742
|
+
toolNameMapping,
|
|
3741
3743
|
systemMessageMode: modelConfig.systemMessageMode,
|
|
3742
3744
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
3743
3745
|
store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
|
|
@@ -3754,16 +3756,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3754
3756
|
}
|
|
3755
3757
|
}
|
|
3756
3758
|
function hasOpenAITool(id) {
|
|
3757
|
-
return (tools == null ? void 0 : tools.find(
|
|
3758
|
-
(tool) => tool.type === "provider-defined" && tool.id === id
|
|
3759
|
-
)) != null;
|
|
3759
|
+
return (tools == null ? void 0 : tools.find((tool) => tool.type === "provider" && tool.id === id)) != null;
|
|
3760
3760
|
}
|
|
3761
3761
|
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;
|
|
3762
3762
|
if (topLogprobs) {
|
|
3763
3763
|
addInclude("message.output_text.logprobs");
|
|
3764
3764
|
}
|
|
3765
3765
|
const webSearchToolName = (_c = tools == null ? void 0 : tools.find(
|
|
3766
|
-
(tool) => tool.type === "provider
|
|
3766
|
+
(tool) => tool.type === "provider" && (tool.id === "openai.web_search" || tool.id === "openai.web_search_preview")
|
|
3767
3767
|
)) == null ? void 0 : _c.name;
|
|
3768
3768
|
if (webSearchToolName) {
|
|
3769
3769
|
addInclude("web_search_call.action.sources");
|
|
@@ -3891,7 +3891,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3891
3891
|
tool_choice: openaiToolChoice
|
|
3892
3892
|
},
|
|
3893
3893
|
warnings: [...warnings, ...toolWarnings],
|
|
3894
|
-
store
|
|
3894
|
+
store,
|
|
3895
|
+
toolNameMapping
|
|
3895
3896
|
};
|
|
3896
3897
|
}
|
|
3897
3898
|
async doGenerate(options) {
|
|
@@ -3899,7 +3900,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3899
3900
|
const {
|
|
3900
3901
|
args: body,
|
|
3901
3902
|
warnings,
|
|
3902
|
-
webSearchToolName
|
|
3903
|
+
webSearchToolName,
|
|
3904
|
+
toolNameMapping
|
|
3903
3905
|
} = await this.getArgs(options);
|
|
3904
3906
|
const url = this.config.url({
|
|
3905
3907
|
path: "/responses",
|
|
@@ -3959,14 +3961,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3959
3961
|
content.push({
|
|
3960
3962
|
type: "tool-call",
|
|
3961
3963
|
toolCallId: part.id,
|
|
3962
|
-
toolName: "image_generation",
|
|
3964
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
3963
3965
|
input: "{}",
|
|
3964
3966
|
providerExecuted: true
|
|
3965
3967
|
});
|
|
3966
3968
|
content.push({
|
|
3967
3969
|
type: "tool-result",
|
|
3968
3970
|
toolCallId: part.id,
|
|
3969
|
-
toolName: "image_generation",
|
|
3971
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
3970
3972
|
result: {
|
|
3971
3973
|
result: part.result
|
|
3972
3974
|
}
|
|
@@ -3977,7 +3979,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3977
3979
|
content.push({
|
|
3978
3980
|
type: "tool-call",
|
|
3979
3981
|
toolCallId: part.call_id,
|
|
3980
|
-
toolName: "local_shell",
|
|
3982
|
+
toolName: toolNameMapping.toCustomToolName("local_shell"),
|
|
3981
3983
|
input: JSON.stringify({
|
|
3982
3984
|
action: part.action
|
|
3983
3985
|
}),
|
|
@@ -4087,14 +4089,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4087
4089
|
content.push({
|
|
4088
4090
|
type: "tool-call",
|
|
4089
4091
|
toolCallId: part.id,
|
|
4090
|
-
toolName:
|
|
4092
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4093
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4094
|
+
),
|
|
4091
4095
|
input: JSON.stringify({}),
|
|
4092
4096
|
providerExecuted: true
|
|
4093
4097
|
});
|
|
4094
4098
|
content.push({
|
|
4095
4099
|
type: "tool-result",
|
|
4096
4100
|
toolCallId: part.id,
|
|
4097
|
-
toolName:
|
|
4101
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4102
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4103
|
+
),
|
|
4098
4104
|
result: mapWebSearchOutput(part.action)
|
|
4099
4105
|
});
|
|
4100
4106
|
break;
|
|
@@ -4103,14 +4109,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4103
4109
|
content.push({
|
|
4104
4110
|
type: "tool-call",
|
|
4105
4111
|
toolCallId: part.id,
|
|
4106
|
-
toolName: "mcp",
|
|
4112
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4107
4113
|
input: JSON.stringify({}),
|
|
4108
4114
|
providerExecuted: true
|
|
4109
4115
|
});
|
|
4110
4116
|
content.push({
|
|
4111
4117
|
type: "tool-result",
|
|
4112
4118
|
toolCallId: part.id,
|
|
4113
|
-
toolName: "mcp",
|
|
4119
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4114
4120
|
result: {
|
|
4115
4121
|
type: "call",
|
|
4116
4122
|
serverLabel: part.server_label,
|
|
@@ -4126,14 +4132,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4126
4132
|
content.push({
|
|
4127
4133
|
type: "tool-call",
|
|
4128
4134
|
toolCallId: part.id,
|
|
4129
|
-
toolName: "mcp",
|
|
4135
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4130
4136
|
input: JSON.stringify({}),
|
|
4131
4137
|
providerExecuted: true
|
|
4132
4138
|
});
|
|
4133
4139
|
content.push({
|
|
4134
4140
|
type: "tool-result",
|
|
4135
4141
|
toolCallId: part.id,
|
|
4136
|
-
toolName: "mcp",
|
|
4142
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4137
4143
|
result: {
|
|
4138
4144
|
type: "listTools",
|
|
4139
4145
|
serverLabel: part.server_label,
|
|
@@ -4155,14 +4161,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4155
4161
|
content.push({
|
|
4156
4162
|
type: "tool-call",
|
|
4157
4163
|
toolCallId: part.id,
|
|
4158
|
-
toolName: "mcp",
|
|
4164
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4159
4165
|
input: JSON.stringify({}),
|
|
4160
4166
|
providerExecuted: true
|
|
4161
4167
|
});
|
|
4162
4168
|
content.push({
|
|
4163
4169
|
type: "tool-result",
|
|
4164
4170
|
toolCallId: part.id,
|
|
4165
|
-
toolName: "mcp",
|
|
4171
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4166
4172
|
result: {
|
|
4167
4173
|
type: "approvalRequest",
|
|
4168
4174
|
serverLabel: part.server_label,
|
|
@@ -4177,14 +4183,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4177
4183
|
content.push({
|
|
4178
4184
|
type: "tool-call",
|
|
4179
4185
|
toolCallId: part.id,
|
|
4180
|
-
toolName: "computer_use",
|
|
4186
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4181
4187
|
input: "",
|
|
4182
4188
|
providerExecuted: true
|
|
4183
4189
|
});
|
|
4184
4190
|
content.push({
|
|
4185
4191
|
type: "tool-result",
|
|
4186
4192
|
toolCallId: part.id,
|
|
4187
|
-
toolName: "computer_use",
|
|
4193
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4188
4194
|
result: {
|
|
4189
4195
|
type: "computer_use_tool_result",
|
|
4190
4196
|
status: part.status || "completed"
|
|
@@ -4196,14 +4202,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4196
4202
|
content.push({
|
|
4197
4203
|
type: "tool-call",
|
|
4198
4204
|
toolCallId: part.id,
|
|
4199
|
-
toolName: "file_search",
|
|
4205
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4200
4206
|
input: "{}",
|
|
4201
4207
|
providerExecuted: true
|
|
4202
4208
|
});
|
|
4203
4209
|
content.push({
|
|
4204
4210
|
type: "tool-result",
|
|
4205
4211
|
toolCallId: part.id,
|
|
4206
|
-
toolName: "file_search",
|
|
4212
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4207
4213
|
result: {
|
|
4208
4214
|
queries: part.queries,
|
|
4209
4215
|
results: (_w = (_v = part.results) == null ? void 0 : _v.map((result) => ({
|
|
@@ -4221,7 +4227,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4221
4227
|
content.push({
|
|
4222
4228
|
type: "tool-call",
|
|
4223
4229
|
toolCallId: part.id,
|
|
4224
|
-
toolName: "code_interpreter",
|
|
4230
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4225
4231
|
input: JSON.stringify({
|
|
4226
4232
|
code: part.code,
|
|
4227
4233
|
containerId: part.container_id
|
|
@@ -4231,7 +4237,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4231
4237
|
content.push({
|
|
4232
4238
|
type: "tool-result",
|
|
4233
4239
|
toolCallId: part.id,
|
|
4234
|
-
toolName: "code_interpreter",
|
|
4240
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4235
4241
|
result: {
|
|
4236
4242
|
outputs: part.outputs
|
|
4237
4243
|
}
|
|
@@ -4280,6 +4286,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4280
4286
|
args: body,
|
|
4281
4287
|
warnings,
|
|
4282
4288
|
webSearchToolName,
|
|
4289
|
+
toolNameMapping,
|
|
4283
4290
|
store
|
|
4284
4291
|
} = await this.getArgs(options);
|
|
4285
4292
|
const { responseHeaders, value: response } = await (0, import_provider_utils30.postJsonToApi)({
|
|
@@ -4344,13 +4351,17 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4344
4351
|
});
|
|
4345
4352
|
} else if (value.item.type === "web_search_call") {
|
|
4346
4353
|
ongoingToolCalls[value.output_index] = {
|
|
4347
|
-
toolName:
|
|
4354
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4355
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4356
|
+
),
|
|
4348
4357
|
toolCallId: value.item.id
|
|
4349
4358
|
};
|
|
4350
4359
|
controller.enqueue({
|
|
4351
4360
|
type: "tool-input-start",
|
|
4352
4361
|
id: value.item.id,
|
|
4353
|
-
toolName:
|
|
4362
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4363
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4364
|
+
),
|
|
4354
4365
|
providerExecuted: true
|
|
4355
4366
|
});
|
|
4356
4367
|
controller.enqueue({
|
|
@@ -4360,24 +4371,26 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4360
4371
|
controller.enqueue({
|
|
4361
4372
|
type: "tool-call",
|
|
4362
4373
|
toolCallId: value.item.id,
|
|
4363
|
-
toolName:
|
|
4374
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4375
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4376
|
+
),
|
|
4364
4377
|
input: JSON.stringify({}),
|
|
4365
4378
|
providerExecuted: true
|
|
4366
4379
|
});
|
|
4367
4380
|
} else if (value.item.type === "computer_call") {
|
|
4368
4381
|
ongoingToolCalls[value.output_index] = {
|
|
4369
|
-
toolName: "computer_use",
|
|
4382
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4370
4383
|
toolCallId: value.item.id
|
|
4371
4384
|
};
|
|
4372
4385
|
controller.enqueue({
|
|
4373
4386
|
type: "tool-input-start",
|
|
4374
4387
|
id: value.item.id,
|
|
4375
|
-
toolName: "computer_use",
|
|
4388
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4376
4389
|
providerExecuted: true
|
|
4377
4390
|
});
|
|
4378
4391
|
} else if (value.item.type === "code_interpreter_call") {
|
|
4379
4392
|
ongoingToolCalls[value.output_index] = {
|
|
4380
|
-
toolName: "code_interpreter",
|
|
4393
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4381
4394
|
toolCallId: value.item.id,
|
|
4382
4395
|
codeInterpreter: {
|
|
4383
4396
|
containerId: value.item.container_id
|
|
@@ -4386,7 +4399,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4386
4399
|
controller.enqueue({
|
|
4387
4400
|
type: "tool-input-start",
|
|
4388
4401
|
id: value.item.id,
|
|
4389
|
-
toolName: "code_interpreter",
|
|
4402
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4390
4403
|
providerExecuted: true
|
|
4391
4404
|
});
|
|
4392
4405
|
controller.enqueue({
|
|
@@ -4398,7 +4411,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4398
4411
|
controller.enqueue({
|
|
4399
4412
|
type: "tool-call",
|
|
4400
4413
|
toolCallId: value.item.id,
|
|
4401
|
-
toolName: "file_search",
|
|
4414
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4402
4415
|
input: "{}",
|
|
4403
4416
|
providerExecuted: true
|
|
4404
4417
|
});
|
|
@@ -4406,7 +4419,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4406
4419
|
controller.enqueue({
|
|
4407
4420
|
type: "tool-call",
|
|
4408
4421
|
toolCallId: value.item.id,
|
|
4409
|
-
toolName: "image_generation",
|
|
4422
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4410
4423
|
input: "{}",
|
|
4411
4424
|
providerExecuted: true
|
|
4412
4425
|
});
|
|
@@ -4414,7 +4427,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4414
4427
|
controller.enqueue({
|
|
4415
4428
|
type: "tool-call",
|
|
4416
4429
|
toolCallId: value.item.id,
|
|
4417
|
-
toolName: "mcp",
|
|
4430
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4418
4431
|
input: "{}",
|
|
4419
4432
|
providerExecuted: true
|
|
4420
4433
|
});
|
|
@@ -4482,7 +4495,9 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4482
4495
|
controller.enqueue({
|
|
4483
4496
|
type: "tool-result",
|
|
4484
4497
|
toolCallId: value.item.id,
|
|
4485
|
-
toolName:
|
|
4498
|
+
toolName: toolNameMapping.toCustomToolName(
|
|
4499
|
+
webSearchToolName != null ? webSearchToolName : "web_search"
|
|
4500
|
+
),
|
|
4486
4501
|
result: mapWebSearchOutput(value.item.action)
|
|
4487
4502
|
});
|
|
4488
4503
|
} else if (value.item.type === "computer_call") {
|
|
@@ -4494,14 +4509,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4494
4509
|
controller.enqueue({
|
|
4495
4510
|
type: "tool-call",
|
|
4496
4511
|
toolCallId: value.item.id,
|
|
4497
|
-
toolName: "computer_use",
|
|
4512
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4498
4513
|
input: "",
|
|
4499
4514
|
providerExecuted: true
|
|
4500
4515
|
});
|
|
4501
4516
|
controller.enqueue({
|
|
4502
4517
|
type: "tool-result",
|
|
4503
4518
|
toolCallId: value.item.id,
|
|
4504
|
-
toolName: "computer_use",
|
|
4519
|
+
toolName: toolNameMapping.toCustomToolName("computer_use"),
|
|
4505
4520
|
result: {
|
|
4506
4521
|
type: "computer_use_tool_result",
|
|
4507
4522
|
status: value.item.status || "completed"
|
|
@@ -4512,7 +4527,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4512
4527
|
controller.enqueue({
|
|
4513
4528
|
type: "tool-result",
|
|
4514
4529
|
toolCallId: value.item.id,
|
|
4515
|
-
toolName: "file_search",
|
|
4530
|
+
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
4516
4531
|
result: {
|
|
4517
4532
|
queries: value.item.queries,
|
|
4518
4533
|
results: (_c = (_b = value.item.results) == null ? void 0 : _b.map((result) => ({
|
|
@@ -4529,7 +4544,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4529
4544
|
controller.enqueue({
|
|
4530
4545
|
type: "tool-result",
|
|
4531
4546
|
toolCallId: value.item.id,
|
|
4532
|
-
toolName: "code_interpreter",
|
|
4547
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4533
4548
|
result: {
|
|
4534
4549
|
outputs: value.item.outputs
|
|
4535
4550
|
}
|
|
@@ -4538,7 +4553,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4538
4553
|
controller.enqueue({
|
|
4539
4554
|
type: "tool-result",
|
|
4540
4555
|
toolCallId: value.item.id,
|
|
4541
|
-
toolName: "image_generation",
|
|
4556
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4542
4557
|
result: {
|
|
4543
4558
|
result: value.item.result
|
|
4544
4559
|
}
|
|
@@ -4548,7 +4563,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4548
4563
|
controller.enqueue({
|
|
4549
4564
|
type: "tool-result",
|
|
4550
4565
|
toolCallId: value.item.id,
|
|
4551
|
-
toolName: "mcp",
|
|
4566
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4552
4567
|
result: {
|
|
4553
4568
|
type: "call",
|
|
4554
4569
|
serverLabel: value.item.server_label,
|
|
@@ -4563,7 +4578,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4563
4578
|
controller.enqueue({
|
|
4564
4579
|
type: "tool-result",
|
|
4565
4580
|
toolCallId: value.item.id,
|
|
4566
|
-
toolName: "mcp",
|
|
4581
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4567
4582
|
result: {
|
|
4568
4583
|
type: "listTools",
|
|
4569
4584
|
serverLabel: value.item.server_label,
|
|
@@ -4584,7 +4599,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4584
4599
|
controller.enqueue({
|
|
4585
4600
|
type: "tool-result",
|
|
4586
4601
|
toolCallId: value.item.id,
|
|
4587
|
-
toolName: "mcp",
|
|
4602
|
+
toolName: toolNameMapping.toCustomToolName("mcp"),
|
|
4588
4603
|
result: {
|
|
4589
4604
|
type: "approvalRequest",
|
|
4590
4605
|
serverLabel: value.item.server_label,
|
|
@@ -4598,7 +4613,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4598
4613
|
controller.enqueue({
|
|
4599
4614
|
type: "tool-call",
|
|
4600
4615
|
toolCallId: value.item.call_id,
|
|
4601
|
-
toolName: "local_shell",
|
|
4616
|
+
toolName: toolNameMapping.toCustomToolName("local_shell"),
|
|
4602
4617
|
input: JSON.stringify({
|
|
4603
4618
|
action: {
|
|
4604
4619
|
type: "exec",
|
|
@@ -4647,7 +4662,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4647
4662
|
controller.enqueue({
|
|
4648
4663
|
type: "tool-result",
|
|
4649
4664
|
toolCallId: value.item_id,
|
|
4650
|
-
toolName: "image_generation",
|
|
4665
|
+
toolName: toolNameMapping.toCustomToolName("image_generation"),
|
|
4651
4666
|
result: {
|
|
4652
4667
|
result: value.partial_image_b64
|
|
4653
4668
|
},
|
|
@@ -4679,7 +4694,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4679
4694
|
controller.enqueue({
|
|
4680
4695
|
type: "tool-call",
|
|
4681
4696
|
toolCallId: toolCall.toolCallId,
|
|
4682
|
-
toolName: "code_interpreter",
|
|
4697
|
+
toolName: toolNameMapping.toCustomToolName("code_interpreter"),
|
|
4683
4698
|
input: JSON.stringify({
|
|
4684
4699
|
code: value.code,
|
|
4685
4700
|
containerId: toolCall.codeInterpreter.containerId
|