@ai-sdk/openai 3.0.45 → 3.0.47
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 +14 -0
- package/dist/index.d.mts +66 -2
- package/dist/index.d.ts +66 -2
- package/dist/index.js +1142 -855
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1096 -804
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +29 -1
- package/dist/internal/index.d.ts +29 -1
- package/dist/internal/index.js +1173 -897
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1155 -874
- package/dist/internal/index.mjs.map +1 -1
- package/docs/03-openai.mdx +139 -0
- package/package.json +2 -2
- package/src/openai-tools.ts +12 -0
- package/src/responses/convert-to-openai-responses-input.ts +85 -4
- package/src/responses/openai-responses-api.ts +87 -1
- package/src/responses/openai-responses-language-model.ts +139 -0
- package/src/responses/openai-responses-prepare-tools.ts +26 -1
- package/src/tool/tool-search.ts +98 -0
package/dist/index.js
CHANGED
|
@@ -18,16 +18,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
VERSION: () => VERSION,
|
|
24
24
|
createOpenAI: () => createOpenAI,
|
|
25
25
|
openai: () => openai
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
29
|
// src/openai-provider.ts
|
|
30
|
-
var
|
|
30
|
+
var import_provider_utils35 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/chat/openai-chat-language-model.ts
|
|
33
33
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -2278,66 +2278,48 @@ var shell = (0, import_provider_utils20.createProviderToolFactoryWithOutputSchem
|
|
|
2278
2278
|
outputSchema: shellOutputSchema
|
|
2279
2279
|
});
|
|
2280
2280
|
|
|
2281
|
-
// src/tool/
|
|
2281
|
+
// src/tool/tool-search.ts
|
|
2282
2282
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2283
2283
|
var import_v416 = require("zod/v4");
|
|
2284
|
-
var
|
|
2284
|
+
var toolSearchArgsSchema = (0, import_provider_utils21.lazySchema)(
|
|
2285
2285
|
() => (0, import_provider_utils21.zodSchema)(
|
|
2286
2286
|
import_v416.z.object({
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
userLocation: import_v416.z.object({
|
|
2291
|
-
type: import_v416.z.literal("approximate"),
|
|
2292
|
-
country: import_v416.z.string().optional(),
|
|
2293
|
-
city: import_v416.z.string().optional(),
|
|
2294
|
-
region: import_v416.z.string().optional(),
|
|
2295
|
-
timezone: import_v416.z.string().optional()
|
|
2296
|
-
}).optional()
|
|
2287
|
+
execution: import_v416.z.enum(["server", "client"]).optional(),
|
|
2288
|
+
description: import_v416.z.string().optional(),
|
|
2289
|
+
parameters: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()).optional()
|
|
2297
2290
|
})
|
|
2298
2291
|
)
|
|
2299
2292
|
);
|
|
2300
|
-
var
|
|
2301
|
-
var webSearchOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2293
|
+
var toolSearchInputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2302
2294
|
() => (0, import_provider_utils21.zodSchema)(
|
|
2303
2295
|
import_v416.z.object({
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
type: import_v416.z.literal("search"),
|
|
2307
|
-
query: import_v416.z.string().optional()
|
|
2308
|
-
}),
|
|
2309
|
-
import_v416.z.object({
|
|
2310
|
-
type: import_v416.z.literal("openPage"),
|
|
2311
|
-
url: import_v416.z.string().nullish()
|
|
2312
|
-
}),
|
|
2313
|
-
import_v416.z.object({
|
|
2314
|
-
type: import_v416.z.literal("findInPage"),
|
|
2315
|
-
url: import_v416.z.string().nullish(),
|
|
2316
|
-
pattern: import_v416.z.string().nullish()
|
|
2317
|
-
})
|
|
2318
|
-
]).optional(),
|
|
2319
|
-
sources: import_v416.z.array(
|
|
2320
|
-
import_v416.z.discriminatedUnion("type", [
|
|
2321
|
-
import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
|
|
2322
|
-
import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
|
|
2323
|
-
])
|
|
2324
|
-
).optional()
|
|
2296
|
+
arguments: import_v416.z.unknown().optional(),
|
|
2297
|
+
call_id: import_v416.z.string().nullish()
|
|
2325
2298
|
})
|
|
2326
2299
|
)
|
|
2327
2300
|
);
|
|
2328
|
-
var
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2301
|
+
var toolSearchOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2302
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2303
|
+
import_v416.z.object({
|
|
2304
|
+
tools: import_v416.z.array(import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()))
|
|
2305
|
+
})
|
|
2306
|
+
)
|
|
2307
|
+
);
|
|
2308
|
+
var toolSearchToolFactory = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
2309
|
+
id: "openai.tool_search",
|
|
2310
|
+
inputSchema: toolSearchInputSchema,
|
|
2311
|
+
outputSchema: toolSearchOutputSchema
|
|
2332
2312
|
});
|
|
2333
|
-
var
|
|
2313
|
+
var toolSearch = (args = {}) => toolSearchToolFactory(args);
|
|
2334
2314
|
|
|
2335
|
-
// src/tool/web-search
|
|
2315
|
+
// src/tool/web-search.ts
|
|
2336
2316
|
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2337
2317
|
var import_v417 = require("zod/v4");
|
|
2338
|
-
var
|
|
2318
|
+
var webSearchArgsSchema = (0, import_provider_utils22.lazySchema)(
|
|
2339
2319
|
() => (0, import_provider_utils22.zodSchema)(
|
|
2340
2320
|
import_v417.z.object({
|
|
2321
|
+
externalWebAccess: import_v417.z.boolean().optional(),
|
|
2322
|
+
filters: import_v417.z.object({ allowedDomains: import_v417.z.array(import_v417.z.string()).optional() }).optional(),
|
|
2341
2323
|
searchContextSize: import_v417.z.enum(["low", "medium", "high"]).optional(),
|
|
2342
2324
|
userLocation: import_v417.z.object({
|
|
2343
2325
|
type: import_v417.z.literal("approximate"),
|
|
@@ -2349,10 +2331,8 @@ var webSearchPreviewArgsSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
2349
2331
|
})
|
|
2350
2332
|
)
|
|
2351
2333
|
);
|
|
2352
|
-
var
|
|
2353
|
-
|
|
2354
|
-
);
|
|
2355
|
-
var webSearchPreviewOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2334
|
+
var webSearchInputSchema = (0, import_provider_utils22.lazySchema)(() => (0, import_provider_utils22.zodSchema)(import_v417.z.object({})));
|
|
2335
|
+
var webSearchOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
2356
2336
|
() => (0, import_provider_utils22.zodSchema)(
|
|
2357
2337
|
import_v417.z.object({
|
|
2358
2338
|
action: import_v417.z.discriminatedUnion("type", [
|
|
@@ -2369,73 +2349,127 @@ var webSearchPreviewOutputSchema = (0, import_provider_utils22.lazySchema)(
|
|
|
2369
2349
|
url: import_v417.z.string().nullish(),
|
|
2370
2350
|
pattern: import_v417.z.string().nullish()
|
|
2371
2351
|
})
|
|
2352
|
+
]).optional(),
|
|
2353
|
+
sources: import_v417.z.array(
|
|
2354
|
+
import_v417.z.discriminatedUnion("type", [
|
|
2355
|
+
import_v417.z.object({ type: import_v417.z.literal("url"), url: import_v417.z.string() }),
|
|
2356
|
+
import_v417.z.object({ type: import_v417.z.literal("api"), name: import_v417.z.string() })
|
|
2357
|
+
])
|
|
2358
|
+
).optional()
|
|
2359
|
+
})
|
|
2360
|
+
)
|
|
2361
|
+
);
|
|
2362
|
+
var webSearchToolFactory = (0, import_provider_utils22.createProviderToolFactoryWithOutputSchema)({
|
|
2363
|
+
id: "openai.web_search",
|
|
2364
|
+
inputSchema: webSearchInputSchema,
|
|
2365
|
+
outputSchema: webSearchOutputSchema
|
|
2366
|
+
});
|
|
2367
|
+
var webSearch = (args = {}) => webSearchToolFactory(args);
|
|
2368
|
+
|
|
2369
|
+
// src/tool/web-search-preview.ts
|
|
2370
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2371
|
+
var import_v418 = require("zod/v4");
|
|
2372
|
+
var webSearchPreviewArgsSchema = (0, import_provider_utils23.lazySchema)(
|
|
2373
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2374
|
+
import_v418.z.object({
|
|
2375
|
+
searchContextSize: import_v418.z.enum(["low", "medium", "high"]).optional(),
|
|
2376
|
+
userLocation: import_v418.z.object({
|
|
2377
|
+
type: import_v418.z.literal("approximate"),
|
|
2378
|
+
country: import_v418.z.string().optional(),
|
|
2379
|
+
city: import_v418.z.string().optional(),
|
|
2380
|
+
region: import_v418.z.string().optional(),
|
|
2381
|
+
timezone: import_v418.z.string().optional()
|
|
2382
|
+
}).optional()
|
|
2383
|
+
})
|
|
2384
|
+
)
|
|
2385
|
+
);
|
|
2386
|
+
var webSearchPreviewInputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2387
|
+
() => (0, import_provider_utils23.zodSchema)(import_v418.z.object({}))
|
|
2388
|
+
);
|
|
2389
|
+
var webSearchPreviewOutputSchema = (0, import_provider_utils23.lazySchema)(
|
|
2390
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2391
|
+
import_v418.z.object({
|
|
2392
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
2393
|
+
import_v418.z.object({
|
|
2394
|
+
type: import_v418.z.literal("search"),
|
|
2395
|
+
query: import_v418.z.string().optional()
|
|
2396
|
+
}),
|
|
2397
|
+
import_v418.z.object({
|
|
2398
|
+
type: import_v418.z.literal("openPage"),
|
|
2399
|
+
url: import_v418.z.string().nullish()
|
|
2400
|
+
}),
|
|
2401
|
+
import_v418.z.object({
|
|
2402
|
+
type: import_v418.z.literal("findInPage"),
|
|
2403
|
+
url: import_v418.z.string().nullish(),
|
|
2404
|
+
pattern: import_v418.z.string().nullish()
|
|
2405
|
+
})
|
|
2372
2406
|
]).optional()
|
|
2373
2407
|
})
|
|
2374
2408
|
)
|
|
2375
2409
|
);
|
|
2376
|
-
var webSearchPreview = (0,
|
|
2410
|
+
var webSearchPreview = (0, import_provider_utils23.createProviderToolFactoryWithOutputSchema)({
|
|
2377
2411
|
id: "openai.web_search_preview",
|
|
2378
2412
|
inputSchema: webSearchPreviewInputSchema,
|
|
2379
2413
|
outputSchema: webSearchPreviewOutputSchema
|
|
2380
2414
|
});
|
|
2381
2415
|
|
|
2382
2416
|
// src/tool/mcp.ts
|
|
2383
|
-
var
|
|
2384
|
-
var
|
|
2385
|
-
var jsonValueSchema =
|
|
2386
|
-
() =>
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2417
|
+
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
2418
|
+
var import_v419 = require("zod/v4");
|
|
2419
|
+
var jsonValueSchema = import_v419.z.lazy(
|
|
2420
|
+
() => import_v419.z.union([
|
|
2421
|
+
import_v419.z.string(),
|
|
2422
|
+
import_v419.z.number(),
|
|
2423
|
+
import_v419.z.boolean(),
|
|
2424
|
+
import_v419.z.null(),
|
|
2425
|
+
import_v419.z.array(jsonValueSchema),
|
|
2426
|
+
import_v419.z.record(import_v419.z.string(), jsonValueSchema)
|
|
2393
2427
|
])
|
|
2394
2428
|
);
|
|
2395
|
-
var mcpArgsSchema = (0,
|
|
2396
|
-
() => (0,
|
|
2397
|
-
|
|
2398
|
-
serverLabel:
|
|
2399
|
-
allowedTools:
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
readOnly:
|
|
2403
|
-
toolNames:
|
|
2429
|
+
var mcpArgsSchema = (0, import_provider_utils24.lazySchema)(
|
|
2430
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2431
|
+
import_v419.z.object({
|
|
2432
|
+
serverLabel: import_v419.z.string(),
|
|
2433
|
+
allowedTools: import_v419.z.union([
|
|
2434
|
+
import_v419.z.array(import_v419.z.string()),
|
|
2435
|
+
import_v419.z.object({
|
|
2436
|
+
readOnly: import_v419.z.boolean().optional(),
|
|
2437
|
+
toolNames: import_v419.z.array(import_v419.z.string()).optional()
|
|
2404
2438
|
})
|
|
2405
2439
|
]).optional(),
|
|
2406
|
-
authorization:
|
|
2407
|
-
connectorId:
|
|
2408
|
-
headers:
|
|
2409
|
-
requireApproval:
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
never:
|
|
2413
|
-
toolNames:
|
|
2440
|
+
authorization: import_v419.z.string().optional(),
|
|
2441
|
+
connectorId: import_v419.z.string().optional(),
|
|
2442
|
+
headers: import_v419.z.record(import_v419.z.string(), import_v419.z.string()).optional(),
|
|
2443
|
+
requireApproval: import_v419.z.union([
|
|
2444
|
+
import_v419.z.enum(["always", "never"]),
|
|
2445
|
+
import_v419.z.object({
|
|
2446
|
+
never: import_v419.z.object({
|
|
2447
|
+
toolNames: import_v419.z.array(import_v419.z.string()).optional()
|
|
2414
2448
|
}).optional()
|
|
2415
2449
|
})
|
|
2416
2450
|
]).optional(),
|
|
2417
|
-
serverDescription:
|
|
2418
|
-
serverUrl:
|
|
2451
|
+
serverDescription: import_v419.z.string().optional(),
|
|
2452
|
+
serverUrl: import_v419.z.string().optional()
|
|
2419
2453
|
}).refine(
|
|
2420
2454
|
(v) => v.serverUrl != null || v.connectorId != null,
|
|
2421
2455
|
"One of serverUrl or connectorId must be provided."
|
|
2422
2456
|
)
|
|
2423
2457
|
)
|
|
2424
2458
|
);
|
|
2425
|
-
var mcpInputSchema = (0,
|
|
2426
|
-
var mcpOutputSchema = (0,
|
|
2427
|
-
() => (0,
|
|
2428
|
-
|
|
2429
|
-
type:
|
|
2430
|
-
serverLabel:
|
|
2431
|
-
name:
|
|
2432
|
-
arguments:
|
|
2433
|
-
output:
|
|
2434
|
-
error:
|
|
2459
|
+
var mcpInputSchema = (0, import_provider_utils24.lazySchema)(() => (0, import_provider_utils24.zodSchema)(import_v419.z.object({})));
|
|
2460
|
+
var mcpOutputSchema = (0, import_provider_utils24.lazySchema)(
|
|
2461
|
+
() => (0, import_provider_utils24.zodSchema)(
|
|
2462
|
+
import_v419.z.object({
|
|
2463
|
+
type: import_v419.z.literal("call"),
|
|
2464
|
+
serverLabel: import_v419.z.string(),
|
|
2465
|
+
name: import_v419.z.string(),
|
|
2466
|
+
arguments: import_v419.z.string(),
|
|
2467
|
+
output: import_v419.z.string().nullish(),
|
|
2468
|
+
error: import_v419.z.union([import_v419.z.string(), jsonValueSchema]).optional()
|
|
2435
2469
|
})
|
|
2436
2470
|
)
|
|
2437
2471
|
);
|
|
2438
|
-
var mcpToolFactory = (0,
|
|
2472
|
+
var mcpToolFactory = (0, import_provider_utils24.createProviderToolFactoryWithOutputSchema)({
|
|
2439
2473
|
id: "openai.mcp",
|
|
2440
2474
|
inputSchema: mcpInputSchema,
|
|
2441
2475
|
outputSchema: mcpOutputSchema
|
|
@@ -2547,12 +2581,22 @@ var openaiTools = {
|
|
|
2547
2581
|
* @param serverDescription - Optional description of the server.
|
|
2548
2582
|
* @param serverUrl - URL for the MCP server.
|
|
2549
2583
|
*/
|
|
2550
|
-
mcp
|
|
2584
|
+
mcp,
|
|
2585
|
+
/**
|
|
2586
|
+
* Tool search allows the model to dynamically search for and load deferred
|
|
2587
|
+
* tools into the model's context as needed. This helps reduce overall token
|
|
2588
|
+
* usage, cost, and latency by only loading tools when the model needs them.
|
|
2589
|
+
*
|
|
2590
|
+
* To use tool search, mark functions or namespaces with `defer_loading: true`
|
|
2591
|
+
* in the tools array. The model will use tool search to load these tools
|
|
2592
|
+
* when it determines they are needed.
|
|
2593
|
+
*/
|
|
2594
|
+
toolSearch
|
|
2551
2595
|
};
|
|
2552
2596
|
|
|
2553
2597
|
// src/responses/openai-responses-language-model.ts
|
|
2554
2598
|
var import_provider8 = require("@ai-sdk/provider");
|
|
2555
|
-
var
|
|
2599
|
+
var import_provider_utils29 = require("@ai-sdk/provider-utils");
|
|
2556
2600
|
|
|
2557
2601
|
// src/responses/convert-openai-responses-usage.ts
|
|
2558
2602
|
function convertOpenAIResponsesUsage(usage) {
|
|
@@ -2595,8 +2639,8 @@ function convertOpenAIResponsesUsage(usage) {
|
|
|
2595
2639
|
|
|
2596
2640
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2597
2641
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2598
|
-
var
|
|
2599
|
-
var
|
|
2642
|
+
var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
2643
|
+
var import_v420 = require("zod/v4");
|
|
2600
2644
|
function isFileId(data, prefixes) {
|
|
2601
2645
|
if (!prefixes) return false;
|
|
2602
2646
|
return prefixes.some((prefix) => data.startsWith(prefix));
|
|
@@ -2614,7 +2658,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2614
2658
|
hasApplyPatchTool = false,
|
|
2615
2659
|
customProviderToolNames
|
|
2616
2660
|
}) {
|
|
2617
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2661
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2618
2662
|
let input = [];
|
|
2619
2663
|
const warnings = [];
|
|
2620
2664
|
const processedApprovalIds = /* @__PURE__ */ new Set();
|
|
@@ -2661,7 +2705,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2661
2705
|
return {
|
|
2662
2706
|
type: "input_image",
|
|
2663
2707
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2664
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2708
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils25.convertToBase64)(part.data)}`
|
|
2665
2709
|
},
|
|
2666
2710
|
detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2[providerOptionsName]) == null ? void 0 : _b2.imageDetail
|
|
2667
2711
|
};
|
|
@@ -2676,7 +2720,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2676
2720
|
type: "input_file",
|
|
2677
2721
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2678
2722
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2679
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2723
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils25.convertToBase64)(part.data)}`
|
|
2680
2724
|
}
|
|
2681
2725
|
};
|
|
2682
2726
|
} else {
|
|
@@ -2718,6 +2762,32 @@ async function convertToOpenAIResponsesInput({
|
|
|
2718
2762
|
if (hasConversation && id != null) {
|
|
2719
2763
|
break;
|
|
2720
2764
|
}
|
|
2765
|
+
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2766
|
+
part.toolName
|
|
2767
|
+
);
|
|
2768
|
+
if (resolvedToolName === "tool_search") {
|
|
2769
|
+
if (store && id != null) {
|
|
2770
|
+
input.push({ type: "item_reference", id });
|
|
2771
|
+
break;
|
|
2772
|
+
}
|
|
2773
|
+
const parsedInput = typeof part.input === "string" ? await (0, import_provider_utils25.parseJSON)({
|
|
2774
|
+
text: part.input,
|
|
2775
|
+
schema: toolSearchInputSchema
|
|
2776
|
+
}) : await (0, import_provider_utils25.validateTypes)({
|
|
2777
|
+
value: part.input,
|
|
2778
|
+
schema: toolSearchInputSchema
|
|
2779
|
+
});
|
|
2780
|
+
const execution = parsedInput.call_id != null ? "client" : "server";
|
|
2781
|
+
input.push({
|
|
2782
|
+
type: "tool_search_call",
|
|
2783
|
+
id: id != null ? id : part.toolCallId,
|
|
2784
|
+
execution,
|
|
2785
|
+
call_id: (_g = parsedInput.call_id) != null ? _g : null,
|
|
2786
|
+
status: "completed",
|
|
2787
|
+
arguments: parsedInput.arguments
|
|
2788
|
+
});
|
|
2789
|
+
break;
|
|
2790
|
+
}
|
|
2721
2791
|
if (part.providerExecuted) {
|
|
2722
2792
|
if (store && id != null) {
|
|
2723
2793
|
input.push({ type: "item_reference", id });
|
|
@@ -2728,11 +2798,8 @@ async function convertToOpenAIResponsesInput({
|
|
|
2728
2798
|
input.push({ type: "item_reference", id });
|
|
2729
2799
|
break;
|
|
2730
2800
|
}
|
|
2731
|
-
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2732
|
-
part.toolName
|
|
2733
|
-
);
|
|
2734
2801
|
if (hasLocalShellTool && resolvedToolName === "local_shell") {
|
|
2735
|
-
const parsedInput = await (0,
|
|
2802
|
+
const parsedInput = await (0, import_provider_utils25.validateTypes)({
|
|
2736
2803
|
value: part.input,
|
|
2737
2804
|
schema: localShellInputSchema
|
|
2738
2805
|
});
|
|
@@ -2752,7 +2819,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2752
2819
|
break;
|
|
2753
2820
|
}
|
|
2754
2821
|
if (hasShellTool && resolvedToolName === "shell") {
|
|
2755
|
-
const parsedInput = await (0,
|
|
2822
|
+
const parsedInput = await (0, import_provider_utils25.validateTypes)({
|
|
2756
2823
|
value: part.input,
|
|
2757
2824
|
schema: shellInputSchema
|
|
2758
2825
|
});
|
|
@@ -2770,7 +2837,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2770
2837
|
break;
|
|
2771
2838
|
}
|
|
2772
2839
|
if (hasApplyPatchTool && resolvedToolName === "apply_patch") {
|
|
2773
|
-
const parsedInput = await (0,
|
|
2840
|
+
const parsedInput = await (0, import_provider_utils25.validateTypes)({
|
|
2774
2841
|
value: part.input,
|
|
2775
2842
|
schema: applyPatchInputSchema
|
|
2776
2843
|
});
|
|
@@ -2813,9 +2880,29 @@ async function convertToOpenAIResponsesInput({
|
|
|
2813
2880
|
const resolvedResultToolName = toolNameMapping.toProviderToolName(
|
|
2814
2881
|
part.toolName
|
|
2815
2882
|
);
|
|
2883
|
+
if (resolvedResultToolName === "tool_search") {
|
|
2884
|
+
const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
|
|
2885
|
+
if (store) {
|
|
2886
|
+
input.push({ type: "item_reference", id: itemId });
|
|
2887
|
+
} else if (part.output.type === "json") {
|
|
2888
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2889
|
+
value: part.output.value,
|
|
2890
|
+
schema: toolSearchOutputSchema
|
|
2891
|
+
});
|
|
2892
|
+
input.push({
|
|
2893
|
+
type: "tool_search_output",
|
|
2894
|
+
id: itemId,
|
|
2895
|
+
execution: "server",
|
|
2896
|
+
call_id: null,
|
|
2897
|
+
status: "completed",
|
|
2898
|
+
tools: parsedOutput.tools
|
|
2899
|
+
});
|
|
2900
|
+
}
|
|
2901
|
+
break;
|
|
2902
|
+
}
|
|
2816
2903
|
if (hasShellTool && resolvedResultToolName === "shell") {
|
|
2817
2904
|
if (part.output.type === "json") {
|
|
2818
|
-
const parsedOutput = await (0,
|
|
2905
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2819
2906
|
value: part.output.value,
|
|
2820
2907
|
schema: shellOutputSchema
|
|
2821
2908
|
});
|
|
@@ -2835,7 +2922,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2835
2922
|
break;
|
|
2836
2923
|
}
|
|
2837
2924
|
if (store) {
|
|
2838
|
-
const itemId = (
|
|
2925
|
+
const itemId = (_m = (_l = (_k = part.providerOptions) == null ? void 0 : _k[providerOptionsName]) == null ? void 0 : _l.itemId) != null ? _m : part.toolCallId;
|
|
2839
2926
|
input.push({ type: "item_reference", id: itemId });
|
|
2840
2927
|
} else {
|
|
2841
2928
|
warnings.push({
|
|
@@ -2846,7 +2933,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2846
2933
|
break;
|
|
2847
2934
|
}
|
|
2848
2935
|
case "reasoning": {
|
|
2849
|
-
const providerOptions = await (0,
|
|
2936
|
+
const providerOptions = await (0, import_provider_utils25.parseProviderOptions)({
|
|
2850
2937
|
provider: providerOptionsName,
|
|
2851
2938
|
providerOptions: part.providerOptions,
|
|
2852
2939
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2945,7 +3032,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2945
3032
|
}
|
|
2946
3033
|
const output = part.output;
|
|
2947
3034
|
if (output.type === "execution-denied") {
|
|
2948
|
-
const approvalId = (
|
|
3035
|
+
const approvalId = (_o = (_n = output.providerOptions) == null ? void 0 : _n.openai) == null ? void 0 : _o.approvalId;
|
|
2949
3036
|
if (approvalId) {
|
|
2950
3037
|
continue;
|
|
2951
3038
|
}
|
|
@@ -2953,8 +3040,22 @@ async function convertToOpenAIResponsesInput({
|
|
|
2953
3040
|
const resolvedToolName = toolNameMapping.toProviderToolName(
|
|
2954
3041
|
part.toolName
|
|
2955
3042
|
);
|
|
3043
|
+
if (resolvedToolName === "tool_search" && output.type === "json") {
|
|
3044
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
3045
|
+
value: output.value,
|
|
3046
|
+
schema: toolSearchOutputSchema
|
|
3047
|
+
});
|
|
3048
|
+
input.push({
|
|
3049
|
+
type: "tool_search_output",
|
|
3050
|
+
execution: "client",
|
|
3051
|
+
call_id: part.toolCallId,
|
|
3052
|
+
status: "completed",
|
|
3053
|
+
tools: parsedOutput.tools
|
|
3054
|
+
});
|
|
3055
|
+
continue;
|
|
3056
|
+
}
|
|
2956
3057
|
if (hasLocalShellTool && resolvedToolName === "local_shell" && output.type === "json") {
|
|
2957
|
-
const parsedOutput = await (0,
|
|
3058
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2958
3059
|
value: output.value,
|
|
2959
3060
|
schema: localShellOutputSchema
|
|
2960
3061
|
});
|
|
@@ -2966,7 +3067,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2966
3067
|
continue;
|
|
2967
3068
|
}
|
|
2968
3069
|
if (hasShellTool && resolvedToolName === "shell" && output.type === "json") {
|
|
2969
|
-
const parsedOutput = await (0,
|
|
3070
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2970
3071
|
value: output.value,
|
|
2971
3072
|
schema: shellOutputSchema
|
|
2972
3073
|
});
|
|
@@ -2985,7 +3086,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2985
3086
|
continue;
|
|
2986
3087
|
}
|
|
2987
3088
|
if (hasApplyPatchTool && part.toolName === "apply_patch" && output.type === "json") {
|
|
2988
|
-
const parsedOutput = await (0,
|
|
3089
|
+
const parsedOutput = await (0, import_provider_utils25.validateTypes)({
|
|
2989
3090
|
value: output.value,
|
|
2990
3091
|
schema: applyPatchOutputSchema
|
|
2991
3092
|
});
|
|
@@ -3005,7 +3106,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3005
3106
|
outputValue = output.value;
|
|
3006
3107
|
break;
|
|
3007
3108
|
case "execution-denied":
|
|
3008
|
-
outputValue = (
|
|
3109
|
+
outputValue = (_p = output.reason) != null ? _p : "Tool execution denied.";
|
|
3009
3110
|
break;
|
|
3010
3111
|
case "json":
|
|
3011
3112
|
case "error-json":
|
|
@@ -3040,7 +3141,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3040
3141
|
});
|
|
3041
3142
|
return void 0;
|
|
3042
3143
|
}
|
|
3043
|
-
}).filter(
|
|
3144
|
+
}).filter(import_provider_utils25.isNonNullable);
|
|
3044
3145
|
break;
|
|
3045
3146
|
default:
|
|
3046
3147
|
outputValue = "";
|
|
@@ -3059,7 +3160,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3059
3160
|
contentValue = output.value;
|
|
3060
3161
|
break;
|
|
3061
3162
|
case "execution-denied":
|
|
3062
|
-
contentValue = (
|
|
3163
|
+
contentValue = (_q = output.reason) != null ? _q : "Tool execution denied.";
|
|
3063
3164
|
break;
|
|
3064
3165
|
case "json":
|
|
3065
3166
|
case "error-json":
|
|
@@ -3099,7 +3200,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
3099
3200
|
return void 0;
|
|
3100
3201
|
}
|
|
3101
3202
|
}
|
|
3102
|
-
}).filter(
|
|
3203
|
+
}).filter(import_provider_utils25.isNonNullable);
|
|
3103
3204
|
break;
|
|
3104
3205
|
}
|
|
3105
3206
|
input.push({
|
|
@@ -3129,9 +3230,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
3129
3230
|
}
|
|
3130
3231
|
return { input, warnings };
|
|
3131
3232
|
}
|
|
3132
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
3133
|
-
itemId:
|
|
3134
|
-
reasoningEncryptedContent:
|
|
3233
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v420.z.object({
|
|
3234
|
+
itemId: import_v420.z.string().nullish(),
|
|
3235
|
+
reasoningEncryptedContent: import_v420.z.string().nullish()
|
|
3135
3236
|
});
|
|
3136
3237
|
|
|
3137
3238
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -3153,483 +3254,525 @@ function mapOpenAIResponseFinishReason({
|
|
|
3153
3254
|
}
|
|
3154
3255
|
|
|
3155
3256
|
// src/responses/openai-responses-api.ts
|
|
3156
|
-
var
|
|
3157
|
-
var
|
|
3158
|
-
var
|
|
3159
|
-
() =>
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3257
|
+
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
3258
|
+
var import_v421 = require("zod/v4");
|
|
3259
|
+
var jsonValueSchema2 = import_v421.z.lazy(
|
|
3260
|
+
() => import_v421.z.union([
|
|
3261
|
+
import_v421.z.string(),
|
|
3262
|
+
import_v421.z.number(),
|
|
3263
|
+
import_v421.z.boolean(),
|
|
3264
|
+
import_v421.z.null(),
|
|
3265
|
+
import_v421.z.array(jsonValueSchema2),
|
|
3266
|
+
import_v421.z.record(import_v421.z.string(), jsonValueSchema2.optional())
|
|
3267
|
+
])
|
|
3268
|
+
);
|
|
3269
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils26.lazySchema)(
|
|
3270
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3271
|
+
import_v421.z.union([
|
|
3272
|
+
import_v421.z.object({
|
|
3273
|
+
type: import_v421.z.literal("response.output_text.delta"),
|
|
3274
|
+
item_id: import_v421.z.string(),
|
|
3275
|
+
delta: import_v421.z.string(),
|
|
3276
|
+
logprobs: import_v421.z.array(
|
|
3277
|
+
import_v421.z.object({
|
|
3278
|
+
token: import_v421.z.string(),
|
|
3279
|
+
logprob: import_v421.z.number(),
|
|
3280
|
+
top_logprobs: import_v421.z.array(
|
|
3281
|
+
import_v421.z.object({
|
|
3282
|
+
token: import_v421.z.string(),
|
|
3283
|
+
logprob: import_v421.z.number()
|
|
3173
3284
|
})
|
|
3174
3285
|
)
|
|
3175
3286
|
})
|
|
3176
3287
|
).nullish()
|
|
3177
3288
|
}),
|
|
3178
|
-
|
|
3179
|
-
type:
|
|
3180
|
-
response:
|
|
3181
|
-
incomplete_details:
|
|
3182
|
-
usage:
|
|
3183
|
-
input_tokens:
|
|
3184
|
-
input_tokens_details:
|
|
3185
|
-
output_tokens:
|
|
3186
|
-
output_tokens_details:
|
|
3289
|
+
import_v421.z.object({
|
|
3290
|
+
type: import_v421.z.enum(["response.completed", "response.incomplete"]),
|
|
3291
|
+
response: import_v421.z.object({
|
|
3292
|
+
incomplete_details: import_v421.z.object({ reason: import_v421.z.string() }).nullish(),
|
|
3293
|
+
usage: import_v421.z.object({
|
|
3294
|
+
input_tokens: import_v421.z.number(),
|
|
3295
|
+
input_tokens_details: import_v421.z.object({ cached_tokens: import_v421.z.number().nullish() }).nullish(),
|
|
3296
|
+
output_tokens: import_v421.z.number(),
|
|
3297
|
+
output_tokens_details: import_v421.z.object({ reasoning_tokens: import_v421.z.number().nullish() }).nullish()
|
|
3187
3298
|
}),
|
|
3188
|
-
service_tier:
|
|
3299
|
+
service_tier: import_v421.z.string().nullish()
|
|
3189
3300
|
})
|
|
3190
3301
|
}),
|
|
3191
|
-
|
|
3192
|
-
type:
|
|
3193
|
-
response:
|
|
3194
|
-
id:
|
|
3195
|
-
created_at:
|
|
3196
|
-
model:
|
|
3197
|
-
service_tier:
|
|
3302
|
+
import_v421.z.object({
|
|
3303
|
+
type: import_v421.z.literal("response.created"),
|
|
3304
|
+
response: import_v421.z.object({
|
|
3305
|
+
id: import_v421.z.string(),
|
|
3306
|
+
created_at: import_v421.z.number(),
|
|
3307
|
+
model: import_v421.z.string(),
|
|
3308
|
+
service_tier: import_v421.z.string().nullish()
|
|
3198
3309
|
})
|
|
3199
3310
|
}),
|
|
3200
|
-
|
|
3201
|
-
type:
|
|
3202
|
-
output_index:
|
|
3203
|
-
item:
|
|
3204
|
-
|
|
3205
|
-
type:
|
|
3206
|
-
id:
|
|
3207
|
-
phase:
|
|
3311
|
+
import_v421.z.object({
|
|
3312
|
+
type: import_v421.z.literal("response.output_item.added"),
|
|
3313
|
+
output_index: import_v421.z.number(),
|
|
3314
|
+
item: import_v421.z.discriminatedUnion("type", [
|
|
3315
|
+
import_v421.z.object({
|
|
3316
|
+
type: import_v421.z.literal("message"),
|
|
3317
|
+
id: import_v421.z.string(),
|
|
3318
|
+
phase: import_v421.z.enum(["commentary", "final_answer"]).nullish()
|
|
3208
3319
|
}),
|
|
3209
|
-
|
|
3210
|
-
type:
|
|
3211
|
-
id:
|
|
3212
|
-
encrypted_content:
|
|
3320
|
+
import_v421.z.object({
|
|
3321
|
+
type: import_v421.z.literal("reasoning"),
|
|
3322
|
+
id: import_v421.z.string(),
|
|
3323
|
+
encrypted_content: import_v421.z.string().nullish()
|
|
3213
3324
|
}),
|
|
3214
|
-
|
|
3215
|
-
type:
|
|
3216
|
-
id:
|
|
3217
|
-
call_id:
|
|
3218
|
-
name:
|
|
3219
|
-
arguments:
|
|
3325
|
+
import_v421.z.object({
|
|
3326
|
+
type: import_v421.z.literal("function_call"),
|
|
3327
|
+
id: import_v421.z.string(),
|
|
3328
|
+
call_id: import_v421.z.string(),
|
|
3329
|
+
name: import_v421.z.string(),
|
|
3330
|
+
arguments: import_v421.z.string()
|
|
3220
3331
|
}),
|
|
3221
|
-
|
|
3222
|
-
type:
|
|
3223
|
-
id:
|
|
3224
|
-
status:
|
|
3332
|
+
import_v421.z.object({
|
|
3333
|
+
type: import_v421.z.literal("web_search_call"),
|
|
3334
|
+
id: import_v421.z.string(),
|
|
3335
|
+
status: import_v421.z.string()
|
|
3225
3336
|
}),
|
|
3226
|
-
|
|
3227
|
-
type:
|
|
3228
|
-
id:
|
|
3229
|
-
status:
|
|
3337
|
+
import_v421.z.object({
|
|
3338
|
+
type: import_v421.z.literal("computer_call"),
|
|
3339
|
+
id: import_v421.z.string(),
|
|
3340
|
+
status: import_v421.z.string()
|
|
3230
3341
|
}),
|
|
3231
|
-
|
|
3232
|
-
type:
|
|
3233
|
-
id:
|
|
3342
|
+
import_v421.z.object({
|
|
3343
|
+
type: import_v421.z.literal("file_search_call"),
|
|
3344
|
+
id: import_v421.z.string()
|
|
3234
3345
|
}),
|
|
3235
|
-
|
|
3236
|
-
type:
|
|
3237
|
-
id:
|
|
3346
|
+
import_v421.z.object({
|
|
3347
|
+
type: import_v421.z.literal("image_generation_call"),
|
|
3348
|
+
id: import_v421.z.string()
|
|
3238
3349
|
}),
|
|
3239
|
-
|
|
3240
|
-
type:
|
|
3241
|
-
id:
|
|
3242
|
-
container_id:
|
|
3243
|
-
code:
|
|
3244
|
-
outputs:
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3350
|
+
import_v421.z.object({
|
|
3351
|
+
type: import_v421.z.literal("code_interpreter_call"),
|
|
3352
|
+
id: import_v421.z.string(),
|
|
3353
|
+
container_id: import_v421.z.string(),
|
|
3354
|
+
code: import_v421.z.string().nullable(),
|
|
3355
|
+
outputs: import_v421.z.array(
|
|
3356
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3357
|
+
import_v421.z.object({ type: import_v421.z.literal("logs"), logs: import_v421.z.string() }),
|
|
3358
|
+
import_v421.z.object({ type: import_v421.z.literal("image"), url: import_v421.z.string() })
|
|
3248
3359
|
])
|
|
3249
3360
|
).nullable(),
|
|
3250
|
-
status:
|
|
3361
|
+
status: import_v421.z.string()
|
|
3251
3362
|
}),
|
|
3252
|
-
|
|
3253
|
-
type:
|
|
3254
|
-
id:
|
|
3255
|
-
status:
|
|
3256
|
-
approval_request_id:
|
|
3363
|
+
import_v421.z.object({
|
|
3364
|
+
type: import_v421.z.literal("mcp_call"),
|
|
3365
|
+
id: import_v421.z.string(),
|
|
3366
|
+
status: import_v421.z.string(),
|
|
3367
|
+
approval_request_id: import_v421.z.string().nullish()
|
|
3257
3368
|
}),
|
|
3258
|
-
|
|
3259
|
-
type:
|
|
3260
|
-
id:
|
|
3369
|
+
import_v421.z.object({
|
|
3370
|
+
type: import_v421.z.literal("mcp_list_tools"),
|
|
3371
|
+
id: import_v421.z.string()
|
|
3261
3372
|
}),
|
|
3262
|
-
|
|
3263
|
-
type:
|
|
3264
|
-
id:
|
|
3373
|
+
import_v421.z.object({
|
|
3374
|
+
type: import_v421.z.literal("mcp_approval_request"),
|
|
3375
|
+
id: import_v421.z.string()
|
|
3265
3376
|
}),
|
|
3266
|
-
|
|
3267
|
-
type:
|
|
3268
|
-
id:
|
|
3269
|
-
call_id:
|
|
3270
|
-
status:
|
|
3271
|
-
operation:
|
|
3272
|
-
|
|
3273
|
-
type:
|
|
3274
|
-
path:
|
|
3275
|
-
diff:
|
|
3377
|
+
import_v421.z.object({
|
|
3378
|
+
type: import_v421.z.literal("apply_patch_call"),
|
|
3379
|
+
id: import_v421.z.string(),
|
|
3380
|
+
call_id: import_v421.z.string(),
|
|
3381
|
+
status: import_v421.z.enum(["in_progress", "completed"]),
|
|
3382
|
+
operation: import_v421.z.discriminatedUnion("type", [
|
|
3383
|
+
import_v421.z.object({
|
|
3384
|
+
type: import_v421.z.literal("create_file"),
|
|
3385
|
+
path: import_v421.z.string(),
|
|
3386
|
+
diff: import_v421.z.string()
|
|
3276
3387
|
}),
|
|
3277
|
-
|
|
3278
|
-
type:
|
|
3279
|
-
path:
|
|
3388
|
+
import_v421.z.object({
|
|
3389
|
+
type: import_v421.z.literal("delete_file"),
|
|
3390
|
+
path: import_v421.z.string()
|
|
3280
3391
|
}),
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
path:
|
|
3284
|
-
diff:
|
|
3392
|
+
import_v421.z.object({
|
|
3393
|
+
type: import_v421.z.literal("update_file"),
|
|
3394
|
+
path: import_v421.z.string(),
|
|
3395
|
+
diff: import_v421.z.string()
|
|
3285
3396
|
})
|
|
3286
3397
|
])
|
|
3287
3398
|
}),
|
|
3288
|
-
|
|
3289
|
-
type:
|
|
3290
|
-
id:
|
|
3291
|
-
call_id:
|
|
3292
|
-
name:
|
|
3293
|
-
input:
|
|
3399
|
+
import_v421.z.object({
|
|
3400
|
+
type: import_v421.z.literal("custom_tool_call"),
|
|
3401
|
+
id: import_v421.z.string(),
|
|
3402
|
+
call_id: import_v421.z.string(),
|
|
3403
|
+
name: import_v421.z.string(),
|
|
3404
|
+
input: import_v421.z.string()
|
|
3294
3405
|
}),
|
|
3295
|
-
|
|
3296
|
-
type:
|
|
3297
|
-
id:
|
|
3298
|
-
call_id:
|
|
3299
|
-
status:
|
|
3300
|
-
action:
|
|
3301
|
-
commands:
|
|
3406
|
+
import_v421.z.object({
|
|
3407
|
+
type: import_v421.z.literal("shell_call"),
|
|
3408
|
+
id: import_v421.z.string(),
|
|
3409
|
+
call_id: import_v421.z.string(),
|
|
3410
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3411
|
+
action: import_v421.z.object({
|
|
3412
|
+
commands: import_v421.z.array(import_v421.z.string())
|
|
3302
3413
|
})
|
|
3303
3414
|
}),
|
|
3304
|
-
|
|
3305
|
-
type:
|
|
3306
|
-
id:
|
|
3307
|
-
call_id:
|
|
3308
|
-
status:
|
|
3309
|
-
output:
|
|
3310
|
-
|
|
3311
|
-
stdout:
|
|
3312
|
-
stderr:
|
|
3313
|
-
outcome:
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
type:
|
|
3317
|
-
exit_code:
|
|
3415
|
+
import_v421.z.object({
|
|
3416
|
+
type: import_v421.z.literal("shell_call_output"),
|
|
3417
|
+
id: import_v421.z.string(),
|
|
3418
|
+
call_id: import_v421.z.string(),
|
|
3419
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3420
|
+
output: import_v421.z.array(
|
|
3421
|
+
import_v421.z.object({
|
|
3422
|
+
stdout: import_v421.z.string(),
|
|
3423
|
+
stderr: import_v421.z.string(),
|
|
3424
|
+
outcome: import_v421.z.discriminatedUnion("type", [
|
|
3425
|
+
import_v421.z.object({ type: import_v421.z.literal("timeout") }),
|
|
3426
|
+
import_v421.z.object({
|
|
3427
|
+
type: import_v421.z.literal("exit"),
|
|
3428
|
+
exit_code: import_v421.z.number()
|
|
3318
3429
|
})
|
|
3319
3430
|
])
|
|
3320
3431
|
})
|
|
3321
3432
|
)
|
|
3433
|
+
}),
|
|
3434
|
+
import_v421.z.object({
|
|
3435
|
+
type: import_v421.z.literal("tool_search_call"),
|
|
3436
|
+
id: import_v421.z.string(),
|
|
3437
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
3438
|
+
call_id: import_v421.z.string().nullable(),
|
|
3439
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3440
|
+
arguments: import_v421.z.unknown()
|
|
3441
|
+
}),
|
|
3442
|
+
import_v421.z.object({
|
|
3443
|
+
type: import_v421.z.literal("tool_search_output"),
|
|
3444
|
+
id: import_v421.z.string(),
|
|
3445
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
3446
|
+
call_id: import_v421.z.string().nullable(),
|
|
3447
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3448
|
+
tools: import_v421.z.array(import_v421.z.record(import_v421.z.string(), jsonValueSchema2.optional()))
|
|
3322
3449
|
})
|
|
3323
3450
|
])
|
|
3324
3451
|
}),
|
|
3325
|
-
|
|
3326
|
-
type:
|
|
3327
|
-
output_index:
|
|
3328
|
-
item:
|
|
3329
|
-
|
|
3330
|
-
type:
|
|
3331
|
-
id:
|
|
3332
|
-
phase:
|
|
3452
|
+
import_v421.z.object({
|
|
3453
|
+
type: import_v421.z.literal("response.output_item.done"),
|
|
3454
|
+
output_index: import_v421.z.number(),
|
|
3455
|
+
item: import_v421.z.discriminatedUnion("type", [
|
|
3456
|
+
import_v421.z.object({
|
|
3457
|
+
type: import_v421.z.literal("message"),
|
|
3458
|
+
id: import_v421.z.string(),
|
|
3459
|
+
phase: import_v421.z.enum(["commentary", "final_answer"]).nullish()
|
|
3333
3460
|
}),
|
|
3334
|
-
|
|
3335
|
-
type:
|
|
3336
|
-
id:
|
|
3337
|
-
encrypted_content:
|
|
3461
|
+
import_v421.z.object({
|
|
3462
|
+
type: import_v421.z.literal("reasoning"),
|
|
3463
|
+
id: import_v421.z.string(),
|
|
3464
|
+
encrypted_content: import_v421.z.string().nullish()
|
|
3338
3465
|
}),
|
|
3339
|
-
|
|
3340
|
-
type:
|
|
3341
|
-
id:
|
|
3342
|
-
call_id:
|
|
3343
|
-
name:
|
|
3344
|
-
arguments:
|
|
3345
|
-
status:
|
|
3466
|
+
import_v421.z.object({
|
|
3467
|
+
type: import_v421.z.literal("function_call"),
|
|
3468
|
+
id: import_v421.z.string(),
|
|
3469
|
+
call_id: import_v421.z.string(),
|
|
3470
|
+
name: import_v421.z.string(),
|
|
3471
|
+
arguments: import_v421.z.string(),
|
|
3472
|
+
status: import_v421.z.literal("completed")
|
|
3346
3473
|
}),
|
|
3347
|
-
|
|
3348
|
-
type:
|
|
3349
|
-
id:
|
|
3350
|
-
call_id:
|
|
3351
|
-
name:
|
|
3352
|
-
input:
|
|
3353
|
-
status:
|
|
3474
|
+
import_v421.z.object({
|
|
3475
|
+
type: import_v421.z.literal("custom_tool_call"),
|
|
3476
|
+
id: import_v421.z.string(),
|
|
3477
|
+
call_id: import_v421.z.string(),
|
|
3478
|
+
name: import_v421.z.string(),
|
|
3479
|
+
input: import_v421.z.string(),
|
|
3480
|
+
status: import_v421.z.literal("completed")
|
|
3354
3481
|
}),
|
|
3355
|
-
|
|
3356
|
-
type:
|
|
3357
|
-
id:
|
|
3358
|
-
code:
|
|
3359
|
-
container_id:
|
|
3360
|
-
outputs:
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3482
|
+
import_v421.z.object({
|
|
3483
|
+
type: import_v421.z.literal("code_interpreter_call"),
|
|
3484
|
+
id: import_v421.z.string(),
|
|
3485
|
+
code: import_v421.z.string().nullable(),
|
|
3486
|
+
container_id: import_v421.z.string(),
|
|
3487
|
+
outputs: import_v421.z.array(
|
|
3488
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3489
|
+
import_v421.z.object({ type: import_v421.z.literal("logs"), logs: import_v421.z.string() }),
|
|
3490
|
+
import_v421.z.object({ type: import_v421.z.literal("image"), url: import_v421.z.string() })
|
|
3364
3491
|
])
|
|
3365
3492
|
).nullable()
|
|
3366
3493
|
}),
|
|
3367
|
-
|
|
3368
|
-
type:
|
|
3369
|
-
id:
|
|
3370
|
-
result:
|
|
3494
|
+
import_v421.z.object({
|
|
3495
|
+
type: import_v421.z.literal("image_generation_call"),
|
|
3496
|
+
id: import_v421.z.string(),
|
|
3497
|
+
result: import_v421.z.string()
|
|
3371
3498
|
}),
|
|
3372
|
-
|
|
3373
|
-
type:
|
|
3374
|
-
id:
|
|
3375
|
-
status:
|
|
3376
|
-
action:
|
|
3377
|
-
|
|
3378
|
-
type:
|
|
3379
|
-
query:
|
|
3380
|
-
sources:
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3499
|
+
import_v421.z.object({
|
|
3500
|
+
type: import_v421.z.literal("web_search_call"),
|
|
3501
|
+
id: import_v421.z.string(),
|
|
3502
|
+
status: import_v421.z.string(),
|
|
3503
|
+
action: import_v421.z.discriminatedUnion("type", [
|
|
3504
|
+
import_v421.z.object({
|
|
3505
|
+
type: import_v421.z.literal("search"),
|
|
3506
|
+
query: import_v421.z.string().nullish(),
|
|
3507
|
+
sources: import_v421.z.array(
|
|
3508
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3509
|
+
import_v421.z.object({ type: import_v421.z.literal("url"), url: import_v421.z.string() }),
|
|
3510
|
+
import_v421.z.object({ type: import_v421.z.literal("api"), name: import_v421.z.string() })
|
|
3384
3511
|
])
|
|
3385
3512
|
).nullish()
|
|
3386
3513
|
}),
|
|
3387
|
-
|
|
3388
|
-
type:
|
|
3389
|
-
url:
|
|
3514
|
+
import_v421.z.object({
|
|
3515
|
+
type: import_v421.z.literal("open_page"),
|
|
3516
|
+
url: import_v421.z.string().nullish()
|
|
3390
3517
|
}),
|
|
3391
|
-
|
|
3392
|
-
type:
|
|
3393
|
-
url:
|
|
3394
|
-
pattern:
|
|
3518
|
+
import_v421.z.object({
|
|
3519
|
+
type: import_v421.z.literal("find_in_page"),
|
|
3520
|
+
url: import_v421.z.string().nullish(),
|
|
3521
|
+
pattern: import_v421.z.string().nullish()
|
|
3395
3522
|
})
|
|
3396
3523
|
]).nullish()
|
|
3397
3524
|
}),
|
|
3398
|
-
|
|
3399
|
-
type:
|
|
3400
|
-
id:
|
|
3401
|
-
queries:
|
|
3402
|
-
results:
|
|
3403
|
-
|
|
3404
|
-
attributes:
|
|
3405
|
-
|
|
3406
|
-
|
|
3525
|
+
import_v421.z.object({
|
|
3526
|
+
type: import_v421.z.literal("file_search_call"),
|
|
3527
|
+
id: import_v421.z.string(),
|
|
3528
|
+
queries: import_v421.z.array(import_v421.z.string()),
|
|
3529
|
+
results: import_v421.z.array(
|
|
3530
|
+
import_v421.z.object({
|
|
3531
|
+
attributes: import_v421.z.record(
|
|
3532
|
+
import_v421.z.string(),
|
|
3533
|
+
import_v421.z.union([import_v421.z.string(), import_v421.z.number(), import_v421.z.boolean()])
|
|
3407
3534
|
),
|
|
3408
|
-
file_id:
|
|
3409
|
-
filename:
|
|
3410
|
-
score:
|
|
3411
|
-
text:
|
|
3535
|
+
file_id: import_v421.z.string(),
|
|
3536
|
+
filename: import_v421.z.string(),
|
|
3537
|
+
score: import_v421.z.number(),
|
|
3538
|
+
text: import_v421.z.string()
|
|
3412
3539
|
})
|
|
3413
3540
|
).nullish()
|
|
3414
3541
|
}),
|
|
3415
|
-
|
|
3416
|
-
type:
|
|
3417
|
-
id:
|
|
3418
|
-
call_id:
|
|
3419
|
-
action:
|
|
3420
|
-
type:
|
|
3421
|
-
command:
|
|
3422
|
-
timeout_ms:
|
|
3423
|
-
user:
|
|
3424
|
-
working_directory:
|
|
3425
|
-
env:
|
|
3542
|
+
import_v421.z.object({
|
|
3543
|
+
type: import_v421.z.literal("local_shell_call"),
|
|
3544
|
+
id: import_v421.z.string(),
|
|
3545
|
+
call_id: import_v421.z.string(),
|
|
3546
|
+
action: import_v421.z.object({
|
|
3547
|
+
type: import_v421.z.literal("exec"),
|
|
3548
|
+
command: import_v421.z.array(import_v421.z.string()),
|
|
3549
|
+
timeout_ms: import_v421.z.number().optional(),
|
|
3550
|
+
user: import_v421.z.string().optional(),
|
|
3551
|
+
working_directory: import_v421.z.string().optional(),
|
|
3552
|
+
env: import_v421.z.record(import_v421.z.string(), import_v421.z.string()).optional()
|
|
3426
3553
|
})
|
|
3427
3554
|
}),
|
|
3428
|
-
|
|
3429
|
-
type:
|
|
3430
|
-
id:
|
|
3431
|
-
status:
|
|
3555
|
+
import_v421.z.object({
|
|
3556
|
+
type: import_v421.z.literal("computer_call"),
|
|
3557
|
+
id: import_v421.z.string(),
|
|
3558
|
+
status: import_v421.z.literal("completed")
|
|
3432
3559
|
}),
|
|
3433
|
-
|
|
3434
|
-
type:
|
|
3435
|
-
id:
|
|
3436
|
-
status:
|
|
3437
|
-
arguments:
|
|
3438
|
-
name:
|
|
3439
|
-
server_label:
|
|
3440
|
-
output:
|
|
3441
|
-
error:
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
type:
|
|
3445
|
-
code:
|
|
3446
|
-
message:
|
|
3560
|
+
import_v421.z.object({
|
|
3561
|
+
type: import_v421.z.literal("mcp_call"),
|
|
3562
|
+
id: import_v421.z.string(),
|
|
3563
|
+
status: import_v421.z.string(),
|
|
3564
|
+
arguments: import_v421.z.string(),
|
|
3565
|
+
name: import_v421.z.string(),
|
|
3566
|
+
server_label: import_v421.z.string(),
|
|
3567
|
+
output: import_v421.z.string().nullish(),
|
|
3568
|
+
error: import_v421.z.union([
|
|
3569
|
+
import_v421.z.string(),
|
|
3570
|
+
import_v421.z.object({
|
|
3571
|
+
type: import_v421.z.string().optional(),
|
|
3572
|
+
code: import_v421.z.union([import_v421.z.number(), import_v421.z.string()]).optional(),
|
|
3573
|
+
message: import_v421.z.string().optional()
|
|
3447
3574
|
}).loose()
|
|
3448
3575
|
]).nullish(),
|
|
3449
|
-
approval_request_id:
|
|
3576
|
+
approval_request_id: import_v421.z.string().nullish()
|
|
3450
3577
|
}),
|
|
3451
|
-
|
|
3452
|
-
type:
|
|
3453
|
-
id:
|
|
3454
|
-
server_label:
|
|
3455
|
-
tools:
|
|
3456
|
-
|
|
3457
|
-
name:
|
|
3458
|
-
description:
|
|
3459
|
-
input_schema:
|
|
3460
|
-
annotations:
|
|
3578
|
+
import_v421.z.object({
|
|
3579
|
+
type: import_v421.z.literal("mcp_list_tools"),
|
|
3580
|
+
id: import_v421.z.string(),
|
|
3581
|
+
server_label: import_v421.z.string(),
|
|
3582
|
+
tools: import_v421.z.array(
|
|
3583
|
+
import_v421.z.object({
|
|
3584
|
+
name: import_v421.z.string(),
|
|
3585
|
+
description: import_v421.z.string().optional(),
|
|
3586
|
+
input_schema: import_v421.z.any(),
|
|
3587
|
+
annotations: import_v421.z.record(import_v421.z.string(), import_v421.z.unknown()).optional()
|
|
3461
3588
|
})
|
|
3462
3589
|
),
|
|
3463
|
-
error:
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
type:
|
|
3467
|
-
code:
|
|
3468
|
-
message:
|
|
3590
|
+
error: import_v421.z.union([
|
|
3591
|
+
import_v421.z.string(),
|
|
3592
|
+
import_v421.z.object({
|
|
3593
|
+
type: import_v421.z.string().optional(),
|
|
3594
|
+
code: import_v421.z.union([import_v421.z.number(), import_v421.z.string()]).optional(),
|
|
3595
|
+
message: import_v421.z.string().optional()
|
|
3469
3596
|
}).loose()
|
|
3470
3597
|
]).optional()
|
|
3471
3598
|
}),
|
|
3472
|
-
|
|
3473
|
-
type:
|
|
3474
|
-
id:
|
|
3475
|
-
server_label:
|
|
3476
|
-
name:
|
|
3477
|
-
arguments:
|
|
3478
|
-
approval_request_id:
|
|
3599
|
+
import_v421.z.object({
|
|
3600
|
+
type: import_v421.z.literal("mcp_approval_request"),
|
|
3601
|
+
id: import_v421.z.string(),
|
|
3602
|
+
server_label: import_v421.z.string(),
|
|
3603
|
+
name: import_v421.z.string(),
|
|
3604
|
+
arguments: import_v421.z.string(),
|
|
3605
|
+
approval_request_id: import_v421.z.string().optional()
|
|
3479
3606
|
}),
|
|
3480
|
-
|
|
3481
|
-
type:
|
|
3482
|
-
id:
|
|
3483
|
-
call_id:
|
|
3484
|
-
status:
|
|
3485
|
-
operation:
|
|
3486
|
-
|
|
3487
|
-
type:
|
|
3488
|
-
path:
|
|
3489
|
-
diff:
|
|
3607
|
+
import_v421.z.object({
|
|
3608
|
+
type: import_v421.z.literal("apply_patch_call"),
|
|
3609
|
+
id: import_v421.z.string(),
|
|
3610
|
+
call_id: import_v421.z.string(),
|
|
3611
|
+
status: import_v421.z.enum(["in_progress", "completed"]),
|
|
3612
|
+
operation: import_v421.z.discriminatedUnion("type", [
|
|
3613
|
+
import_v421.z.object({
|
|
3614
|
+
type: import_v421.z.literal("create_file"),
|
|
3615
|
+
path: import_v421.z.string(),
|
|
3616
|
+
diff: import_v421.z.string()
|
|
3490
3617
|
}),
|
|
3491
|
-
|
|
3492
|
-
type:
|
|
3493
|
-
path:
|
|
3618
|
+
import_v421.z.object({
|
|
3619
|
+
type: import_v421.z.literal("delete_file"),
|
|
3620
|
+
path: import_v421.z.string()
|
|
3494
3621
|
}),
|
|
3495
|
-
|
|
3496
|
-
type:
|
|
3497
|
-
path:
|
|
3498
|
-
diff:
|
|
3622
|
+
import_v421.z.object({
|
|
3623
|
+
type: import_v421.z.literal("update_file"),
|
|
3624
|
+
path: import_v421.z.string(),
|
|
3625
|
+
diff: import_v421.z.string()
|
|
3499
3626
|
})
|
|
3500
3627
|
])
|
|
3501
3628
|
}),
|
|
3502
|
-
|
|
3503
|
-
type:
|
|
3504
|
-
id:
|
|
3505
|
-
call_id:
|
|
3506
|
-
status:
|
|
3507
|
-
action:
|
|
3508
|
-
commands:
|
|
3629
|
+
import_v421.z.object({
|
|
3630
|
+
type: import_v421.z.literal("shell_call"),
|
|
3631
|
+
id: import_v421.z.string(),
|
|
3632
|
+
call_id: import_v421.z.string(),
|
|
3633
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3634
|
+
action: import_v421.z.object({
|
|
3635
|
+
commands: import_v421.z.array(import_v421.z.string())
|
|
3509
3636
|
})
|
|
3510
3637
|
}),
|
|
3511
|
-
|
|
3512
|
-
type:
|
|
3513
|
-
id:
|
|
3514
|
-
call_id:
|
|
3515
|
-
status:
|
|
3516
|
-
output:
|
|
3517
|
-
|
|
3518
|
-
stdout:
|
|
3519
|
-
stderr:
|
|
3520
|
-
outcome:
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
type:
|
|
3524
|
-
exit_code:
|
|
3638
|
+
import_v421.z.object({
|
|
3639
|
+
type: import_v421.z.literal("shell_call_output"),
|
|
3640
|
+
id: import_v421.z.string(),
|
|
3641
|
+
call_id: import_v421.z.string(),
|
|
3642
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3643
|
+
output: import_v421.z.array(
|
|
3644
|
+
import_v421.z.object({
|
|
3645
|
+
stdout: import_v421.z.string(),
|
|
3646
|
+
stderr: import_v421.z.string(),
|
|
3647
|
+
outcome: import_v421.z.discriminatedUnion("type", [
|
|
3648
|
+
import_v421.z.object({ type: import_v421.z.literal("timeout") }),
|
|
3649
|
+
import_v421.z.object({
|
|
3650
|
+
type: import_v421.z.literal("exit"),
|
|
3651
|
+
exit_code: import_v421.z.number()
|
|
3525
3652
|
})
|
|
3526
3653
|
])
|
|
3527
3654
|
})
|
|
3528
3655
|
)
|
|
3656
|
+
}),
|
|
3657
|
+
import_v421.z.object({
|
|
3658
|
+
type: import_v421.z.literal("tool_search_call"),
|
|
3659
|
+
id: import_v421.z.string(),
|
|
3660
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
3661
|
+
call_id: import_v421.z.string().nullable(),
|
|
3662
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3663
|
+
arguments: import_v421.z.unknown()
|
|
3664
|
+
}),
|
|
3665
|
+
import_v421.z.object({
|
|
3666
|
+
type: import_v421.z.literal("tool_search_output"),
|
|
3667
|
+
id: import_v421.z.string(),
|
|
3668
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
3669
|
+
call_id: import_v421.z.string().nullable(),
|
|
3670
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
3671
|
+
tools: import_v421.z.array(import_v421.z.record(import_v421.z.string(), jsonValueSchema2.optional()))
|
|
3529
3672
|
})
|
|
3530
3673
|
])
|
|
3531
3674
|
}),
|
|
3532
|
-
|
|
3533
|
-
type:
|
|
3534
|
-
item_id:
|
|
3535
|
-
output_index:
|
|
3536
|
-
delta:
|
|
3675
|
+
import_v421.z.object({
|
|
3676
|
+
type: import_v421.z.literal("response.function_call_arguments.delta"),
|
|
3677
|
+
item_id: import_v421.z.string(),
|
|
3678
|
+
output_index: import_v421.z.number(),
|
|
3679
|
+
delta: import_v421.z.string()
|
|
3537
3680
|
}),
|
|
3538
|
-
|
|
3539
|
-
type:
|
|
3540
|
-
item_id:
|
|
3541
|
-
output_index:
|
|
3542
|
-
delta:
|
|
3681
|
+
import_v421.z.object({
|
|
3682
|
+
type: import_v421.z.literal("response.custom_tool_call_input.delta"),
|
|
3683
|
+
item_id: import_v421.z.string(),
|
|
3684
|
+
output_index: import_v421.z.number(),
|
|
3685
|
+
delta: import_v421.z.string()
|
|
3543
3686
|
}),
|
|
3544
|
-
|
|
3545
|
-
type:
|
|
3546
|
-
item_id:
|
|
3547
|
-
output_index:
|
|
3548
|
-
partial_image_b64:
|
|
3687
|
+
import_v421.z.object({
|
|
3688
|
+
type: import_v421.z.literal("response.image_generation_call.partial_image"),
|
|
3689
|
+
item_id: import_v421.z.string(),
|
|
3690
|
+
output_index: import_v421.z.number(),
|
|
3691
|
+
partial_image_b64: import_v421.z.string()
|
|
3549
3692
|
}),
|
|
3550
|
-
|
|
3551
|
-
type:
|
|
3552
|
-
item_id:
|
|
3553
|
-
output_index:
|
|
3554
|
-
delta:
|
|
3693
|
+
import_v421.z.object({
|
|
3694
|
+
type: import_v421.z.literal("response.code_interpreter_call_code.delta"),
|
|
3695
|
+
item_id: import_v421.z.string(),
|
|
3696
|
+
output_index: import_v421.z.number(),
|
|
3697
|
+
delta: import_v421.z.string()
|
|
3555
3698
|
}),
|
|
3556
|
-
|
|
3557
|
-
type:
|
|
3558
|
-
item_id:
|
|
3559
|
-
output_index:
|
|
3560
|
-
code:
|
|
3699
|
+
import_v421.z.object({
|
|
3700
|
+
type: import_v421.z.literal("response.code_interpreter_call_code.done"),
|
|
3701
|
+
item_id: import_v421.z.string(),
|
|
3702
|
+
output_index: import_v421.z.number(),
|
|
3703
|
+
code: import_v421.z.string()
|
|
3561
3704
|
}),
|
|
3562
|
-
|
|
3563
|
-
type:
|
|
3564
|
-
annotation:
|
|
3565
|
-
|
|
3566
|
-
type:
|
|
3567
|
-
start_index:
|
|
3568
|
-
end_index:
|
|
3569
|
-
url:
|
|
3570
|
-
title:
|
|
3705
|
+
import_v421.z.object({
|
|
3706
|
+
type: import_v421.z.literal("response.output_text.annotation.added"),
|
|
3707
|
+
annotation: import_v421.z.discriminatedUnion("type", [
|
|
3708
|
+
import_v421.z.object({
|
|
3709
|
+
type: import_v421.z.literal("url_citation"),
|
|
3710
|
+
start_index: import_v421.z.number(),
|
|
3711
|
+
end_index: import_v421.z.number(),
|
|
3712
|
+
url: import_v421.z.string(),
|
|
3713
|
+
title: import_v421.z.string()
|
|
3571
3714
|
}),
|
|
3572
|
-
|
|
3573
|
-
type:
|
|
3574
|
-
file_id:
|
|
3575
|
-
filename:
|
|
3576
|
-
index:
|
|
3715
|
+
import_v421.z.object({
|
|
3716
|
+
type: import_v421.z.literal("file_citation"),
|
|
3717
|
+
file_id: import_v421.z.string(),
|
|
3718
|
+
filename: import_v421.z.string(),
|
|
3719
|
+
index: import_v421.z.number()
|
|
3577
3720
|
}),
|
|
3578
|
-
|
|
3579
|
-
type:
|
|
3580
|
-
container_id:
|
|
3581
|
-
file_id:
|
|
3582
|
-
filename:
|
|
3583
|
-
start_index:
|
|
3584
|
-
end_index:
|
|
3721
|
+
import_v421.z.object({
|
|
3722
|
+
type: import_v421.z.literal("container_file_citation"),
|
|
3723
|
+
container_id: import_v421.z.string(),
|
|
3724
|
+
file_id: import_v421.z.string(),
|
|
3725
|
+
filename: import_v421.z.string(),
|
|
3726
|
+
start_index: import_v421.z.number(),
|
|
3727
|
+
end_index: import_v421.z.number()
|
|
3585
3728
|
}),
|
|
3586
|
-
|
|
3587
|
-
type:
|
|
3588
|
-
file_id:
|
|
3589
|
-
index:
|
|
3729
|
+
import_v421.z.object({
|
|
3730
|
+
type: import_v421.z.literal("file_path"),
|
|
3731
|
+
file_id: import_v421.z.string(),
|
|
3732
|
+
index: import_v421.z.number()
|
|
3590
3733
|
})
|
|
3591
3734
|
])
|
|
3592
3735
|
}),
|
|
3593
|
-
|
|
3594
|
-
type:
|
|
3595
|
-
item_id:
|
|
3596
|
-
summary_index:
|
|
3736
|
+
import_v421.z.object({
|
|
3737
|
+
type: import_v421.z.literal("response.reasoning_summary_part.added"),
|
|
3738
|
+
item_id: import_v421.z.string(),
|
|
3739
|
+
summary_index: import_v421.z.number()
|
|
3597
3740
|
}),
|
|
3598
|
-
|
|
3599
|
-
type:
|
|
3600
|
-
item_id:
|
|
3601
|
-
summary_index:
|
|
3602
|
-
delta:
|
|
3741
|
+
import_v421.z.object({
|
|
3742
|
+
type: import_v421.z.literal("response.reasoning_summary_text.delta"),
|
|
3743
|
+
item_id: import_v421.z.string(),
|
|
3744
|
+
summary_index: import_v421.z.number(),
|
|
3745
|
+
delta: import_v421.z.string()
|
|
3603
3746
|
}),
|
|
3604
|
-
|
|
3605
|
-
type:
|
|
3606
|
-
item_id:
|
|
3607
|
-
summary_index:
|
|
3747
|
+
import_v421.z.object({
|
|
3748
|
+
type: import_v421.z.literal("response.reasoning_summary_part.done"),
|
|
3749
|
+
item_id: import_v421.z.string(),
|
|
3750
|
+
summary_index: import_v421.z.number()
|
|
3608
3751
|
}),
|
|
3609
|
-
|
|
3610
|
-
type:
|
|
3611
|
-
item_id:
|
|
3612
|
-
output_index:
|
|
3613
|
-
delta:
|
|
3614
|
-
obfuscation:
|
|
3752
|
+
import_v421.z.object({
|
|
3753
|
+
type: import_v421.z.literal("response.apply_patch_call_operation_diff.delta"),
|
|
3754
|
+
item_id: import_v421.z.string(),
|
|
3755
|
+
output_index: import_v421.z.number(),
|
|
3756
|
+
delta: import_v421.z.string(),
|
|
3757
|
+
obfuscation: import_v421.z.string().nullish()
|
|
3615
3758
|
}),
|
|
3616
|
-
|
|
3617
|
-
type:
|
|
3618
|
-
item_id:
|
|
3619
|
-
output_index:
|
|
3620
|
-
diff:
|
|
3759
|
+
import_v421.z.object({
|
|
3760
|
+
type: import_v421.z.literal("response.apply_patch_call_operation_diff.done"),
|
|
3761
|
+
item_id: import_v421.z.string(),
|
|
3762
|
+
output_index: import_v421.z.number(),
|
|
3763
|
+
diff: import_v421.z.string()
|
|
3621
3764
|
}),
|
|
3622
|
-
|
|
3623
|
-
type:
|
|
3624
|
-
sequence_number:
|
|
3625
|
-
error:
|
|
3626
|
-
type:
|
|
3627
|
-
code:
|
|
3628
|
-
message:
|
|
3629
|
-
param:
|
|
3765
|
+
import_v421.z.object({
|
|
3766
|
+
type: import_v421.z.literal("error"),
|
|
3767
|
+
sequence_number: import_v421.z.number(),
|
|
3768
|
+
error: import_v421.z.object({
|
|
3769
|
+
type: import_v421.z.string(),
|
|
3770
|
+
code: import_v421.z.string(),
|
|
3771
|
+
message: import_v421.z.string(),
|
|
3772
|
+
param: import_v421.z.string().nullish()
|
|
3630
3773
|
})
|
|
3631
3774
|
}),
|
|
3632
|
-
|
|
3775
|
+
import_v421.z.object({ type: import_v421.z.string() }).loose().transform((value) => ({
|
|
3633
3776
|
type: "unknown_chunk",
|
|
3634
3777
|
message: value.type
|
|
3635
3778
|
}))
|
|
@@ -3637,294 +3780,310 @@ var openaiResponsesChunkSchema = (0, import_provider_utils25.lazySchema)(
|
|
|
3637
3780
|
])
|
|
3638
3781
|
)
|
|
3639
3782
|
);
|
|
3640
|
-
var openaiResponsesResponseSchema = (0,
|
|
3641
|
-
() => (0,
|
|
3642
|
-
|
|
3643
|
-
id:
|
|
3644
|
-
created_at:
|
|
3645
|
-
error:
|
|
3646
|
-
message:
|
|
3647
|
-
type:
|
|
3648
|
-
param:
|
|
3649
|
-
code:
|
|
3783
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils26.lazySchema)(
|
|
3784
|
+
() => (0, import_provider_utils26.zodSchema)(
|
|
3785
|
+
import_v421.z.object({
|
|
3786
|
+
id: import_v421.z.string().optional(),
|
|
3787
|
+
created_at: import_v421.z.number().optional(),
|
|
3788
|
+
error: import_v421.z.object({
|
|
3789
|
+
message: import_v421.z.string(),
|
|
3790
|
+
type: import_v421.z.string(),
|
|
3791
|
+
param: import_v421.z.string().nullish(),
|
|
3792
|
+
code: import_v421.z.string()
|
|
3650
3793
|
}).nullish(),
|
|
3651
|
-
model:
|
|
3652
|
-
output:
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
type:
|
|
3656
|
-
role:
|
|
3657
|
-
id:
|
|
3658
|
-
phase:
|
|
3659
|
-
content:
|
|
3660
|
-
|
|
3661
|
-
type:
|
|
3662
|
-
text:
|
|
3663
|
-
logprobs:
|
|
3664
|
-
|
|
3665
|
-
token:
|
|
3666
|
-
logprob:
|
|
3667
|
-
top_logprobs:
|
|
3668
|
-
|
|
3669
|
-
token:
|
|
3670
|
-
logprob:
|
|
3794
|
+
model: import_v421.z.string().optional(),
|
|
3795
|
+
output: import_v421.z.array(
|
|
3796
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3797
|
+
import_v421.z.object({
|
|
3798
|
+
type: import_v421.z.literal("message"),
|
|
3799
|
+
role: import_v421.z.literal("assistant"),
|
|
3800
|
+
id: import_v421.z.string(),
|
|
3801
|
+
phase: import_v421.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3802
|
+
content: import_v421.z.array(
|
|
3803
|
+
import_v421.z.object({
|
|
3804
|
+
type: import_v421.z.literal("output_text"),
|
|
3805
|
+
text: import_v421.z.string(),
|
|
3806
|
+
logprobs: import_v421.z.array(
|
|
3807
|
+
import_v421.z.object({
|
|
3808
|
+
token: import_v421.z.string(),
|
|
3809
|
+
logprob: import_v421.z.number(),
|
|
3810
|
+
top_logprobs: import_v421.z.array(
|
|
3811
|
+
import_v421.z.object({
|
|
3812
|
+
token: import_v421.z.string(),
|
|
3813
|
+
logprob: import_v421.z.number()
|
|
3671
3814
|
})
|
|
3672
3815
|
)
|
|
3673
3816
|
})
|
|
3674
3817
|
).nullish(),
|
|
3675
|
-
annotations:
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
type:
|
|
3679
|
-
start_index:
|
|
3680
|
-
end_index:
|
|
3681
|
-
url:
|
|
3682
|
-
title:
|
|
3818
|
+
annotations: import_v421.z.array(
|
|
3819
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3820
|
+
import_v421.z.object({
|
|
3821
|
+
type: import_v421.z.literal("url_citation"),
|
|
3822
|
+
start_index: import_v421.z.number(),
|
|
3823
|
+
end_index: import_v421.z.number(),
|
|
3824
|
+
url: import_v421.z.string(),
|
|
3825
|
+
title: import_v421.z.string()
|
|
3683
3826
|
}),
|
|
3684
|
-
|
|
3685
|
-
type:
|
|
3686
|
-
file_id:
|
|
3687
|
-
filename:
|
|
3688
|
-
index:
|
|
3827
|
+
import_v421.z.object({
|
|
3828
|
+
type: import_v421.z.literal("file_citation"),
|
|
3829
|
+
file_id: import_v421.z.string(),
|
|
3830
|
+
filename: import_v421.z.string(),
|
|
3831
|
+
index: import_v421.z.number()
|
|
3689
3832
|
}),
|
|
3690
|
-
|
|
3691
|
-
type:
|
|
3692
|
-
container_id:
|
|
3693
|
-
file_id:
|
|
3694
|
-
filename:
|
|
3695
|
-
start_index:
|
|
3696
|
-
end_index:
|
|
3833
|
+
import_v421.z.object({
|
|
3834
|
+
type: import_v421.z.literal("container_file_citation"),
|
|
3835
|
+
container_id: import_v421.z.string(),
|
|
3836
|
+
file_id: import_v421.z.string(),
|
|
3837
|
+
filename: import_v421.z.string(),
|
|
3838
|
+
start_index: import_v421.z.number(),
|
|
3839
|
+
end_index: import_v421.z.number()
|
|
3697
3840
|
}),
|
|
3698
|
-
|
|
3699
|
-
type:
|
|
3700
|
-
file_id:
|
|
3701
|
-
index:
|
|
3841
|
+
import_v421.z.object({
|
|
3842
|
+
type: import_v421.z.literal("file_path"),
|
|
3843
|
+
file_id: import_v421.z.string(),
|
|
3844
|
+
index: import_v421.z.number()
|
|
3702
3845
|
})
|
|
3703
3846
|
])
|
|
3704
3847
|
)
|
|
3705
3848
|
})
|
|
3706
3849
|
)
|
|
3707
3850
|
}),
|
|
3708
|
-
|
|
3709
|
-
type:
|
|
3710
|
-
id:
|
|
3711
|
-
status:
|
|
3712
|
-
action:
|
|
3713
|
-
|
|
3714
|
-
type:
|
|
3715
|
-
query:
|
|
3716
|
-
sources:
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
type:
|
|
3721
|
-
name:
|
|
3851
|
+
import_v421.z.object({
|
|
3852
|
+
type: import_v421.z.literal("web_search_call"),
|
|
3853
|
+
id: import_v421.z.string(),
|
|
3854
|
+
status: import_v421.z.string(),
|
|
3855
|
+
action: import_v421.z.discriminatedUnion("type", [
|
|
3856
|
+
import_v421.z.object({
|
|
3857
|
+
type: import_v421.z.literal("search"),
|
|
3858
|
+
query: import_v421.z.string().nullish(),
|
|
3859
|
+
sources: import_v421.z.array(
|
|
3860
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3861
|
+
import_v421.z.object({ type: import_v421.z.literal("url"), url: import_v421.z.string() }),
|
|
3862
|
+
import_v421.z.object({
|
|
3863
|
+
type: import_v421.z.literal("api"),
|
|
3864
|
+
name: import_v421.z.string()
|
|
3722
3865
|
})
|
|
3723
3866
|
])
|
|
3724
3867
|
).nullish()
|
|
3725
3868
|
}),
|
|
3726
|
-
|
|
3727
|
-
type:
|
|
3728
|
-
url:
|
|
3869
|
+
import_v421.z.object({
|
|
3870
|
+
type: import_v421.z.literal("open_page"),
|
|
3871
|
+
url: import_v421.z.string().nullish()
|
|
3729
3872
|
}),
|
|
3730
|
-
|
|
3731
|
-
type:
|
|
3732
|
-
url:
|
|
3733
|
-
pattern:
|
|
3873
|
+
import_v421.z.object({
|
|
3874
|
+
type: import_v421.z.literal("find_in_page"),
|
|
3875
|
+
url: import_v421.z.string().nullish(),
|
|
3876
|
+
pattern: import_v421.z.string().nullish()
|
|
3734
3877
|
})
|
|
3735
3878
|
]).nullish()
|
|
3736
3879
|
}),
|
|
3737
|
-
|
|
3738
|
-
type:
|
|
3739
|
-
id:
|
|
3740
|
-
queries:
|
|
3741
|
-
results:
|
|
3742
|
-
|
|
3743
|
-
attributes:
|
|
3744
|
-
|
|
3745
|
-
|
|
3880
|
+
import_v421.z.object({
|
|
3881
|
+
type: import_v421.z.literal("file_search_call"),
|
|
3882
|
+
id: import_v421.z.string(),
|
|
3883
|
+
queries: import_v421.z.array(import_v421.z.string()),
|
|
3884
|
+
results: import_v421.z.array(
|
|
3885
|
+
import_v421.z.object({
|
|
3886
|
+
attributes: import_v421.z.record(
|
|
3887
|
+
import_v421.z.string(),
|
|
3888
|
+
import_v421.z.union([import_v421.z.string(), import_v421.z.number(), import_v421.z.boolean()])
|
|
3746
3889
|
),
|
|
3747
|
-
file_id:
|
|
3748
|
-
filename:
|
|
3749
|
-
score:
|
|
3750
|
-
text:
|
|
3890
|
+
file_id: import_v421.z.string(),
|
|
3891
|
+
filename: import_v421.z.string(),
|
|
3892
|
+
score: import_v421.z.number(),
|
|
3893
|
+
text: import_v421.z.string()
|
|
3751
3894
|
})
|
|
3752
3895
|
).nullish()
|
|
3753
3896
|
}),
|
|
3754
|
-
|
|
3755
|
-
type:
|
|
3756
|
-
id:
|
|
3757
|
-
code:
|
|
3758
|
-
container_id:
|
|
3759
|
-
outputs:
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3897
|
+
import_v421.z.object({
|
|
3898
|
+
type: import_v421.z.literal("code_interpreter_call"),
|
|
3899
|
+
id: import_v421.z.string(),
|
|
3900
|
+
code: import_v421.z.string().nullable(),
|
|
3901
|
+
container_id: import_v421.z.string(),
|
|
3902
|
+
outputs: import_v421.z.array(
|
|
3903
|
+
import_v421.z.discriminatedUnion("type", [
|
|
3904
|
+
import_v421.z.object({ type: import_v421.z.literal("logs"), logs: import_v421.z.string() }),
|
|
3905
|
+
import_v421.z.object({ type: import_v421.z.literal("image"), url: import_v421.z.string() })
|
|
3763
3906
|
])
|
|
3764
3907
|
).nullable()
|
|
3765
3908
|
}),
|
|
3766
|
-
|
|
3767
|
-
type:
|
|
3768
|
-
id:
|
|
3769
|
-
result:
|
|
3909
|
+
import_v421.z.object({
|
|
3910
|
+
type: import_v421.z.literal("image_generation_call"),
|
|
3911
|
+
id: import_v421.z.string(),
|
|
3912
|
+
result: import_v421.z.string()
|
|
3770
3913
|
}),
|
|
3771
|
-
|
|
3772
|
-
type:
|
|
3773
|
-
id:
|
|
3774
|
-
call_id:
|
|
3775
|
-
action:
|
|
3776
|
-
type:
|
|
3777
|
-
command:
|
|
3778
|
-
timeout_ms:
|
|
3779
|
-
user:
|
|
3780
|
-
working_directory:
|
|
3781
|
-
env:
|
|
3914
|
+
import_v421.z.object({
|
|
3915
|
+
type: import_v421.z.literal("local_shell_call"),
|
|
3916
|
+
id: import_v421.z.string(),
|
|
3917
|
+
call_id: import_v421.z.string(),
|
|
3918
|
+
action: import_v421.z.object({
|
|
3919
|
+
type: import_v421.z.literal("exec"),
|
|
3920
|
+
command: import_v421.z.array(import_v421.z.string()),
|
|
3921
|
+
timeout_ms: import_v421.z.number().optional(),
|
|
3922
|
+
user: import_v421.z.string().optional(),
|
|
3923
|
+
working_directory: import_v421.z.string().optional(),
|
|
3924
|
+
env: import_v421.z.record(import_v421.z.string(), import_v421.z.string()).optional()
|
|
3782
3925
|
})
|
|
3783
3926
|
}),
|
|
3784
|
-
|
|
3785
|
-
type:
|
|
3786
|
-
call_id:
|
|
3787
|
-
name:
|
|
3788
|
-
arguments:
|
|
3789
|
-
id:
|
|
3927
|
+
import_v421.z.object({
|
|
3928
|
+
type: import_v421.z.literal("function_call"),
|
|
3929
|
+
call_id: import_v421.z.string(),
|
|
3930
|
+
name: import_v421.z.string(),
|
|
3931
|
+
arguments: import_v421.z.string(),
|
|
3932
|
+
id: import_v421.z.string()
|
|
3790
3933
|
}),
|
|
3791
|
-
|
|
3792
|
-
type:
|
|
3793
|
-
call_id:
|
|
3794
|
-
name:
|
|
3795
|
-
input:
|
|
3796
|
-
id:
|
|
3934
|
+
import_v421.z.object({
|
|
3935
|
+
type: import_v421.z.literal("custom_tool_call"),
|
|
3936
|
+
call_id: import_v421.z.string(),
|
|
3937
|
+
name: import_v421.z.string(),
|
|
3938
|
+
input: import_v421.z.string(),
|
|
3939
|
+
id: import_v421.z.string()
|
|
3797
3940
|
}),
|
|
3798
|
-
|
|
3799
|
-
type:
|
|
3800
|
-
id:
|
|
3801
|
-
status:
|
|
3941
|
+
import_v421.z.object({
|
|
3942
|
+
type: import_v421.z.literal("computer_call"),
|
|
3943
|
+
id: import_v421.z.string(),
|
|
3944
|
+
status: import_v421.z.string().optional()
|
|
3802
3945
|
}),
|
|
3803
|
-
|
|
3804
|
-
type:
|
|
3805
|
-
id:
|
|
3806
|
-
encrypted_content:
|
|
3807
|
-
summary:
|
|
3808
|
-
|
|
3809
|
-
type:
|
|
3810
|
-
text:
|
|
3946
|
+
import_v421.z.object({
|
|
3947
|
+
type: import_v421.z.literal("reasoning"),
|
|
3948
|
+
id: import_v421.z.string(),
|
|
3949
|
+
encrypted_content: import_v421.z.string().nullish(),
|
|
3950
|
+
summary: import_v421.z.array(
|
|
3951
|
+
import_v421.z.object({
|
|
3952
|
+
type: import_v421.z.literal("summary_text"),
|
|
3953
|
+
text: import_v421.z.string()
|
|
3811
3954
|
})
|
|
3812
3955
|
)
|
|
3813
3956
|
}),
|
|
3814
|
-
|
|
3815
|
-
type:
|
|
3816
|
-
id:
|
|
3817
|
-
status:
|
|
3818
|
-
arguments:
|
|
3819
|
-
name:
|
|
3820
|
-
server_label:
|
|
3821
|
-
output:
|
|
3822
|
-
error:
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
type:
|
|
3826
|
-
code:
|
|
3827
|
-
message:
|
|
3957
|
+
import_v421.z.object({
|
|
3958
|
+
type: import_v421.z.literal("mcp_call"),
|
|
3959
|
+
id: import_v421.z.string(),
|
|
3960
|
+
status: import_v421.z.string(),
|
|
3961
|
+
arguments: import_v421.z.string(),
|
|
3962
|
+
name: import_v421.z.string(),
|
|
3963
|
+
server_label: import_v421.z.string(),
|
|
3964
|
+
output: import_v421.z.string().nullish(),
|
|
3965
|
+
error: import_v421.z.union([
|
|
3966
|
+
import_v421.z.string(),
|
|
3967
|
+
import_v421.z.object({
|
|
3968
|
+
type: import_v421.z.string().optional(),
|
|
3969
|
+
code: import_v421.z.union([import_v421.z.number(), import_v421.z.string()]).optional(),
|
|
3970
|
+
message: import_v421.z.string().optional()
|
|
3828
3971
|
}).loose()
|
|
3829
3972
|
]).nullish(),
|
|
3830
|
-
approval_request_id:
|
|
3973
|
+
approval_request_id: import_v421.z.string().nullish()
|
|
3831
3974
|
}),
|
|
3832
|
-
|
|
3833
|
-
type:
|
|
3834
|
-
id:
|
|
3835
|
-
server_label:
|
|
3836
|
-
tools:
|
|
3837
|
-
|
|
3838
|
-
name:
|
|
3839
|
-
description:
|
|
3840
|
-
input_schema:
|
|
3841
|
-
annotations:
|
|
3975
|
+
import_v421.z.object({
|
|
3976
|
+
type: import_v421.z.literal("mcp_list_tools"),
|
|
3977
|
+
id: import_v421.z.string(),
|
|
3978
|
+
server_label: import_v421.z.string(),
|
|
3979
|
+
tools: import_v421.z.array(
|
|
3980
|
+
import_v421.z.object({
|
|
3981
|
+
name: import_v421.z.string(),
|
|
3982
|
+
description: import_v421.z.string().optional(),
|
|
3983
|
+
input_schema: import_v421.z.any(),
|
|
3984
|
+
annotations: import_v421.z.record(import_v421.z.string(), import_v421.z.unknown()).optional()
|
|
3842
3985
|
})
|
|
3843
3986
|
),
|
|
3844
|
-
error:
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
type:
|
|
3848
|
-
code:
|
|
3849
|
-
message:
|
|
3987
|
+
error: import_v421.z.union([
|
|
3988
|
+
import_v421.z.string(),
|
|
3989
|
+
import_v421.z.object({
|
|
3990
|
+
type: import_v421.z.string().optional(),
|
|
3991
|
+
code: import_v421.z.union([import_v421.z.number(), import_v421.z.string()]).optional(),
|
|
3992
|
+
message: import_v421.z.string().optional()
|
|
3850
3993
|
}).loose()
|
|
3851
3994
|
]).optional()
|
|
3852
3995
|
}),
|
|
3853
|
-
|
|
3854
|
-
type:
|
|
3855
|
-
id:
|
|
3856
|
-
server_label:
|
|
3857
|
-
name:
|
|
3858
|
-
arguments:
|
|
3859
|
-
approval_request_id:
|
|
3996
|
+
import_v421.z.object({
|
|
3997
|
+
type: import_v421.z.literal("mcp_approval_request"),
|
|
3998
|
+
id: import_v421.z.string(),
|
|
3999
|
+
server_label: import_v421.z.string(),
|
|
4000
|
+
name: import_v421.z.string(),
|
|
4001
|
+
arguments: import_v421.z.string(),
|
|
4002
|
+
approval_request_id: import_v421.z.string().optional()
|
|
3860
4003
|
}),
|
|
3861
|
-
|
|
3862
|
-
type:
|
|
3863
|
-
id:
|
|
3864
|
-
call_id:
|
|
3865
|
-
status:
|
|
3866
|
-
operation:
|
|
3867
|
-
|
|
3868
|
-
type:
|
|
3869
|
-
path:
|
|
3870
|
-
diff:
|
|
4004
|
+
import_v421.z.object({
|
|
4005
|
+
type: import_v421.z.literal("apply_patch_call"),
|
|
4006
|
+
id: import_v421.z.string(),
|
|
4007
|
+
call_id: import_v421.z.string(),
|
|
4008
|
+
status: import_v421.z.enum(["in_progress", "completed"]),
|
|
4009
|
+
operation: import_v421.z.discriminatedUnion("type", [
|
|
4010
|
+
import_v421.z.object({
|
|
4011
|
+
type: import_v421.z.literal("create_file"),
|
|
4012
|
+
path: import_v421.z.string(),
|
|
4013
|
+
diff: import_v421.z.string()
|
|
3871
4014
|
}),
|
|
3872
|
-
|
|
3873
|
-
type:
|
|
3874
|
-
path:
|
|
4015
|
+
import_v421.z.object({
|
|
4016
|
+
type: import_v421.z.literal("delete_file"),
|
|
4017
|
+
path: import_v421.z.string()
|
|
3875
4018
|
}),
|
|
3876
|
-
|
|
3877
|
-
type:
|
|
3878
|
-
path:
|
|
3879
|
-
diff:
|
|
4019
|
+
import_v421.z.object({
|
|
4020
|
+
type: import_v421.z.literal("update_file"),
|
|
4021
|
+
path: import_v421.z.string(),
|
|
4022
|
+
diff: import_v421.z.string()
|
|
3880
4023
|
})
|
|
3881
4024
|
])
|
|
3882
4025
|
}),
|
|
3883
|
-
|
|
3884
|
-
type:
|
|
3885
|
-
id:
|
|
3886
|
-
call_id:
|
|
3887
|
-
status:
|
|
3888
|
-
action:
|
|
3889
|
-
commands:
|
|
4026
|
+
import_v421.z.object({
|
|
4027
|
+
type: import_v421.z.literal("shell_call"),
|
|
4028
|
+
id: import_v421.z.string(),
|
|
4029
|
+
call_id: import_v421.z.string(),
|
|
4030
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4031
|
+
action: import_v421.z.object({
|
|
4032
|
+
commands: import_v421.z.array(import_v421.z.string())
|
|
3890
4033
|
})
|
|
3891
4034
|
}),
|
|
3892
|
-
|
|
3893
|
-
type:
|
|
3894
|
-
id:
|
|
3895
|
-
call_id:
|
|
3896
|
-
status:
|
|
3897
|
-
output:
|
|
3898
|
-
|
|
3899
|
-
stdout:
|
|
3900
|
-
stderr:
|
|
3901
|
-
outcome:
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
type:
|
|
3905
|
-
exit_code:
|
|
4035
|
+
import_v421.z.object({
|
|
4036
|
+
type: import_v421.z.literal("shell_call_output"),
|
|
4037
|
+
id: import_v421.z.string(),
|
|
4038
|
+
call_id: import_v421.z.string(),
|
|
4039
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4040
|
+
output: import_v421.z.array(
|
|
4041
|
+
import_v421.z.object({
|
|
4042
|
+
stdout: import_v421.z.string(),
|
|
4043
|
+
stderr: import_v421.z.string(),
|
|
4044
|
+
outcome: import_v421.z.discriminatedUnion("type", [
|
|
4045
|
+
import_v421.z.object({ type: import_v421.z.literal("timeout") }),
|
|
4046
|
+
import_v421.z.object({
|
|
4047
|
+
type: import_v421.z.literal("exit"),
|
|
4048
|
+
exit_code: import_v421.z.number()
|
|
3906
4049
|
})
|
|
3907
4050
|
])
|
|
3908
4051
|
})
|
|
3909
4052
|
)
|
|
4053
|
+
}),
|
|
4054
|
+
import_v421.z.object({
|
|
4055
|
+
type: import_v421.z.literal("tool_search_call"),
|
|
4056
|
+
id: import_v421.z.string(),
|
|
4057
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
4058
|
+
call_id: import_v421.z.string().nullable(),
|
|
4059
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4060
|
+
arguments: import_v421.z.unknown()
|
|
4061
|
+
}),
|
|
4062
|
+
import_v421.z.object({
|
|
4063
|
+
type: import_v421.z.literal("tool_search_output"),
|
|
4064
|
+
id: import_v421.z.string(),
|
|
4065
|
+
execution: import_v421.z.enum(["server", "client"]),
|
|
4066
|
+
call_id: import_v421.z.string().nullable(),
|
|
4067
|
+
status: import_v421.z.enum(["in_progress", "completed", "incomplete"]),
|
|
4068
|
+
tools: import_v421.z.array(import_v421.z.record(import_v421.z.string(), jsonValueSchema2.optional()))
|
|
3910
4069
|
})
|
|
3911
4070
|
])
|
|
3912
4071
|
).optional(),
|
|
3913
|
-
service_tier:
|
|
3914
|
-
incomplete_details:
|
|
3915
|
-
usage:
|
|
3916
|
-
input_tokens:
|
|
3917
|
-
input_tokens_details:
|
|
3918
|
-
output_tokens:
|
|
3919
|
-
output_tokens_details:
|
|
4072
|
+
service_tier: import_v421.z.string().nullish(),
|
|
4073
|
+
incomplete_details: import_v421.z.object({ reason: import_v421.z.string() }).nullish(),
|
|
4074
|
+
usage: import_v421.z.object({
|
|
4075
|
+
input_tokens: import_v421.z.number(),
|
|
4076
|
+
input_tokens_details: import_v421.z.object({ cached_tokens: import_v421.z.number().nullish() }).nullish(),
|
|
4077
|
+
output_tokens: import_v421.z.number(),
|
|
4078
|
+
output_tokens_details: import_v421.z.object({ reasoning_tokens: import_v421.z.number().nullish() }).nullish()
|
|
3920
4079
|
}).optional()
|
|
3921
4080
|
})
|
|
3922
4081
|
)
|
|
3923
4082
|
);
|
|
3924
4083
|
|
|
3925
4084
|
// src/responses/openai-responses-options.ts
|
|
3926
|
-
var
|
|
3927
|
-
var
|
|
4085
|
+
var import_provider_utils27 = require("@ai-sdk/provider-utils");
|
|
4086
|
+
var import_v422 = require("zod/v4");
|
|
3928
4087
|
var TOP_LOGPROBS_MAX = 20;
|
|
3929
4088
|
var openaiResponsesReasoningModelIds = [
|
|
3930
4089
|
"o1",
|
|
@@ -3985,9 +4144,9 @@ var openaiResponsesModelIds = [
|
|
|
3985
4144
|
"gpt-5-chat-latest",
|
|
3986
4145
|
...openaiResponsesReasoningModelIds
|
|
3987
4146
|
];
|
|
3988
|
-
var openaiLanguageModelResponsesOptionsSchema = (0,
|
|
3989
|
-
() => (0,
|
|
3990
|
-
|
|
4147
|
+
var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils27.lazySchema)(
|
|
4148
|
+
() => (0, import_provider_utils27.zodSchema)(
|
|
4149
|
+
import_v422.z.object({
|
|
3991
4150
|
/**
|
|
3992
4151
|
* The ID of the OpenAI Conversation to continue.
|
|
3993
4152
|
* You must create a conversation first via the OpenAI API.
|
|
@@ -3995,13 +4154,13 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
3995
4154
|
* Defaults to `undefined`.
|
|
3996
4155
|
* @see https://platform.openai.com/docs/api-reference/conversations/create
|
|
3997
4156
|
*/
|
|
3998
|
-
conversation:
|
|
4157
|
+
conversation: import_v422.z.string().nullish(),
|
|
3999
4158
|
/**
|
|
4000
4159
|
* The set of extra fields to include in the response (advanced, usually not needed).
|
|
4001
4160
|
* Example values: 'reasoning.encrypted_content', 'file_search_call.results', 'message.output_text.logprobs'.
|
|
4002
4161
|
*/
|
|
4003
|
-
include:
|
|
4004
|
-
|
|
4162
|
+
include: import_v422.z.array(
|
|
4163
|
+
import_v422.z.enum([
|
|
4005
4164
|
"reasoning.encrypted_content",
|
|
4006
4165
|
// handled internally by default, only needed for unknown reasoning models
|
|
4007
4166
|
"file_search_call.results",
|
|
@@ -4013,7 +4172,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4013
4172
|
* They can be used to change the system or developer message when continuing a conversation using the `previousResponseId` option.
|
|
4014
4173
|
* Defaults to `undefined`.
|
|
4015
4174
|
*/
|
|
4016
|
-
instructions:
|
|
4175
|
+
instructions: import_v422.z.string().nullish(),
|
|
4017
4176
|
/**
|
|
4018
4177
|
* Return the log probabilities of the tokens. Including logprobs will increase
|
|
4019
4178
|
* the response size and can slow down response times. However, it can
|
|
@@ -4028,30 +4187,30 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4028
4187
|
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
4029
4188
|
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
4030
4189
|
*/
|
|
4031
|
-
logprobs:
|
|
4190
|
+
logprobs: import_v422.z.union([import_v422.z.boolean(), import_v422.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
4032
4191
|
/**
|
|
4033
4192
|
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
4034
4193
|
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
4035
4194
|
* Any further attempts to call a tool by the model will be ignored.
|
|
4036
4195
|
*/
|
|
4037
|
-
maxToolCalls:
|
|
4196
|
+
maxToolCalls: import_v422.z.number().nullish(),
|
|
4038
4197
|
/**
|
|
4039
4198
|
* Additional metadata to store with the generation.
|
|
4040
4199
|
*/
|
|
4041
|
-
metadata:
|
|
4200
|
+
metadata: import_v422.z.any().nullish(),
|
|
4042
4201
|
/**
|
|
4043
4202
|
* Whether to use parallel tool calls. Defaults to `true`.
|
|
4044
4203
|
*/
|
|
4045
|
-
parallelToolCalls:
|
|
4204
|
+
parallelToolCalls: import_v422.z.boolean().nullish(),
|
|
4046
4205
|
/**
|
|
4047
4206
|
* The ID of the previous response. You can use it to continue a conversation.
|
|
4048
4207
|
* Defaults to `undefined`.
|
|
4049
4208
|
*/
|
|
4050
|
-
previousResponseId:
|
|
4209
|
+
previousResponseId: import_v422.z.string().nullish(),
|
|
4051
4210
|
/**
|
|
4052
4211
|
* Sets a cache key to tie this prompt to cached prefixes for better caching performance.
|
|
4053
4212
|
*/
|
|
4054
|
-
promptCacheKey:
|
|
4213
|
+
promptCacheKey: import_v422.z.string().nullish(),
|
|
4055
4214
|
/**
|
|
4056
4215
|
* The retention policy for the prompt cache.
|
|
4057
4216
|
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
@@ -4060,7 +4219,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4060
4219
|
*
|
|
4061
4220
|
* @default 'in_memory'
|
|
4062
4221
|
*/
|
|
4063
|
-
promptCacheRetention:
|
|
4222
|
+
promptCacheRetention: import_v422.z.enum(["in_memory", "24h"]).nullish(),
|
|
4064
4223
|
/**
|
|
4065
4224
|
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
4066
4225
|
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
@@ -4071,17 +4230,17 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4071
4230
|
* OpenAI's GPT-5.1-Codex-Max model. Setting `reasoningEffort` to 'none' or 'xhigh' with unsupported models will result in
|
|
4072
4231
|
* an error.
|
|
4073
4232
|
*/
|
|
4074
|
-
reasoningEffort:
|
|
4233
|
+
reasoningEffort: import_v422.z.string().nullish(),
|
|
4075
4234
|
/**
|
|
4076
4235
|
* Controls reasoning summary output from the model.
|
|
4077
4236
|
* Set to "auto" to automatically receive the richest level available,
|
|
4078
4237
|
* or "detailed" for comprehensive summaries.
|
|
4079
4238
|
*/
|
|
4080
|
-
reasoningSummary:
|
|
4239
|
+
reasoningSummary: import_v422.z.string().nullish(),
|
|
4081
4240
|
/**
|
|
4082
4241
|
* The identifier for safety monitoring and tracking.
|
|
4083
4242
|
*/
|
|
4084
|
-
safetyIdentifier:
|
|
4243
|
+
safetyIdentifier: import_v422.z.string().nullish(),
|
|
4085
4244
|
/**
|
|
4086
4245
|
* Service tier for the request.
|
|
4087
4246
|
* Set to 'flex' for 50% cheaper processing at the cost of increased latency (available for o3, o4-mini, and gpt-5 models).
|
|
@@ -4089,34 +4248,34 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4089
4248
|
*
|
|
4090
4249
|
* Defaults to 'auto'.
|
|
4091
4250
|
*/
|
|
4092
|
-
serviceTier:
|
|
4251
|
+
serviceTier: import_v422.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
4093
4252
|
/**
|
|
4094
4253
|
* Whether to store the generation. Defaults to `true`.
|
|
4095
4254
|
*/
|
|
4096
|
-
store:
|
|
4255
|
+
store: import_v422.z.boolean().nullish(),
|
|
4097
4256
|
/**
|
|
4098
4257
|
* Whether to use strict JSON schema validation.
|
|
4099
4258
|
* Defaults to `true`.
|
|
4100
4259
|
*/
|
|
4101
|
-
strictJsonSchema:
|
|
4260
|
+
strictJsonSchema: import_v422.z.boolean().nullish(),
|
|
4102
4261
|
/**
|
|
4103
4262
|
* Controls the verbosity of the model's responses. Lower values ('low') will result
|
|
4104
4263
|
* in more concise responses, while higher values ('high') will result in more verbose responses.
|
|
4105
4264
|
* Valid values: 'low', 'medium', 'high'.
|
|
4106
4265
|
*/
|
|
4107
|
-
textVerbosity:
|
|
4266
|
+
textVerbosity: import_v422.z.enum(["low", "medium", "high"]).nullish(),
|
|
4108
4267
|
/**
|
|
4109
4268
|
* Controls output truncation. 'auto' (default) performs truncation automatically;
|
|
4110
4269
|
* 'disabled' turns truncation off.
|
|
4111
4270
|
*/
|
|
4112
|
-
truncation:
|
|
4271
|
+
truncation: import_v422.z.enum(["auto", "disabled"]).nullish(),
|
|
4113
4272
|
/**
|
|
4114
4273
|
* A unique identifier representing your end-user, which can help OpenAI to
|
|
4115
4274
|
* monitor and detect abuse.
|
|
4116
4275
|
* Defaults to `undefined`.
|
|
4117
4276
|
* @see https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids
|
|
4118
4277
|
*/
|
|
4119
|
-
user:
|
|
4278
|
+
user: import_v422.z.string().nullish(),
|
|
4120
4279
|
/**
|
|
4121
4280
|
* Override the system message mode for this model.
|
|
4122
4281
|
* - 'system': Use the 'system' role for system messages (default for most models)
|
|
@@ -4125,7 +4284,7 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4125
4284
|
*
|
|
4126
4285
|
* If not specified, the mode is automatically determined based on the model.
|
|
4127
4286
|
*/
|
|
4128
|
-
systemMessageMode:
|
|
4287
|
+
systemMessageMode: import_v422.z.enum(["system", "developer", "remove"]).optional(),
|
|
4129
4288
|
/**
|
|
4130
4289
|
* Force treating this model as a reasoning model.
|
|
4131
4290
|
*
|
|
@@ -4135,21 +4294,21 @@ var openaiLanguageModelResponsesOptionsSchema = (0, import_provider_utils26.lazy
|
|
|
4135
4294
|
* When enabled, the SDK applies reasoning-model parameter compatibility rules
|
|
4136
4295
|
* and defaults `systemMessageMode` to `developer` unless overridden.
|
|
4137
4296
|
*/
|
|
4138
|
-
forceReasoning:
|
|
4297
|
+
forceReasoning: import_v422.z.boolean().optional()
|
|
4139
4298
|
})
|
|
4140
4299
|
)
|
|
4141
4300
|
);
|
|
4142
4301
|
|
|
4143
4302
|
// src/responses/openai-responses-prepare-tools.ts
|
|
4144
4303
|
var import_provider7 = require("@ai-sdk/provider");
|
|
4145
|
-
var
|
|
4304
|
+
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
4146
4305
|
async function prepareResponsesTools({
|
|
4147
4306
|
tools,
|
|
4148
4307
|
toolChoice,
|
|
4149
4308
|
toolNameMapping,
|
|
4150
4309
|
customProviderToolNames
|
|
4151
4310
|
}) {
|
|
4152
|
-
var _a;
|
|
4311
|
+
var _a, _b;
|
|
4153
4312
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
4154
4313
|
const toolWarnings = [];
|
|
4155
4314
|
if (tools == null) {
|
|
@@ -4159,19 +4318,23 @@ async function prepareResponsesTools({
|
|
|
4159
4318
|
const resolvedCustomProviderToolNames = customProviderToolNames != null ? customProviderToolNames : /* @__PURE__ */ new Set();
|
|
4160
4319
|
for (const tool of tools) {
|
|
4161
4320
|
switch (tool.type) {
|
|
4162
|
-
case "function":
|
|
4321
|
+
case "function": {
|
|
4322
|
+
const openaiOptions = (_a = tool.providerOptions) == null ? void 0 : _a.openai;
|
|
4323
|
+
const deferLoading = openaiOptions == null ? void 0 : openaiOptions.deferLoading;
|
|
4163
4324
|
openaiTools2.push({
|
|
4164
4325
|
type: "function",
|
|
4165
4326
|
name: tool.name,
|
|
4166
4327
|
description: tool.description,
|
|
4167
4328
|
parameters: tool.inputSchema,
|
|
4168
|
-
...tool.strict != null ? { strict: tool.strict } : {}
|
|
4329
|
+
...tool.strict != null ? { strict: tool.strict } : {},
|
|
4330
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {}
|
|
4169
4331
|
});
|
|
4170
4332
|
break;
|
|
4333
|
+
}
|
|
4171
4334
|
case "provider": {
|
|
4172
4335
|
switch (tool.id) {
|
|
4173
4336
|
case "openai.file_search": {
|
|
4174
|
-
const args = await (0,
|
|
4337
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4175
4338
|
value: tool.args,
|
|
4176
4339
|
schema: fileSearchArgsSchema
|
|
4177
4340
|
});
|
|
@@ -4194,7 +4357,7 @@ async function prepareResponsesTools({
|
|
|
4194
4357
|
break;
|
|
4195
4358
|
}
|
|
4196
4359
|
case "openai.shell": {
|
|
4197
|
-
const args = await (0,
|
|
4360
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4198
4361
|
value: tool.args,
|
|
4199
4362
|
schema: shellArgsSchema
|
|
4200
4363
|
});
|
|
@@ -4213,7 +4376,7 @@ async function prepareResponsesTools({
|
|
|
4213
4376
|
break;
|
|
4214
4377
|
}
|
|
4215
4378
|
case "openai.web_search_preview": {
|
|
4216
|
-
const args = await (0,
|
|
4379
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4217
4380
|
value: tool.args,
|
|
4218
4381
|
schema: webSearchPreviewArgsSchema
|
|
4219
4382
|
});
|
|
@@ -4225,7 +4388,7 @@ async function prepareResponsesTools({
|
|
|
4225
4388
|
break;
|
|
4226
4389
|
}
|
|
4227
4390
|
case "openai.web_search": {
|
|
4228
|
-
const args = await (0,
|
|
4391
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4229
4392
|
value: tool.args,
|
|
4230
4393
|
schema: webSearchArgsSchema
|
|
4231
4394
|
});
|
|
@@ -4239,7 +4402,7 @@ async function prepareResponsesTools({
|
|
|
4239
4402
|
break;
|
|
4240
4403
|
}
|
|
4241
4404
|
case "openai.code_interpreter": {
|
|
4242
|
-
const args = await (0,
|
|
4405
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4243
4406
|
value: tool.args,
|
|
4244
4407
|
schema: codeInterpreterArgsSchema
|
|
4245
4408
|
});
|
|
@@ -4250,7 +4413,7 @@ async function prepareResponsesTools({
|
|
|
4250
4413
|
break;
|
|
4251
4414
|
}
|
|
4252
4415
|
case "openai.image_generation": {
|
|
4253
|
-
const args = await (0,
|
|
4416
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4254
4417
|
value: tool.args,
|
|
4255
4418
|
schema: imageGenerationArgsSchema
|
|
4256
4419
|
});
|
|
@@ -4273,7 +4436,7 @@ async function prepareResponsesTools({
|
|
|
4273
4436
|
break;
|
|
4274
4437
|
}
|
|
4275
4438
|
case "openai.mcp": {
|
|
4276
|
-
const args = await (0,
|
|
4439
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4277
4440
|
value: tool.args,
|
|
4278
4441
|
schema: mcpArgsSchema
|
|
4279
4442
|
});
|
|
@@ -4299,7 +4462,7 @@ async function prepareResponsesTools({
|
|
|
4299
4462
|
break;
|
|
4300
4463
|
}
|
|
4301
4464
|
case "openai.custom": {
|
|
4302
|
-
const args = await (0,
|
|
4465
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4303
4466
|
value: tool.args,
|
|
4304
4467
|
schema: customArgsSchema
|
|
4305
4468
|
});
|
|
@@ -4312,6 +4475,19 @@ async function prepareResponsesTools({
|
|
|
4312
4475
|
resolvedCustomProviderToolNames.add(args.name);
|
|
4313
4476
|
break;
|
|
4314
4477
|
}
|
|
4478
|
+
case "openai.tool_search": {
|
|
4479
|
+
const args = await (0, import_provider_utils28.validateTypes)({
|
|
4480
|
+
value: tool.args,
|
|
4481
|
+
schema: toolSearchArgsSchema
|
|
4482
|
+
});
|
|
4483
|
+
openaiTools2.push({
|
|
4484
|
+
type: "tool_search",
|
|
4485
|
+
...args.execution != null ? { execution: args.execution } : {},
|
|
4486
|
+
...args.description != null ? { description: args.description } : {},
|
|
4487
|
+
...args.parameters != null ? { parameters: args.parameters } : {}
|
|
4488
|
+
});
|
|
4489
|
+
break;
|
|
4490
|
+
}
|
|
4315
4491
|
}
|
|
4316
4492
|
break;
|
|
4317
4493
|
}
|
|
@@ -4333,7 +4509,7 @@ async function prepareResponsesTools({
|
|
|
4333
4509
|
case "required":
|
|
4334
4510
|
return { tools: openaiTools2, toolChoice: type, toolWarnings };
|
|
4335
4511
|
case "tool": {
|
|
4336
|
-
const resolvedToolName = (
|
|
4512
|
+
const resolvedToolName = (_b = toolNameMapping == null ? void 0 : toolNameMapping.toProviderToolName(toolChoice.toolName)) != null ? _b : toolChoice.toolName;
|
|
4337
4513
|
return {
|
|
4338
4514
|
tools: openaiTools2,
|
|
4339
4515
|
toolChoice: resolvedToolName === "code_interpreter" || resolvedToolName === "file_search" || resolvedToolName === "image_generation" || resolvedToolName === "web_search_preview" || resolvedToolName === "web_search" || resolvedToolName === "mcp" || resolvedToolName === "apply_patch" ? { type: resolvedToolName } : resolvedCustomProviderToolNames.has(resolvedToolName) ? { type: "custom", name: resolvedToolName } : { type: "function", name: resolvedToolName },
|
|
@@ -4458,13 +4634,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4458
4634
|
warnings.push({ type: "unsupported", feature: "stopSequences" });
|
|
4459
4635
|
}
|
|
4460
4636
|
const providerOptionsName = this.config.provider.includes("azure") ? "azure" : "openai";
|
|
4461
|
-
let openaiOptions = await (0,
|
|
4637
|
+
let openaiOptions = await (0, import_provider_utils29.parseProviderOptions)({
|
|
4462
4638
|
provider: providerOptionsName,
|
|
4463
4639
|
providerOptions,
|
|
4464
4640
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
4465
4641
|
});
|
|
4466
4642
|
if (openaiOptions == null && providerOptionsName !== "openai") {
|
|
4467
|
-
openaiOptions = await (0,
|
|
4643
|
+
openaiOptions = await (0, import_provider_utils29.parseProviderOptions)({
|
|
4468
4644
|
provider: "openai",
|
|
4469
4645
|
providerOptions,
|
|
4470
4646
|
schema: openaiLanguageModelResponsesOptionsSchema
|
|
@@ -4478,7 +4654,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4478
4654
|
details: "conversation and previousResponseId cannot be used together"
|
|
4479
4655
|
});
|
|
4480
4656
|
}
|
|
4481
|
-
const toolNameMapping = (0,
|
|
4657
|
+
const toolNameMapping = (0, import_provider_utils29.createToolNameMapping)({
|
|
4482
4658
|
tools,
|
|
4483
4659
|
providerToolNames: {
|
|
4484
4660
|
"openai.code_interpreter": "code_interpreter",
|
|
@@ -4489,7 +4665,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4489
4665
|
"openai.web_search": "web_search",
|
|
4490
4666
|
"openai.web_search_preview": "web_search_preview",
|
|
4491
4667
|
"openai.mcp": "mcp",
|
|
4492
|
-
"openai.apply_patch": "apply_patch"
|
|
4668
|
+
"openai.apply_patch": "apply_patch",
|
|
4669
|
+
"openai.tool_search": "tool_search"
|
|
4493
4670
|
},
|
|
4494
4671
|
resolveProviderToolName: (tool) => tool.id === "openai.custom" ? tool.args.name : void 0
|
|
4495
4672
|
});
|
|
@@ -4667,7 +4844,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4667
4844
|
};
|
|
4668
4845
|
}
|
|
4669
4846
|
async doGenerate(options) {
|
|
4670
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
4847
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
4671
4848
|
const {
|
|
4672
4849
|
args: body,
|
|
4673
4850
|
warnings,
|
|
@@ -4685,12 +4862,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4685
4862
|
responseHeaders,
|
|
4686
4863
|
value: response,
|
|
4687
4864
|
rawValue: rawResponse
|
|
4688
|
-
} = await (0,
|
|
4865
|
+
} = await (0, import_provider_utils29.postJsonToApi)({
|
|
4689
4866
|
url,
|
|
4690
|
-
headers: (0,
|
|
4867
|
+
headers: (0, import_provider_utils29.combineHeaders)(this.config.headers(), options.headers),
|
|
4691
4868
|
body,
|
|
4692
4869
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
4693
|
-
successfulResponseHandler: (0,
|
|
4870
|
+
successfulResponseHandler: (0, import_provider_utils29.createJsonResponseHandler)(
|
|
4694
4871
|
openaiResponsesResponseSchema
|
|
4695
4872
|
),
|
|
4696
4873
|
abortSignal: options.abortSignal,
|
|
@@ -4710,6 +4887,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4710
4887
|
const content = [];
|
|
4711
4888
|
const logprobs = [];
|
|
4712
4889
|
let hasFunctionCall = false;
|
|
4890
|
+
const hostedToolSearchCallIds = [];
|
|
4713
4891
|
for (const part of response.output) {
|
|
4714
4892
|
switch (part.type) {
|
|
4715
4893
|
case "reasoning": {
|
|
@@ -4748,6 +4926,46 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4748
4926
|
});
|
|
4749
4927
|
break;
|
|
4750
4928
|
}
|
|
4929
|
+
case "tool_search_call": {
|
|
4930
|
+
const toolCallId = (_b = part.call_id) != null ? _b : part.id;
|
|
4931
|
+
const isHosted = part.execution === "server";
|
|
4932
|
+
if (isHosted) {
|
|
4933
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
4934
|
+
}
|
|
4935
|
+
content.push({
|
|
4936
|
+
type: "tool-call",
|
|
4937
|
+
toolCallId,
|
|
4938
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
4939
|
+
input: JSON.stringify({
|
|
4940
|
+
arguments: part.arguments,
|
|
4941
|
+
call_id: part.call_id
|
|
4942
|
+
}),
|
|
4943
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
4944
|
+
providerMetadata: {
|
|
4945
|
+
[providerOptionsName]: {
|
|
4946
|
+
itemId: part.id
|
|
4947
|
+
}
|
|
4948
|
+
}
|
|
4949
|
+
});
|
|
4950
|
+
break;
|
|
4951
|
+
}
|
|
4952
|
+
case "tool_search_output": {
|
|
4953
|
+
const toolCallId = (_d = (_c = part.call_id) != null ? _c : hostedToolSearchCallIds.shift()) != null ? _d : part.id;
|
|
4954
|
+
content.push({
|
|
4955
|
+
type: "tool-result",
|
|
4956
|
+
toolCallId,
|
|
4957
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
4958
|
+
result: {
|
|
4959
|
+
tools: part.tools
|
|
4960
|
+
},
|
|
4961
|
+
providerMetadata: {
|
|
4962
|
+
[providerOptionsName]: {
|
|
4963
|
+
itemId: part.id
|
|
4964
|
+
}
|
|
4965
|
+
}
|
|
4966
|
+
});
|
|
4967
|
+
break;
|
|
4968
|
+
}
|
|
4751
4969
|
case "local_shell_call": {
|
|
4752
4970
|
content.push({
|
|
4753
4971
|
type: "tool-call",
|
|
@@ -4803,7 +5021,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4803
5021
|
}
|
|
4804
5022
|
case "message": {
|
|
4805
5023
|
for (const contentPart of part.content) {
|
|
4806
|
-
if (((
|
|
5024
|
+
if (((_f = (_e = options.providerOptions) == null ? void 0 : _e[providerOptionsName]) == null ? void 0 : _f.logprobs) && contentPart.logprobs) {
|
|
4807
5025
|
logprobs.push(contentPart.logprobs);
|
|
4808
5026
|
}
|
|
4809
5027
|
const providerMetadata2 = {
|
|
@@ -4825,7 +5043,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4825
5043
|
content.push({
|
|
4826
5044
|
type: "source",
|
|
4827
5045
|
sourceType: "url",
|
|
4828
|
-
id: (
|
|
5046
|
+
id: (_i = (_h = (_g = this.config).generateId) == null ? void 0 : _h.call(_g)) != null ? _i : (0, import_provider_utils29.generateId)(),
|
|
4829
5047
|
url: annotation.url,
|
|
4830
5048
|
title: annotation.title
|
|
4831
5049
|
});
|
|
@@ -4833,7 +5051,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4833
5051
|
content.push({
|
|
4834
5052
|
type: "source",
|
|
4835
5053
|
sourceType: "document",
|
|
4836
|
-
id: (
|
|
5054
|
+
id: (_l = (_k = (_j = this.config).generateId) == null ? void 0 : _k.call(_j)) != null ? _l : (0, import_provider_utils29.generateId)(),
|
|
4837
5055
|
mediaType: "text/plain",
|
|
4838
5056
|
title: annotation.filename,
|
|
4839
5057
|
filename: annotation.filename,
|
|
@@ -4849,7 +5067,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4849
5067
|
content.push({
|
|
4850
5068
|
type: "source",
|
|
4851
5069
|
sourceType: "document",
|
|
4852
|
-
id: (
|
|
5070
|
+
id: (_o = (_n = (_m = this.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils29.generateId)(),
|
|
4853
5071
|
mediaType: "text/plain",
|
|
4854
5072
|
title: annotation.filename,
|
|
4855
5073
|
filename: annotation.filename,
|
|
@@ -4865,7 +5083,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4865
5083
|
content.push({
|
|
4866
5084
|
type: "source",
|
|
4867
5085
|
sourceType: "document",
|
|
4868
|
-
id: (
|
|
5086
|
+
id: (_r = (_q = (_p = this.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils29.generateId)(),
|
|
4869
5087
|
mediaType: "application/octet-stream",
|
|
4870
5088
|
title: annotation.file_id,
|
|
4871
5089
|
filename: annotation.file_id,
|
|
@@ -4934,7 +5152,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4934
5152
|
break;
|
|
4935
5153
|
}
|
|
4936
5154
|
case "mcp_call": {
|
|
4937
|
-
const toolCallId = part.approval_request_id != null ? (
|
|
5155
|
+
const toolCallId = part.approval_request_id != null ? (_s = approvalRequestIdToDummyToolCallIdFromPrompt[part.approval_request_id]) != null ? _s : part.id : part.id;
|
|
4938
5156
|
const toolName = `mcp.${part.name}`;
|
|
4939
5157
|
content.push({
|
|
4940
5158
|
type: "tool-call",
|
|
@@ -4968,8 +5186,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4968
5186
|
break;
|
|
4969
5187
|
}
|
|
4970
5188
|
case "mcp_approval_request": {
|
|
4971
|
-
const approvalRequestId = (
|
|
4972
|
-
const dummyToolCallId = (
|
|
5189
|
+
const approvalRequestId = (_t = part.approval_request_id) != null ? _t : part.id;
|
|
5190
|
+
const dummyToolCallId = (_w = (_v = (_u = this.config).generateId) == null ? void 0 : _v.call(_u)) != null ? _w : (0, import_provider_utils29.generateId)();
|
|
4973
5191
|
const toolName = `mcp.${part.name}`;
|
|
4974
5192
|
content.push({
|
|
4975
5193
|
type: "tool-call",
|
|
@@ -5019,13 +5237,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5019
5237
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5020
5238
|
result: {
|
|
5021
5239
|
queries: part.queries,
|
|
5022
|
-
results: (
|
|
5240
|
+
results: (_y = (_x = part.results) == null ? void 0 : _x.map((result) => ({
|
|
5023
5241
|
attributes: result.attributes,
|
|
5024
5242
|
fileId: result.file_id,
|
|
5025
5243
|
filename: result.filename,
|
|
5026
5244
|
score: result.score,
|
|
5027
5245
|
text: result.text
|
|
5028
|
-
}))) != null ?
|
|
5246
|
+
}))) != null ? _y : null
|
|
5029
5247
|
}
|
|
5030
5248
|
});
|
|
5031
5249
|
break;
|
|
@@ -5082,10 +5300,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5082
5300
|
content,
|
|
5083
5301
|
finishReason: {
|
|
5084
5302
|
unified: mapOpenAIResponseFinishReason({
|
|
5085
|
-
finishReason: (
|
|
5303
|
+
finishReason: (_z = response.incomplete_details) == null ? void 0 : _z.reason,
|
|
5086
5304
|
hasFunctionCall
|
|
5087
5305
|
}),
|
|
5088
|
-
raw: (
|
|
5306
|
+
raw: (_B = (_A = response.incomplete_details) == null ? void 0 : _A.reason) != null ? _B : void 0
|
|
5089
5307
|
},
|
|
5090
5308
|
usage: convertOpenAIResponsesUsage(usage),
|
|
5091
5309
|
request: { body },
|
|
@@ -5110,18 +5328,18 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5110
5328
|
providerOptionsName,
|
|
5111
5329
|
isShellProviderExecuted
|
|
5112
5330
|
} = await this.getArgs(options);
|
|
5113
|
-
const { responseHeaders, value: response } = await (0,
|
|
5331
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils29.postJsonToApi)({
|
|
5114
5332
|
url: this.config.url({
|
|
5115
5333
|
path: "/responses",
|
|
5116
5334
|
modelId: this.modelId
|
|
5117
5335
|
}),
|
|
5118
|
-
headers: (0,
|
|
5336
|
+
headers: (0, import_provider_utils29.combineHeaders)(this.config.headers(), options.headers),
|
|
5119
5337
|
body: {
|
|
5120
5338
|
...body,
|
|
5121
5339
|
stream: true
|
|
5122
5340
|
},
|
|
5123
5341
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
5124
|
-
successfulResponseHandler: (0,
|
|
5342
|
+
successfulResponseHandler: (0, import_provider_utils29.createEventSourceResponseHandler)(
|
|
5125
5343
|
openaiResponsesChunkSchema
|
|
5126
5344
|
),
|
|
5127
5345
|
abortSignal: options.abortSignal,
|
|
@@ -5143,6 +5361,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5143
5361
|
let hasFunctionCall = false;
|
|
5144
5362
|
const activeReasoning = {};
|
|
5145
5363
|
let serviceTier;
|
|
5364
|
+
const hostedToolSearchCallIds = [];
|
|
5146
5365
|
return {
|
|
5147
5366
|
stream: response.pipeThrough(
|
|
5148
5367
|
new TransformStream({
|
|
@@ -5150,7 +5369,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5150
5369
|
controller.enqueue({ type: "stream-start", warnings });
|
|
5151
5370
|
},
|
|
5152
5371
|
transform(chunk, controller) {
|
|
5153
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
5372
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J;
|
|
5154
5373
|
if (options.includeRawChunks) {
|
|
5155
5374
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
5156
5375
|
}
|
|
@@ -5258,6 +5477,24 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5258
5477
|
input: "{}",
|
|
5259
5478
|
providerExecuted: true
|
|
5260
5479
|
});
|
|
5480
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5481
|
+
const toolCallId = value.item.id;
|
|
5482
|
+
const toolName = toolNameMapping.toCustomToolName("tool_search");
|
|
5483
|
+
const isHosted = value.item.execution === "server";
|
|
5484
|
+
ongoingToolCalls[value.output_index] = {
|
|
5485
|
+
toolName,
|
|
5486
|
+
toolCallId,
|
|
5487
|
+
toolSearchExecution: (_a = value.item.execution) != null ? _a : "server"
|
|
5488
|
+
};
|
|
5489
|
+
if (isHosted) {
|
|
5490
|
+
controller.enqueue({
|
|
5491
|
+
type: "tool-input-start",
|
|
5492
|
+
id: toolCallId,
|
|
5493
|
+
toolName,
|
|
5494
|
+
providerExecuted: true
|
|
5495
|
+
});
|
|
5496
|
+
}
|
|
5497
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5261
5498
|
} else if (value.item.type === "mcp_call" || value.item.type === "mcp_list_tools" || value.item.type === "mcp_approval_request") {
|
|
5262
5499
|
} else if (value.item.type === "apply_patch_call") {
|
|
5263
5500
|
const { call_id: callId, operation } = value.item;
|
|
@@ -5304,7 +5541,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5304
5541
|
} else if (value.item.type === "shell_call_output") {
|
|
5305
5542
|
} else if (value.item.type === "message") {
|
|
5306
5543
|
ongoingAnnotations.splice(0, ongoingAnnotations.length);
|
|
5307
|
-
activeMessagePhase = (
|
|
5544
|
+
activeMessagePhase = (_b = value.item.phase) != null ? _b : void 0;
|
|
5308
5545
|
controller.enqueue({
|
|
5309
5546
|
type: "text-start",
|
|
5310
5547
|
id: value.item.id,
|
|
@@ -5328,14 +5565,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5328
5565
|
providerMetadata: {
|
|
5329
5566
|
[providerOptionsName]: {
|
|
5330
5567
|
itemId: value.item.id,
|
|
5331
|
-
reasoningEncryptedContent: (
|
|
5568
|
+
reasoningEncryptedContent: (_c = value.item.encrypted_content) != null ? _c : null
|
|
5332
5569
|
}
|
|
5333
5570
|
}
|
|
5334
5571
|
});
|
|
5335
5572
|
}
|
|
5336
5573
|
} else if (isResponseOutputItemDoneChunk(value)) {
|
|
5337
5574
|
if (value.item.type === "message") {
|
|
5338
|
-
const phase = (
|
|
5575
|
+
const phase = (_d = value.item.phase) != null ? _d : activeMessagePhase;
|
|
5339
5576
|
activeMessagePhase = void 0;
|
|
5340
5577
|
controller.enqueue({
|
|
5341
5578
|
type: "text-end",
|
|
@@ -5429,13 +5666,13 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5429
5666
|
toolName: toolNameMapping.toCustomToolName("file_search"),
|
|
5430
5667
|
result: {
|
|
5431
5668
|
queries: value.item.queries,
|
|
5432
|
-
results: (
|
|
5669
|
+
results: (_f = (_e = value.item.results) == null ? void 0 : _e.map((result) => ({
|
|
5433
5670
|
attributes: result.attributes,
|
|
5434
5671
|
fileId: result.file_id,
|
|
5435
5672
|
filename: result.filename,
|
|
5436
5673
|
score: result.score,
|
|
5437
5674
|
text: result.text
|
|
5438
|
-
}))) != null ?
|
|
5675
|
+
}))) != null ? _f : null
|
|
5439
5676
|
}
|
|
5440
5677
|
});
|
|
5441
5678
|
} else if (value.item.type === "code_interpreter_call") {
|
|
@@ -5457,12 +5694,62 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5457
5694
|
result: value.item.result
|
|
5458
5695
|
}
|
|
5459
5696
|
});
|
|
5697
|
+
} else if (value.item.type === "tool_search_call") {
|
|
5698
|
+
const toolCall = ongoingToolCalls[value.output_index];
|
|
5699
|
+
const isHosted = value.item.execution === "server";
|
|
5700
|
+
if (toolCall != null) {
|
|
5701
|
+
const toolCallId = isHosted ? toolCall.toolCallId : (_g = value.item.call_id) != null ? _g : value.item.id;
|
|
5702
|
+
if (isHosted) {
|
|
5703
|
+
hostedToolSearchCallIds.push(toolCallId);
|
|
5704
|
+
} else {
|
|
5705
|
+
controller.enqueue({
|
|
5706
|
+
type: "tool-input-start",
|
|
5707
|
+
id: toolCallId,
|
|
5708
|
+
toolName: toolCall.toolName
|
|
5709
|
+
});
|
|
5710
|
+
}
|
|
5711
|
+
controller.enqueue({
|
|
5712
|
+
type: "tool-input-end",
|
|
5713
|
+
id: toolCallId
|
|
5714
|
+
});
|
|
5715
|
+
controller.enqueue({
|
|
5716
|
+
type: "tool-call",
|
|
5717
|
+
toolCallId,
|
|
5718
|
+
toolName: toolCall.toolName,
|
|
5719
|
+
input: JSON.stringify({
|
|
5720
|
+
arguments: value.item.arguments,
|
|
5721
|
+
call_id: isHosted ? null : toolCallId
|
|
5722
|
+
}),
|
|
5723
|
+
...isHosted ? { providerExecuted: true } : {},
|
|
5724
|
+
providerMetadata: {
|
|
5725
|
+
[providerOptionsName]: {
|
|
5726
|
+
itemId: value.item.id
|
|
5727
|
+
}
|
|
5728
|
+
}
|
|
5729
|
+
});
|
|
5730
|
+
}
|
|
5731
|
+
ongoingToolCalls[value.output_index] = void 0;
|
|
5732
|
+
} else if (value.item.type === "tool_search_output") {
|
|
5733
|
+
const toolCallId = (_i = (_h = value.item.call_id) != null ? _h : hostedToolSearchCallIds.shift()) != null ? _i : value.item.id;
|
|
5734
|
+
controller.enqueue({
|
|
5735
|
+
type: "tool-result",
|
|
5736
|
+
toolCallId,
|
|
5737
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
5738
|
+
result: {
|
|
5739
|
+
tools: value.item.tools
|
|
5740
|
+
},
|
|
5741
|
+
providerMetadata: {
|
|
5742
|
+
[providerOptionsName]: {
|
|
5743
|
+
itemId: value.item.id
|
|
5744
|
+
}
|
|
5745
|
+
}
|
|
5746
|
+
});
|
|
5460
5747
|
} else if (value.item.type === "mcp_call") {
|
|
5461
5748
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5462
|
-
const approvalRequestId = (
|
|
5463
|
-
const aliasedToolCallId = approvalRequestId != null ? (
|
|
5749
|
+
const approvalRequestId = (_j = value.item.approval_request_id) != null ? _j : void 0;
|
|
5750
|
+
const aliasedToolCallId = approvalRequestId != null ? (_l = (_k = approvalRequestIdToDummyToolCallIdFromStream.get(
|
|
5464
5751
|
approvalRequestId
|
|
5465
|
-
)) != null ?
|
|
5752
|
+
)) != null ? _k : approvalRequestIdToDummyToolCallIdFromPrompt[approvalRequestId]) != null ? _l : value.item.id : value.item.id;
|
|
5466
5753
|
const toolName = `mcp.${value.item.name}`;
|
|
5467
5754
|
controller.enqueue({
|
|
5468
5755
|
type: "tool-call",
|
|
@@ -5532,8 +5819,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5532
5819
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5533
5820
|
} else if (value.item.type === "mcp_approval_request") {
|
|
5534
5821
|
ongoingToolCalls[value.output_index] = void 0;
|
|
5535
|
-
const dummyToolCallId = (
|
|
5536
|
-
const approvalRequestId = (
|
|
5822
|
+
const dummyToolCallId = (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils29.generateId)();
|
|
5823
|
+
const approvalRequestId = (_p = value.item.approval_request_id) != null ? _p : value.item.id;
|
|
5537
5824
|
approvalRequestIdToDummyToolCallIdFromStream.set(
|
|
5538
5825
|
approvalRequestId,
|
|
5539
5826
|
dummyToolCallId
|
|
@@ -5622,7 +5909,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5622
5909
|
providerMetadata: {
|
|
5623
5910
|
[providerOptionsName]: {
|
|
5624
5911
|
itemId: value.item.id,
|
|
5625
|
-
reasoningEncryptedContent: (
|
|
5912
|
+
reasoningEncryptedContent: (_q = value.item.encrypted_content) != null ? _q : null
|
|
5626
5913
|
}
|
|
5627
5914
|
}
|
|
5628
5915
|
});
|
|
@@ -5735,7 +6022,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5735
6022
|
id: value.item_id,
|
|
5736
6023
|
delta: value.delta
|
|
5737
6024
|
});
|
|
5738
|
-
if (((
|
|
6025
|
+
if (((_s = (_r = options.providerOptions) == null ? void 0 : _r[providerOptionsName]) == null ? void 0 : _s.logprobs) && value.logprobs) {
|
|
5739
6026
|
logprobs.push(value.logprobs);
|
|
5740
6027
|
}
|
|
5741
6028
|
} else if (value.type === "response.reasoning_summary_part.added") {
|
|
@@ -5764,7 +6051,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5764
6051
|
providerMetadata: {
|
|
5765
6052
|
[providerOptionsName]: {
|
|
5766
6053
|
itemId: value.item_id,
|
|
5767
|
-
reasoningEncryptedContent: (
|
|
6054
|
+
reasoningEncryptedContent: (_u = (_t = activeReasoning[value.item_id]) == null ? void 0 : _t.encryptedContent) != null ? _u : null
|
|
5768
6055
|
}
|
|
5769
6056
|
}
|
|
5770
6057
|
});
|
|
@@ -5798,10 +6085,10 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5798
6085
|
} else if (isResponseFinishedChunk(value)) {
|
|
5799
6086
|
finishReason = {
|
|
5800
6087
|
unified: mapOpenAIResponseFinishReason({
|
|
5801
|
-
finishReason: (
|
|
6088
|
+
finishReason: (_v = value.response.incomplete_details) == null ? void 0 : _v.reason,
|
|
5802
6089
|
hasFunctionCall
|
|
5803
6090
|
}),
|
|
5804
|
-
raw: (
|
|
6091
|
+
raw: (_x = (_w = value.response.incomplete_details) == null ? void 0 : _w.reason) != null ? _x : void 0
|
|
5805
6092
|
};
|
|
5806
6093
|
usage = value.response.usage;
|
|
5807
6094
|
if (typeof value.response.service_tier === "string") {
|
|
@@ -5813,7 +6100,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5813
6100
|
controller.enqueue({
|
|
5814
6101
|
type: "source",
|
|
5815
6102
|
sourceType: "url",
|
|
5816
|
-
id: (
|
|
6103
|
+
id: (_A = (_z = (_y = self.config).generateId) == null ? void 0 : _z.call(_y)) != null ? _A : (0, import_provider_utils29.generateId)(),
|
|
5817
6104
|
url: value.annotation.url,
|
|
5818
6105
|
title: value.annotation.title
|
|
5819
6106
|
});
|
|
@@ -5821,7 +6108,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5821
6108
|
controller.enqueue({
|
|
5822
6109
|
type: "source",
|
|
5823
6110
|
sourceType: "document",
|
|
5824
|
-
id: (
|
|
6111
|
+
id: (_D = (_C = (_B = self.config).generateId) == null ? void 0 : _C.call(_B)) != null ? _D : (0, import_provider_utils29.generateId)(),
|
|
5825
6112
|
mediaType: "text/plain",
|
|
5826
6113
|
title: value.annotation.filename,
|
|
5827
6114
|
filename: value.annotation.filename,
|
|
@@ -5837,7 +6124,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5837
6124
|
controller.enqueue({
|
|
5838
6125
|
type: "source",
|
|
5839
6126
|
sourceType: "document",
|
|
5840
|
-
id: (
|
|
6127
|
+
id: (_G = (_F = (_E = self.config).generateId) == null ? void 0 : _F.call(_E)) != null ? _G : (0, import_provider_utils29.generateId)(),
|
|
5841
6128
|
mediaType: "text/plain",
|
|
5842
6129
|
title: value.annotation.filename,
|
|
5843
6130
|
filename: value.annotation.filename,
|
|
@@ -5853,7 +6140,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
5853
6140
|
controller.enqueue({
|
|
5854
6141
|
type: "source",
|
|
5855
6142
|
sourceType: "document",
|
|
5856
|
-
id: (
|
|
6143
|
+
id: (_J = (_I = (_H = self.config).generateId) == null ? void 0 : _I.call(_H)) != null ? _J : (0, import_provider_utils29.generateId)(),
|
|
5857
6144
|
mediaType: "application/octet-stream",
|
|
5858
6145
|
title: value.annotation.file_id,
|
|
5859
6146
|
filename: value.annotation.file_id,
|
|
@@ -5963,16 +6250,16 @@ function escapeJSONDelta(delta) {
|
|
|
5963
6250
|
}
|
|
5964
6251
|
|
|
5965
6252
|
// src/speech/openai-speech-model.ts
|
|
5966
|
-
var
|
|
6253
|
+
var import_provider_utils31 = require("@ai-sdk/provider-utils");
|
|
5967
6254
|
|
|
5968
6255
|
// src/speech/openai-speech-options.ts
|
|
5969
|
-
var
|
|
5970
|
-
var
|
|
5971
|
-
var openaiSpeechModelOptionsSchema = (0,
|
|
5972
|
-
() => (0,
|
|
5973
|
-
|
|
5974
|
-
instructions:
|
|
5975
|
-
speed:
|
|
6256
|
+
var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
6257
|
+
var import_v423 = require("zod/v4");
|
|
6258
|
+
var openaiSpeechModelOptionsSchema = (0, import_provider_utils30.lazySchema)(
|
|
6259
|
+
() => (0, import_provider_utils30.zodSchema)(
|
|
6260
|
+
import_v423.z.object({
|
|
6261
|
+
instructions: import_v423.z.string().nullish(),
|
|
6262
|
+
speed: import_v423.z.number().min(0.25).max(4).default(1).nullish()
|
|
5976
6263
|
})
|
|
5977
6264
|
)
|
|
5978
6265
|
);
|
|
@@ -5997,7 +6284,7 @@ var OpenAISpeechModel = class {
|
|
|
5997
6284
|
providerOptions
|
|
5998
6285
|
}) {
|
|
5999
6286
|
const warnings = [];
|
|
6000
|
-
const openAIOptions = await (0,
|
|
6287
|
+
const openAIOptions = await (0, import_provider_utils31.parseProviderOptions)({
|
|
6001
6288
|
provider: "openai",
|
|
6002
6289
|
providerOptions,
|
|
6003
6290
|
schema: openaiSpeechModelOptionsSchema
|
|
@@ -6050,15 +6337,15 @@ var OpenAISpeechModel = class {
|
|
|
6050
6337
|
value: audio,
|
|
6051
6338
|
responseHeaders,
|
|
6052
6339
|
rawValue: rawResponse
|
|
6053
|
-
} = await (0,
|
|
6340
|
+
} = await (0, import_provider_utils31.postJsonToApi)({
|
|
6054
6341
|
url: this.config.url({
|
|
6055
6342
|
path: "/audio/speech",
|
|
6056
6343
|
modelId: this.modelId
|
|
6057
6344
|
}),
|
|
6058
|
-
headers: (0,
|
|
6345
|
+
headers: (0, import_provider_utils31.combineHeaders)(this.config.headers(), options.headers),
|
|
6059
6346
|
body: requestBody,
|
|
6060
6347
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6061
|
-
successfulResponseHandler: (0,
|
|
6348
|
+
successfulResponseHandler: (0, import_provider_utils31.createBinaryResponseHandler)(),
|
|
6062
6349
|
abortSignal: options.abortSignal,
|
|
6063
6350
|
fetch: this.config.fetch
|
|
6064
6351
|
});
|
|
@@ -6079,36 +6366,36 @@ var OpenAISpeechModel = class {
|
|
|
6079
6366
|
};
|
|
6080
6367
|
|
|
6081
6368
|
// src/transcription/openai-transcription-model.ts
|
|
6082
|
-
var
|
|
6369
|
+
var import_provider_utils34 = require("@ai-sdk/provider-utils");
|
|
6083
6370
|
|
|
6084
6371
|
// src/transcription/openai-transcription-api.ts
|
|
6085
|
-
var
|
|
6086
|
-
var
|
|
6087
|
-
var openaiTranscriptionResponseSchema = (0,
|
|
6088
|
-
() => (0,
|
|
6089
|
-
|
|
6090
|
-
text:
|
|
6091
|
-
language:
|
|
6092
|
-
duration:
|
|
6093
|
-
words:
|
|
6094
|
-
|
|
6095
|
-
word:
|
|
6096
|
-
start:
|
|
6097
|
-
end:
|
|
6372
|
+
var import_provider_utils32 = require("@ai-sdk/provider-utils");
|
|
6373
|
+
var import_v424 = require("zod/v4");
|
|
6374
|
+
var openaiTranscriptionResponseSchema = (0, import_provider_utils32.lazySchema)(
|
|
6375
|
+
() => (0, import_provider_utils32.zodSchema)(
|
|
6376
|
+
import_v424.z.object({
|
|
6377
|
+
text: import_v424.z.string(),
|
|
6378
|
+
language: import_v424.z.string().nullish(),
|
|
6379
|
+
duration: import_v424.z.number().nullish(),
|
|
6380
|
+
words: import_v424.z.array(
|
|
6381
|
+
import_v424.z.object({
|
|
6382
|
+
word: import_v424.z.string(),
|
|
6383
|
+
start: import_v424.z.number(),
|
|
6384
|
+
end: import_v424.z.number()
|
|
6098
6385
|
})
|
|
6099
6386
|
).nullish(),
|
|
6100
|
-
segments:
|
|
6101
|
-
|
|
6102
|
-
id:
|
|
6103
|
-
seek:
|
|
6104
|
-
start:
|
|
6105
|
-
end:
|
|
6106
|
-
text:
|
|
6107
|
-
tokens:
|
|
6108
|
-
temperature:
|
|
6109
|
-
avg_logprob:
|
|
6110
|
-
compression_ratio:
|
|
6111
|
-
no_speech_prob:
|
|
6387
|
+
segments: import_v424.z.array(
|
|
6388
|
+
import_v424.z.object({
|
|
6389
|
+
id: import_v424.z.number(),
|
|
6390
|
+
seek: import_v424.z.number(),
|
|
6391
|
+
start: import_v424.z.number(),
|
|
6392
|
+
end: import_v424.z.number(),
|
|
6393
|
+
text: import_v424.z.string(),
|
|
6394
|
+
tokens: import_v424.z.array(import_v424.z.number()),
|
|
6395
|
+
temperature: import_v424.z.number(),
|
|
6396
|
+
avg_logprob: import_v424.z.number(),
|
|
6397
|
+
compression_ratio: import_v424.z.number(),
|
|
6398
|
+
no_speech_prob: import_v424.z.number()
|
|
6112
6399
|
})
|
|
6113
6400
|
).nullish()
|
|
6114
6401
|
})
|
|
@@ -6116,33 +6403,33 @@ var openaiTranscriptionResponseSchema = (0, import_provider_utils31.lazySchema)(
|
|
|
6116
6403
|
);
|
|
6117
6404
|
|
|
6118
6405
|
// src/transcription/openai-transcription-options.ts
|
|
6119
|
-
var
|
|
6120
|
-
var
|
|
6121
|
-
var openAITranscriptionModelOptions = (0,
|
|
6122
|
-
() => (0,
|
|
6123
|
-
|
|
6406
|
+
var import_provider_utils33 = require("@ai-sdk/provider-utils");
|
|
6407
|
+
var import_v425 = require("zod/v4");
|
|
6408
|
+
var openAITranscriptionModelOptions = (0, import_provider_utils33.lazySchema)(
|
|
6409
|
+
() => (0, import_provider_utils33.zodSchema)(
|
|
6410
|
+
import_v425.z.object({
|
|
6124
6411
|
/**
|
|
6125
6412
|
* Additional information to include in the transcription response.
|
|
6126
6413
|
*/
|
|
6127
|
-
include:
|
|
6414
|
+
include: import_v425.z.array(import_v425.z.string()).optional(),
|
|
6128
6415
|
/**
|
|
6129
6416
|
* The language of the input audio in ISO-639-1 format.
|
|
6130
6417
|
*/
|
|
6131
|
-
language:
|
|
6418
|
+
language: import_v425.z.string().optional(),
|
|
6132
6419
|
/**
|
|
6133
6420
|
* An optional text to guide the model's style or continue a previous audio segment.
|
|
6134
6421
|
*/
|
|
6135
|
-
prompt:
|
|
6422
|
+
prompt: import_v425.z.string().optional(),
|
|
6136
6423
|
/**
|
|
6137
6424
|
* The sampling temperature, between 0 and 1.
|
|
6138
6425
|
* @default 0
|
|
6139
6426
|
*/
|
|
6140
|
-
temperature:
|
|
6427
|
+
temperature: import_v425.z.number().min(0).max(1).default(0).optional(),
|
|
6141
6428
|
/**
|
|
6142
6429
|
* The timestamp granularities to populate for this transcription.
|
|
6143
6430
|
* @default ['segment']
|
|
6144
6431
|
*/
|
|
6145
|
-
timestampGranularities:
|
|
6432
|
+
timestampGranularities: import_v425.z.array(import_v425.z.enum(["word", "segment"])).default(["segment"]).optional()
|
|
6146
6433
|
})
|
|
6147
6434
|
)
|
|
6148
6435
|
);
|
|
@@ -6222,15 +6509,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6222
6509
|
providerOptions
|
|
6223
6510
|
}) {
|
|
6224
6511
|
const warnings = [];
|
|
6225
|
-
const openAIOptions = await (0,
|
|
6512
|
+
const openAIOptions = await (0, import_provider_utils34.parseProviderOptions)({
|
|
6226
6513
|
provider: "openai",
|
|
6227
6514
|
providerOptions,
|
|
6228
6515
|
schema: openAITranscriptionModelOptions
|
|
6229
6516
|
});
|
|
6230
6517
|
const formData = new FormData();
|
|
6231
|
-
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0,
|
|
6518
|
+
const blob = audio instanceof Uint8Array ? new Blob([audio]) : new Blob([(0, import_provider_utils34.convertBase64ToUint8Array)(audio)]);
|
|
6232
6519
|
formData.append("model", this.modelId);
|
|
6233
|
-
const fileExtension = (0,
|
|
6520
|
+
const fileExtension = (0, import_provider_utils34.mediaTypeToExtension)(mediaType);
|
|
6234
6521
|
formData.append(
|
|
6235
6522
|
"file",
|
|
6236
6523
|
new File([blob], "audio", { type: mediaType }),
|
|
@@ -6275,15 +6562,15 @@ var OpenAITranscriptionModel = class {
|
|
|
6275
6562
|
value: response,
|
|
6276
6563
|
responseHeaders,
|
|
6277
6564
|
rawValue: rawResponse
|
|
6278
|
-
} = await (0,
|
|
6565
|
+
} = await (0, import_provider_utils34.postFormDataToApi)({
|
|
6279
6566
|
url: this.config.url({
|
|
6280
6567
|
path: "/audio/transcriptions",
|
|
6281
6568
|
modelId: this.modelId
|
|
6282
6569
|
}),
|
|
6283
|
-
headers: (0,
|
|
6570
|
+
headers: (0, import_provider_utils34.combineHeaders)(this.config.headers(), options.headers),
|
|
6284
6571
|
formData,
|
|
6285
6572
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
6286
|
-
successfulResponseHandler: (0,
|
|
6573
|
+
successfulResponseHandler: (0, import_provider_utils34.createJsonResponseHandler)(
|
|
6287
6574
|
openaiTranscriptionResponseSchema
|
|
6288
6575
|
),
|
|
6289
6576
|
abortSignal: options.abortSignal,
|
|
@@ -6315,21 +6602,21 @@ var OpenAITranscriptionModel = class {
|
|
|
6315
6602
|
};
|
|
6316
6603
|
|
|
6317
6604
|
// src/version.ts
|
|
6318
|
-
var VERSION = true ? "3.0.
|
|
6605
|
+
var VERSION = true ? "3.0.47" : "0.0.0-test";
|
|
6319
6606
|
|
|
6320
6607
|
// src/openai-provider.ts
|
|
6321
6608
|
function createOpenAI(options = {}) {
|
|
6322
6609
|
var _a, _b;
|
|
6323
|
-
const baseURL = (_a = (0,
|
|
6324
|
-
(0,
|
|
6610
|
+
const baseURL = (_a = (0, import_provider_utils35.withoutTrailingSlash)(
|
|
6611
|
+
(0, import_provider_utils35.loadOptionalSetting)({
|
|
6325
6612
|
settingValue: options.baseURL,
|
|
6326
6613
|
environmentVariableName: "OPENAI_BASE_URL"
|
|
6327
6614
|
})
|
|
6328
6615
|
)) != null ? _a : "https://api.openai.com/v1";
|
|
6329
6616
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
6330
|
-
const getHeaders = () => (0,
|
|
6617
|
+
const getHeaders = () => (0, import_provider_utils35.withUserAgentSuffix)(
|
|
6331
6618
|
{
|
|
6332
|
-
Authorization: `Bearer ${(0,
|
|
6619
|
+
Authorization: `Bearer ${(0, import_provider_utils35.loadApiKey)({
|
|
6333
6620
|
apiKey: options.apiKey,
|
|
6334
6621
|
environmentVariableName: "OPENAI_API_KEY",
|
|
6335
6622
|
description: "OpenAI"
|