@ai-sdk/openai 2.0.129 → 2.0.130
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 +6 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +647 -574
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +647 -573
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +658 -587
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +657 -585
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal/index.js
CHANGED
|
@@ -2401,30 +2401,231 @@ var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
|
2401
2401
|
|
|
2402
2402
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2403
2403
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2404
|
-
var
|
|
2405
|
-
var
|
|
2404
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2405
|
+
var import_v415 = require("zod/v4");
|
|
2406
2406
|
|
|
2407
|
-
// src/
|
|
2407
|
+
// src/responses/openai-responses-options.ts
|
|
2408
2408
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2409
2409
|
var import_v413 = require("zod/v4");
|
|
2410
|
-
var
|
|
2410
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
2411
|
+
var openaiResponsesReasoningModelIds = [
|
|
2412
|
+
"o1",
|
|
2413
|
+
"o1-2024-12-17",
|
|
2414
|
+
"o3",
|
|
2415
|
+
"o3-2025-04-16",
|
|
2416
|
+
"o3-deep-research",
|
|
2417
|
+
"o3-deep-research-2025-06-26",
|
|
2418
|
+
"o3-mini",
|
|
2419
|
+
"o3-mini-2025-01-31",
|
|
2420
|
+
"o4-mini",
|
|
2421
|
+
"o4-mini-2025-04-16",
|
|
2422
|
+
"o4-mini-deep-research",
|
|
2423
|
+
"o4-mini-deep-research-2025-06-26",
|
|
2424
|
+
"codex-mini-latest",
|
|
2425
|
+
"computer-use-preview",
|
|
2426
|
+
"gpt-5",
|
|
2427
|
+
"gpt-5-2025-08-07",
|
|
2428
|
+
"gpt-5-codex",
|
|
2429
|
+
"gpt-5-mini",
|
|
2430
|
+
"gpt-5-mini-2025-08-07",
|
|
2431
|
+
"gpt-5-nano",
|
|
2432
|
+
"gpt-5-nano-2025-08-07",
|
|
2433
|
+
"gpt-5-pro",
|
|
2434
|
+
"gpt-5-pro-2025-10-06",
|
|
2435
|
+
"gpt-5.1",
|
|
2436
|
+
"gpt-5.1-chat-latest",
|
|
2437
|
+
"gpt-5.1-codex-mini",
|
|
2438
|
+
"gpt-5.1-codex",
|
|
2439
|
+
"gpt-5.1-codex-max",
|
|
2440
|
+
"gpt-5.2",
|
|
2441
|
+
"gpt-5.2-chat-latest",
|
|
2442
|
+
"gpt-5.2-pro",
|
|
2443
|
+
"gpt-5.2-codex",
|
|
2444
|
+
"gpt-5.3-chat-latest",
|
|
2445
|
+
"gpt-5.3-codex",
|
|
2446
|
+
"gpt-5.4",
|
|
2447
|
+
"gpt-5.4-2026-03-05",
|
|
2448
|
+
"gpt-5.4-mini",
|
|
2449
|
+
"gpt-5.4-mini-2026-03-17",
|
|
2450
|
+
"gpt-5.4-nano",
|
|
2451
|
+
"gpt-5.4-nano-2026-03-17",
|
|
2452
|
+
"gpt-5.4-pro",
|
|
2453
|
+
"gpt-5.4-pro-2026-03-05",
|
|
2454
|
+
"gpt-5.6",
|
|
2455
|
+
"gpt-5.6-luna",
|
|
2456
|
+
"gpt-5.6-sol",
|
|
2457
|
+
"gpt-5.6-terra",
|
|
2458
|
+
"gpt-6-astra",
|
|
2459
|
+
"gpt-6-luna",
|
|
2460
|
+
"gpt-6-sol"
|
|
2461
|
+
];
|
|
2462
|
+
var openaiResponsesModelIds = [
|
|
2463
|
+
"gpt-4.1",
|
|
2464
|
+
"gpt-4.1-2025-04-14",
|
|
2465
|
+
"gpt-4.1-mini",
|
|
2466
|
+
"gpt-4.1-mini-2025-04-14",
|
|
2467
|
+
"gpt-4.1-nano",
|
|
2468
|
+
"gpt-4.1-nano-2025-04-14",
|
|
2469
|
+
"gpt-4o",
|
|
2470
|
+
"gpt-4o-2024-05-13",
|
|
2471
|
+
"gpt-4o-2024-08-06",
|
|
2472
|
+
"gpt-4o-2024-11-20",
|
|
2473
|
+
"gpt-4o-audio-preview",
|
|
2474
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
2475
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
2476
|
+
"gpt-4o-search-preview",
|
|
2477
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
2478
|
+
"gpt-4o-mini-search-preview",
|
|
2479
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
2480
|
+
"gpt-4o-mini",
|
|
2481
|
+
"gpt-4o-mini-2024-07-18",
|
|
2482
|
+
"gpt-4-turbo",
|
|
2483
|
+
"gpt-4-turbo-2024-04-09",
|
|
2484
|
+
"gpt-4-turbo-preview",
|
|
2485
|
+
"gpt-4-0125-preview",
|
|
2486
|
+
"gpt-4-1106-preview",
|
|
2487
|
+
"gpt-4",
|
|
2488
|
+
"gpt-4-0613",
|
|
2489
|
+
"gpt-4.5-preview",
|
|
2490
|
+
"gpt-4.5-preview-2025-02-27",
|
|
2491
|
+
"gpt-3.5-turbo-0125",
|
|
2492
|
+
"gpt-3.5-turbo",
|
|
2493
|
+
"gpt-3.5-turbo-1106",
|
|
2494
|
+
"chatgpt-4o-latest",
|
|
2495
|
+
"gpt-5-chat-latest",
|
|
2496
|
+
...openaiResponsesReasoningModelIds
|
|
2497
|
+
];
|
|
2498
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils20.lazyValidator)(
|
|
2411
2499
|
() => (0, import_provider_utils20.zodSchema)(
|
|
2412
2500
|
import_v413.z.object({
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2501
|
+
conversation: import_v413.z.string().nullish(),
|
|
2502
|
+
include: import_v413.z.array(
|
|
2503
|
+
import_v413.z.enum([
|
|
2504
|
+
"reasoning.encrypted_content",
|
|
2505
|
+
// handled internally by default, only needed for unknown reasoning models
|
|
2506
|
+
"file_search_call.results",
|
|
2507
|
+
"message.output_text.logprobs"
|
|
2508
|
+
])
|
|
2509
|
+
).nullish(),
|
|
2510
|
+
instructions: import_v413.z.string().nullish(),
|
|
2511
|
+
/**
|
|
2512
|
+
* Return the log probabilities of the tokens.
|
|
2513
|
+
*
|
|
2514
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
2515
|
+
* were generated.
|
|
2516
|
+
*
|
|
2517
|
+
* Setting to a number will return the log probabilities of the top n
|
|
2518
|
+
* tokens that were generated.
|
|
2519
|
+
*
|
|
2520
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2521
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2522
|
+
*/
|
|
2523
|
+
logprobs: import_v413.z.union([import_v413.z.boolean(), import_v413.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2524
|
+
/**
|
|
2525
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2526
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2527
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
2528
|
+
*/
|
|
2529
|
+
maxToolCalls: import_v413.z.number().nullish(),
|
|
2530
|
+
metadata: import_v413.z.any().nullish(),
|
|
2531
|
+
parallelToolCalls: import_v413.z.boolean().nullish(),
|
|
2532
|
+
previousResponseId: import_v413.z.string().nullish(),
|
|
2533
|
+
promptCacheKey: import_v413.z.string().nullish(),
|
|
2534
|
+
/**
|
|
2535
|
+
* Prompt cache behavior for GPT-5.6 and later models.
|
|
2536
|
+
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
2537
|
+
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
2538
|
+
*/
|
|
2539
|
+
promptCacheOptions: import_v413.z.object({
|
|
2540
|
+
mode: import_v413.z.enum(["implicit", "explicit"]).optional(),
|
|
2541
|
+
ttl: import_v413.z.literal("30m").optional()
|
|
2542
|
+
}).optional(),
|
|
2543
|
+
/**
|
|
2544
|
+
* The retention policy for the prompt cache.
|
|
2545
|
+
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
2546
|
+
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
2547
|
+
* Available for models before GPT-5.6 that support extended caching.
|
|
2548
|
+
*
|
|
2549
|
+
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
2550
|
+
*
|
|
2551
|
+
* @default 'in_memory'
|
|
2552
|
+
*/
|
|
2553
|
+
promptCacheRetention: import_v413.z.enum(["in_memory", "24h"]).nullish(),
|
|
2554
|
+
/**
|
|
2555
|
+
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
2556
|
+
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
2557
|
+
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
2558
|
+
* Supported values vary by model.
|
|
2559
|
+
*/
|
|
2560
|
+
reasoningEffort: import_v413.z.string().nullish(),
|
|
2561
|
+
/**
|
|
2562
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
2563
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
2564
|
+
* request prefix for prompt caching.
|
|
2565
|
+
*
|
|
2566
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
2567
|
+
* combined with automatic truncation.
|
|
2568
|
+
*/
|
|
2569
|
+
reasoningEffortUpdate: import_v413.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
2570
|
+
/**
|
|
2571
|
+
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
2572
|
+
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
2573
|
+
*/
|
|
2574
|
+
reasoningMode: import_v413.z.enum(["standard", "pro"]).optional(),
|
|
2575
|
+
/**
|
|
2576
|
+
* Controls which available reasoning items GPT-5.6 can use.
|
|
2577
|
+
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
2578
|
+
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
2579
|
+
*/
|
|
2580
|
+
reasoningContext: import_v413.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
2581
|
+
reasoningSummary: import_v413.z.string().nullish(),
|
|
2582
|
+
safetyIdentifier: import_v413.z.string().nullish(),
|
|
2583
|
+
serviceTier: import_v413.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
2584
|
+
store: import_v413.z.boolean().nullish(),
|
|
2585
|
+
strictJsonSchema: import_v413.z.boolean().nullish(),
|
|
2586
|
+
textVerbosity: import_v413.z.enum(["low", "medium", "high"]).nullish(),
|
|
2587
|
+
truncation: import_v413.z.enum(["auto", "disabled"]).nullish(),
|
|
2588
|
+
user: import_v413.z.string().nullish()
|
|
2589
|
+
})
|
|
2590
|
+
)
|
|
2591
|
+
);
|
|
2592
|
+
var openaiResponsesSystemMessageOptionsSchema = (0, import_provider_utils20.lazyValidator)(
|
|
2593
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2594
|
+
import_v413.z.object({
|
|
2595
|
+
/**
|
|
2596
|
+
* Emit a configuration update at this position in Responses history.
|
|
2597
|
+
* Requires empty system message content and the same supported
|
|
2598
|
+
* configuration as the request-level reasoningEffortUpdate option.
|
|
2599
|
+
* Unsupported historical updates throw instead of being omitted.
|
|
2600
|
+
*
|
|
2601
|
+
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
2602
|
+
*/
|
|
2603
|
+
reasoningEffortUpdate: import_v413.z.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
2604
|
+
})
|
|
2605
|
+
)
|
|
2606
|
+
);
|
|
2607
|
+
|
|
2608
|
+
// src/tool/local-shell.ts
|
|
2609
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2610
|
+
var import_v414 = require("zod/v4");
|
|
2611
|
+
var localShellInputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2612
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2613
|
+
import_v414.z.object({
|
|
2614
|
+
action: import_v414.z.object({
|
|
2615
|
+
type: import_v414.z.literal("exec"),
|
|
2616
|
+
command: import_v414.z.array(import_v414.z.string()),
|
|
2617
|
+
timeoutMs: import_v414.z.number().optional(),
|
|
2618
|
+
user: import_v414.z.string().optional(),
|
|
2619
|
+
workingDirectory: import_v414.z.string().optional(),
|
|
2620
|
+
env: import_v414.z.record(import_v414.z.string(), import_v414.z.string()).optional()
|
|
2420
2621
|
})
|
|
2421
2622
|
})
|
|
2422
2623
|
)
|
|
2423
2624
|
);
|
|
2424
|
-
var localShellOutputSchema = (0,
|
|
2425
|
-
() => (0,
|
|
2625
|
+
var localShellOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2626
|
+
() => (0, import_provider_utils21.zodSchema)(import_v414.z.object({ output: import_v414.z.string() }))
|
|
2426
2627
|
);
|
|
2427
|
-
var localShell = (0,
|
|
2628
|
+
var localShell = (0, import_provider_utils21.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2428
2629
|
id: "openai.local_shell",
|
|
2429
2630
|
name: "local_shell",
|
|
2430
2631
|
inputSchema: localShellInputSchema,
|
|
@@ -2443,9 +2644,11 @@ function isFileId(data, prefixes) {
|
|
|
2443
2644
|
async function convertToOpenAIResponsesInput({
|
|
2444
2645
|
prompt,
|
|
2445
2646
|
systemMessageMode,
|
|
2647
|
+
providerOptionsName = "openai",
|
|
2446
2648
|
explicitMessageItemType = false,
|
|
2447
2649
|
fileIdPrefixes,
|
|
2448
2650
|
store,
|
|
2651
|
+
configurationUpdateUnsupportedReason,
|
|
2449
2652
|
hasLocalShellTool = false
|
|
2450
2653
|
}) {
|
|
2451
2654
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -2454,6 +2657,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
2454
2657
|
for (const { role, content, providerOptions } of prompt) {
|
|
2455
2658
|
switch (role) {
|
|
2456
2659
|
case "system": {
|
|
2660
|
+
let options = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2661
|
+
provider: providerOptionsName,
|
|
2662
|
+
providerOptions,
|
|
2663
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2664
|
+
});
|
|
2665
|
+
if (options == null && providerOptionsName !== "openai") {
|
|
2666
|
+
options = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2667
|
+
provider: "openai",
|
|
2668
|
+
providerOptions,
|
|
2669
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2670
|
+
});
|
|
2671
|
+
}
|
|
2672
|
+
const effort = options == null ? void 0 : options.reasoningEffortUpdate;
|
|
2673
|
+
if (effort != null) {
|
|
2674
|
+
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
2675
|
+
if (unsupportedReason != null) {
|
|
2676
|
+
throw new import_provider6.UnsupportedFunctionalityError({
|
|
2677
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
2678
|
+
message: unsupportedReason
|
|
2679
|
+
});
|
|
2680
|
+
}
|
|
2681
|
+
input.push({
|
|
2682
|
+
type: "configuration_update",
|
|
2683
|
+
reasoning: { effort }
|
|
2684
|
+
});
|
|
2685
|
+
break;
|
|
2686
|
+
}
|
|
2457
2687
|
switch (systemMessageMode) {
|
|
2458
2688
|
case "system": {
|
|
2459
2689
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
|
|
@@ -2529,7 +2759,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2529
2759
|
return {
|
|
2530
2760
|
type: "input_image",
|
|
2531
2761
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2532
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2762
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2533
2763
|
},
|
|
2534
2764
|
detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3.openai) == null ? void 0 : _b2.imageDetail,
|
|
2535
2765
|
...promptCacheBreakpoint != null && {
|
|
@@ -2550,7 +2780,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2550
2780
|
type: "input_file",
|
|
2551
2781
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2552
2782
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2553
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2783
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2554
2784
|
},
|
|
2555
2785
|
...promptCacheBreakpoint != null && {
|
|
2556
2786
|
prompt_cache_breakpoint: promptCacheBreakpoint
|
|
@@ -2600,7 +2830,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2600
2830
|
break;
|
|
2601
2831
|
}
|
|
2602
2832
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2603
|
-
const parsedInput = await (0,
|
|
2833
|
+
const parsedInput = await (0, import_provider_utils22.validateTypes)({
|
|
2604
2834
|
value: part.input,
|
|
2605
2835
|
schema: localShellInputSchema
|
|
2606
2836
|
});
|
|
@@ -2642,7 +2872,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2642
2872
|
break;
|
|
2643
2873
|
}
|
|
2644
2874
|
case "reasoning": {
|
|
2645
|
-
const providerOptions2 = await (0,
|
|
2875
|
+
const providerOptions2 = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2646
2876
|
provider: "openai",
|
|
2647
2877
|
providerOptions: part.providerOptions,
|
|
2648
2878
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2706,7 +2936,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2706
2936
|
part.providerOptions
|
|
2707
2937
|
);
|
|
2708
2938
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2709
|
-
const parsedOutput = await (0,
|
|
2939
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2710
2940
|
value: output.value,
|
|
2711
2941
|
schema: localShellOutputSchema
|
|
2712
2942
|
});
|
|
@@ -2799,9 +3029,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2799
3029
|
}
|
|
2800
3030
|
return { input, warnings };
|
|
2801
3031
|
}
|
|
2802
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2803
|
-
itemId:
|
|
2804
|
-
reasoningEncryptedContent:
|
|
3032
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
|
|
3033
|
+
itemId: import_v415.z.string().nullish(),
|
|
3034
|
+
reasoningEncryptedContent: import_v415.z.string().nullish()
|
|
2805
3035
|
});
|
|
2806
3036
|
|
|
2807
3037
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2823,288 +3053,288 @@ function mapOpenAIResponseFinishReason({
|
|
|
2823
3053
|
}
|
|
2824
3054
|
|
|
2825
3055
|
// src/responses/openai-responses-api.ts
|
|
2826
|
-
var
|
|
2827
|
-
var
|
|
2828
|
-
var openaiResponsesChunkSchema = (0,
|
|
2829
|
-
() => (0,
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
type:
|
|
2833
|
-
item_id:
|
|
2834
|
-
delta:
|
|
2835
|
-
logprobs:
|
|
2836
|
-
|
|
2837
|
-
token:
|
|
2838
|
-
logprob:
|
|
2839
|
-
top_logprobs:
|
|
2840
|
-
|
|
2841
|
-
token:
|
|
2842
|
-
logprob:
|
|
3056
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3057
|
+
var import_v416 = require("zod/v4");
|
|
3058
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3059
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3060
|
+
import_v416.z.union([
|
|
3061
|
+
import_v416.z.object({
|
|
3062
|
+
type: import_v416.z.literal("response.output_text.delta"),
|
|
3063
|
+
item_id: import_v416.z.string(),
|
|
3064
|
+
delta: import_v416.z.string(),
|
|
3065
|
+
logprobs: import_v416.z.array(
|
|
3066
|
+
import_v416.z.object({
|
|
3067
|
+
token: import_v416.z.string(),
|
|
3068
|
+
logprob: import_v416.z.number(),
|
|
3069
|
+
top_logprobs: import_v416.z.array(
|
|
3070
|
+
import_v416.z.object({
|
|
3071
|
+
token: import_v416.z.string(),
|
|
3072
|
+
logprob: import_v416.z.number()
|
|
2843
3073
|
})
|
|
2844
3074
|
)
|
|
2845
3075
|
})
|
|
2846
3076
|
).nullish()
|
|
2847
3077
|
}),
|
|
2848
|
-
|
|
2849
|
-
type:
|
|
2850
|
-
response:
|
|
2851
|
-
incomplete_details:
|
|
2852
|
-
usage:
|
|
2853
|
-
input_tokens:
|
|
2854
|
-
input_tokens_details:
|
|
2855
|
-
cached_tokens:
|
|
2856
|
-
cache_write_tokens:
|
|
2857
|
-
orchestration_input_tokens:
|
|
2858
|
-
orchestration_input_cached_tokens:
|
|
3078
|
+
import_v416.z.object({
|
|
3079
|
+
type: import_v416.z.enum(["response.completed", "response.incomplete"]),
|
|
3080
|
+
response: import_v416.z.object({
|
|
3081
|
+
incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
|
|
3082
|
+
usage: import_v416.z.object({
|
|
3083
|
+
input_tokens: import_v416.z.number(),
|
|
3084
|
+
input_tokens_details: import_v416.z.object({
|
|
3085
|
+
cached_tokens: import_v416.z.number().nullish(),
|
|
3086
|
+
cache_write_tokens: import_v416.z.number().nullish(),
|
|
3087
|
+
orchestration_input_tokens: import_v416.z.number().nullish(),
|
|
3088
|
+
orchestration_input_cached_tokens: import_v416.z.number().nullish()
|
|
2859
3089
|
}).nullish(),
|
|
2860
|
-
output_tokens:
|
|
2861
|
-
output_tokens_details:
|
|
2862
|
-
reasoning_tokens:
|
|
2863
|
-
orchestration_output_tokens:
|
|
3090
|
+
output_tokens: import_v416.z.number(),
|
|
3091
|
+
output_tokens_details: import_v416.z.object({
|
|
3092
|
+
reasoning_tokens: import_v416.z.number().nullish(),
|
|
3093
|
+
orchestration_output_tokens: import_v416.z.number().nullish()
|
|
2864
3094
|
}).nullish()
|
|
2865
3095
|
}),
|
|
2866
|
-
reasoning:
|
|
2867
|
-
context:
|
|
3096
|
+
reasoning: import_v416.z.object({
|
|
3097
|
+
context: import_v416.z.string().nullish()
|
|
2868
3098
|
}).nullish(),
|
|
2869
|
-
service_tier:
|
|
3099
|
+
service_tier: import_v416.z.string().nullish()
|
|
2870
3100
|
})
|
|
2871
3101
|
}),
|
|
2872
|
-
|
|
2873
|
-
type:
|
|
2874
|
-
response:
|
|
2875
|
-
id:
|
|
2876
|
-
created_at:
|
|
2877
|
-
model:
|
|
2878
|
-
service_tier:
|
|
3102
|
+
import_v416.z.object({
|
|
3103
|
+
type: import_v416.z.literal("response.created"),
|
|
3104
|
+
response: import_v416.z.object({
|
|
3105
|
+
id: import_v416.z.string(),
|
|
3106
|
+
created_at: import_v416.z.number(),
|
|
3107
|
+
model: import_v416.z.string(),
|
|
3108
|
+
service_tier: import_v416.z.string().nullish()
|
|
2879
3109
|
})
|
|
2880
3110
|
}),
|
|
2881
|
-
|
|
2882
|
-
type:
|
|
2883
|
-
output_index:
|
|
2884
|
-
item:
|
|
2885
|
-
|
|
2886
|
-
type:
|
|
2887
|
-
id:
|
|
2888
|
-
phase:
|
|
3111
|
+
import_v416.z.object({
|
|
3112
|
+
type: import_v416.z.literal("response.output_item.added"),
|
|
3113
|
+
output_index: import_v416.z.number(),
|
|
3114
|
+
item: import_v416.z.discriminatedUnion("type", [
|
|
3115
|
+
import_v416.z.object({
|
|
3116
|
+
type: import_v416.z.literal("message"),
|
|
3117
|
+
id: import_v416.z.string(),
|
|
3118
|
+
phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
|
|
2889
3119
|
}),
|
|
2890
|
-
|
|
2891
|
-
type:
|
|
2892
|
-
id:
|
|
2893
|
-
encrypted_content:
|
|
3120
|
+
import_v416.z.object({
|
|
3121
|
+
type: import_v416.z.literal("reasoning"),
|
|
3122
|
+
id: import_v416.z.string(),
|
|
3123
|
+
encrypted_content: import_v416.z.string().nullish()
|
|
2894
3124
|
}),
|
|
2895
|
-
|
|
2896
|
-
type:
|
|
2897
|
-
id:
|
|
2898
|
-
call_id:
|
|
2899
|
-
name:
|
|
2900
|
-
arguments:
|
|
2901
|
-
async:
|
|
3125
|
+
import_v416.z.object({
|
|
3126
|
+
type: import_v416.z.literal("function_call"),
|
|
3127
|
+
id: import_v416.z.string(),
|
|
3128
|
+
call_id: import_v416.z.string(),
|
|
3129
|
+
name: import_v416.z.string(),
|
|
3130
|
+
arguments: import_v416.z.string(),
|
|
3131
|
+
async: import_v416.z.boolean().nullish()
|
|
2902
3132
|
}),
|
|
2903
|
-
|
|
2904
|
-
type:
|
|
2905
|
-
id:
|
|
2906
|
-
status:
|
|
3133
|
+
import_v416.z.object({
|
|
3134
|
+
type: import_v416.z.literal("web_search_call"),
|
|
3135
|
+
id: import_v416.z.string(),
|
|
3136
|
+
status: import_v416.z.string()
|
|
2907
3137
|
}),
|
|
2908
|
-
|
|
2909
|
-
type:
|
|
2910
|
-
id:
|
|
2911
|
-
status:
|
|
3138
|
+
import_v416.z.object({
|
|
3139
|
+
type: import_v416.z.literal("computer_call"),
|
|
3140
|
+
id: import_v416.z.string(),
|
|
3141
|
+
status: import_v416.z.string()
|
|
2912
3142
|
}),
|
|
2913
|
-
|
|
2914
|
-
type:
|
|
2915
|
-
id:
|
|
3143
|
+
import_v416.z.object({
|
|
3144
|
+
type: import_v416.z.literal("file_search_call"),
|
|
3145
|
+
id: import_v416.z.string()
|
|
2916
3146
|
}),
|
|
2917
|
-
|
|
2918
|
-
type:
|
|
2919
|
-
id:
|
|
3147
|
+
import_v416.z.object({
|
|
3148
|
+
type: import_v416.z.literal("image_generation_call"),
|
|
3149
|
+
id: import_v416.z.string()
|
|
2920
3150
|
}),
|
|
2921
|
-
|
|
2922
|
-
type:
|
|
2923
|
-
id:
|
|
2924
|
-
container_id:
|
|
2925
|
-
code:
|
|
2926
|
-
outputs:
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3151
|
+
import_v416.z.object({
|
|
3152
|
+
type: import_v416.z.literal("code_interpreter_call"),
|
|
3153
|
+
id: import_v416.z.string(),
|
|
3154
|
+
container_id: import_v416.z.string(),
|
|
3155
|
+
code: import_v416.z.string().nullable(),
|
|
3156
|
+
outputs: import_v416.z.array(
|
|
3157
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3158
|
+
import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
|
|
3159
|
+
import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
|
|
2930
3160
|
])
|
|
2931
3161
|
).nullable(),
|
|
2932
|
-
status:
|
|
3162
|
+
status: import_v416.z.string()
|
|
2933
3163
|
})
|
|
2934
3164
|
])
|
|
2935
3165
|
}),
|
|
2936
|
-
|
|
2937
|
-
type:
|
|
2938
|
-
output_index:
|
|
2939
|
-
item:
|
|
2940
|
-
|
|
2941
|
-
type:
|
|
2942
|
-
id:
|
|
2943
|
-
phase:
|
|
3166
|
+
import_v416.z.object({
|
|
3167
|
+
type: import_v416.z.literal("response.output_item.done"),
|
|
3168
|
+
output_index: import_v416.z.number(),
|
|
3169
|
+
item: import_v416.z.discriminatedUnion("type", [
|
|
3170
|
+
import_v416.z.object({
|
|
3171
|
+
type: import_v416.z.literal("message"),
|
|
3172
|
+
id: import_v416.z.string(),
|
|
3173
|
+
phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
|
|
2944
3174
|
}),
|
|
2945
|
-
|
|
2946
|
-
type:
|
|
2947
|
-
id:
|
|
2948
|
-
encrypted_content:
|
|
3175
|
+
import_v416.z.object({
|
|
3176
|
+
type: import_v416.z.literal("reasoning"),
|
|
3177
|
+
id: import_v416.z.string(),
|
|
3178
|
+
encrypted_content: import_v416.z.string().nullish()
|
|
2949
3179
|
}),
|
|
2950
|
-
|
|
2951
|
-
type:
|
|
2952
|
-
id:
|
|
2953
|
-
call_id:
|
|
2954
|
-
name:
|
|
2955
|
-
arguments:
|
|
2956
|
-
async:
|
|
2957
|
-
status:
|
|
3180
|
+
import_v416.z.object({
|
|
3181
|
+
type: import_v416.z.literal("function_call"),
|
|
3182
|
+
id: import_v416.z.string(),
|
|
3183
|
+
call_id: import_v416.z.string(),
|
|
3184
|
+
name: import_v416.z.string(),
|
|
3185
|
+
arguments: import_v416.z.string(),
|
|
3186
|
+
async: import_v416.z.boolean().nullish(),
|
|
3187
|
+
status: import_v416.z.enum(["in_progress", "completed", "incomplete"])
|
|
2958
3188
|
}),
|
|
2959
|
-
|
|
2960
|
-
type:
|
|
2961
|
-
id:
|
|
2962
|
-
code:
|
|
2963
|
-
container_id:
|
|
2964
|
-
outputs:
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
3189
|
+
import_v416.z.object({
|
|
3190
|
+
type: import_v416.z.literal("code_interpreter_call"),
|
|
3191
|
+
id: import_v416.z.string(),
|
|
3192
|
+
code: import_v416.z.string().nullable(),
|
|
3193
|
+
container_id: import_v416.z.string(),
|
|
3194
|
+
outputs: import_v416.z.array(
|
|
3195
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3196
|
+
import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
|
|
3197
|
+
import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
|
|
2968
3198
|
])
|
|
2969
3199
|
).nullable()
|
|
2970
3200
|
}),
|
|
2971
|
-
|
|
2972
|
-
type:
|
|
2973
|
-
id:
|
|
2974
|
-
result:
|
|
3201
|
+
import_v416.z.object({
|
|
3202
|
+
type: import_v416.z.literal("image_generation_call"),
|
|
3203
|
+
id: import_v416.z.string(),
|
|
3204
|
+
result: import_v416.z.string()
|
|
2975
3205
|
}),
|
|
2976
|
-
|
|
2977
|
-
type:
|
|
2978
|
-
id:
|
|
2979
|
-
status:
|
|
2980
|
-
action:
|
|
2981
|
-
|
|
2982
|
-
type:
|
|
2983
|
-
query:
|
|
2984
|
-
sources:
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
3206
|
+
import_v416.z.object({
|
|
3207
|
+
type: import_v416.z.literal("web_search_call"),
|
|
3208
|
+
id: import_v416.z.string(),
|
|
3209
|
+
status: import_v416.z.string(),
|
|
3210
|
+
action: import_v416.z.discriminatedUnion("type", [
|
|
3211
|
+
import_v416.z.object({
|
|
3212
|
+
type: import_v416.z.literal("search"),
|
|
3213
|
+
query: import_v416.z.string().nullish(),
|
|
3214
|
+
sources: import_v416.z.array(
|
|
3215
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3216
|
+
import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
|
|
3217
|
+
import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
|
|
2988
3218
|
])
|
|
2989
3219
|
).nullish()
|
|
2990
3220
|
}),
|
|
2991
|
-
|
|
2992
|
-
type:
|
|
2993
|
-
url:
|
|
3221
|
+
import_v416.z.object({
|
|
3222
|
+
type: import_v416.z.literal("open_page"),
|
|
3223
|
+
url: import_v416.z.string().nullish()
|
|
2994
3224
|
}),
|
|
2995
|
-
|
|
2996
|
-
type:
|
|
2997
|
-
url:
|
|
2998
|
-
pattern:
|
|
3225
|
+
import_v416.z.object({
|
|
3226
|
+
type: import_v416.z.literal("find_in_page"),
|
|
3227
|
+
url: import_v416.z.string().nullish(),
|
|
3228
|
+
pattern: import_v416.z.string().nullish()
|
|
2999
3229
|
})
|
|
3000
3230
|
]).nullish()
|
|
3001
3231
|
}),
|
|
3002
|
-
|
|
3003
|
-
type:
|
|
3004
|
-
id:
|
|
3005
|
-
queries:
|
|
3006
|
-
results:
|
|
3007
|
-
|
|
3008
|
-
attributes:
|
|
3009
|
-
file_id:
|
|
3010
|
-
filename:
|
|
3011
|
-
score:
|
|
3012
|
-
text:
|
|
3232
|
+
import_v416.z.object({
|
|
3233
|
+
type: import_v416.z.literal("file_search_call"),
|
|
3234
|
+
id: import_v416.z.string(),
|
|
3235
|
+
queries: import_v416.z.array(import_v416.z.string()),
|
|
3236
|
+
results: import_v416.z.array(
|
|
3237
|
+
import_v416.z.object({
|
|
3238
|
+
attributes: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()),
|
|
3239
|
+
file_id: import_v416.z.string(),
|
|
3240
|
+
filename: import_v416.z.string(),
|
|
3241
|
+
score: import_v416.z.number(),
|
|
3242
|
+
text: import_v416.z.string()
|
|
3013
3243
|
})
|
|
3014
3244
|
).nullish()
|
|
3015
3245
|
}),
|
|
3016
|
-
|
|
3017
|
-
type:
|
|
3018
|
-
id:
|
|
3019
|
-
call_id:
|
|
3020
|
-
action:
|
|
3021
|
-
type:
|
|
3022
|
-
command:
|
|
3023
|
-
timeout_ms:
|
|
3024
|
-
user:
|
|
3025
|
-
working_directory:
|
|
3026
|
-
env:
|
|
3246
|
+
import_v416.z.object({
|
|
3247
|
+
type: import_v416.z.literal("local_shell_call"),
|
|
3248
|
+
id: import_v416.z.string(),
|
|
3249
|
+
call_id: import_v416.z.string(),
|
|
3250
|
+
action: import_v416.z.object({
|
|
3251
|
+
type: import_v416.z.literal("exec"),
|
|
3252
|
+
command: import_v416.z.array(import_v416.z.string()),
|
|
3253
|
+
timeout_ms: import_v416.z.number().optional(),
|
|
3254
|
+
user: import_v416.z.string().optional(),
|
|
3255
|
+
working_directory: import_v416.z.string().optional(),
|
|
3256
|
+
env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
|
|
3027
3257
|
})
|
|
3028
3258
|
}),
|
|
3029
|
-
|
|
3030
|
-
type:
|
|
3031
|
-
id:
|
|
3032
|
-
status:
|
|
3259
|
+
import_v416.z.object({
|
|
3260
|
+
type: import_v416.z.literal("computer_call"),
|
|
3261
|
+
id: import_v416.z.string(),
|
|
3262
|
+
status: import_v416.z.literal("completed")
|
|
3033
3263
|
})
|
|
3034
3264
|
])
|
|
3035
3265
|
}),
|
|
3036
|
-
|
|
3037
|
-
type:
|
|
3038
|
-
item_id:
|
|
3039
|
-
output_index:
|
|
3040
|
-
delta:
|
|
3266
|
+
import_v416.z.object({
|
|
3267
|
+
type: import_v416.z.literal("response.function_call_arguments.delta"),
|
|
3268
|
+
item_id: import_v416.z.string(),
|
|
3269
|
+
output_index: import_v416.z.number(),
|
|
3270
|
+
delta: import_v416.z.string()
|
|
3041
3271
|
}),
|
|
3042
|
-
|
|
3043
|
-
type:
|
|
3044
|
-
item_id:
|
|
3045
|
-
output_index:
|
|
3046
|
-
partial_image_b64:
|
|
3272
|
+
import_v416.z.object({
|
|
3273
|
+
type: import_v416.z.literal("response.image_generation_call.partial_image"),
|
|
3274
|
+
item_id: import_v416.z.string(),
|
|
3275
|
+
output_index: import_v416.z.number(),
|
|
3276
|
+
partial_image_b64: import_v416.z.string()
|
|
3047
3277
|
}),
|
|
3048
|
-
|
|
3049
|
-
type:
|
|
3050
|
-
item_id:
|
|
3051
|
-
output_index:
|
|
3052
|
-
delta:
|
|
3278
|
+
import_v416.z.object({
|
|
3279
|
+
type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
|
|
3280
|
+
item_id: import_v416.z.string(),
|
|
3281
|
+
output_index: import_v416.z.number(),
|
|
3282
|
+
delta: import_v416.z.string()
|
|
3053
3283
|
}),
|
|
3054
|
-
|
|
3055
|
-
type:
|
|
3056
|
-
item_id:
|
|
3057
|
-
output_index:
|
|
3058
|
-
code:
|
|
3284
|
+
import_v416.z.object({
|
|
3285
|
+
type: import_v416.z.literal("response.code_interpreter_call_code.done"),
|
|
3286
|
+
item_id: import_v416.z.string(),
|
|
3287
|
+
output_index: import_v416.z.number(),
|
|
3288
|
+
code: import_v416.z.string()
|
|
3059
3289
|
}),
|
|
3060
|
-
|
|
3061
|
-
type:
|
|
3062
|
-
annotation:
|
|
3063
|
-
|
|
3064
|
-
type:
|
|
3065
|
-
start_index:
|
|
3066
|
-
end_index:
|
|
3067
|
-
url:
|
|
3068
|
-
title:
|
|
3290
|
+
import_v416.z.object({
|
|
3291
|
+
type: import_v416.z.literal("response.output_text.annotation.added"),
|
|
3292
|
+
annotation: import_v416.z.discriminatedUnion("type", [
|
|
3293
|
+
import_v416.z.object({
|
|
3294
|
+
type: import_v416.z.literal("url_citation"),
|
|
3295
|
+
start_index: import_v416.z.number(),
|
|
3296
|
+
end_index: import_v416.z.number(),
|
|
3297
|
+
url: import_v416.z.string(),
|
|
3298
|
+
title: import_v416.z.string()
|
|
3069
3299
|
}),
|
|
3070
|
-
|
|
3071
|
-
type:
|
|
3072
|
-
file_id:
|
|
3073
|
-
filename:
|
|
3074
|
-
index:
|
|
3075
|
-
start_index:
|
|
3076
|
-
end_index:
|
|
3077
|
-
quote:
|
|
3300
|
+
import_v416.z.object({
|
|
3301
|
+
type: import_v416.z.literal("file_citation"),
|
|
3302
|
+
file_id: import_v416.z.string(),
|
|
3303
|
+
filename: import_v416.z.string().nullish(),
|
|
3304
|
+
index: import_v416.z.number().nullish(),
|
|
3305
|
+
start_index: import_v416.z.number().nullish(),
|
|
3306
|
+
end_index: import_v416.z.number().nullish(),
|
|
3307
|
+
quote: import_v416.z.string().nullish()
|
|
3078
3308
|
})
|
|
3079
3309
|
])
|
|
3080
3310
|
}),
|
|
3081
|
-
|
|
3082
|
-
type:
|
|
3083
|
-
item_id:
|
|
3084
|
-
summary_index:
|
|
3311
|
+
import_v416.z.object({
|
|
3312
|
+
type: import_v416.z.literal("response.reasoning_summary_part.added"),
|
|
3313
|
+
item_id: import_v416.z.string(),
|
|
3314
|
+
summary_index: import_v416.z.number()
|
|
3085
3315
|
}),
|
|
3086
|
-
|
|
3087
|
-
type:
|
|
3088
|
-
item_id:
|
|
3089
|
-
summary_index:
|
|
3090
|
-
delta:
|
|
3316
|
+
import_v416.z.object({
|
|
3317
|
+
type: import_v416.z.literal("response.reasoning_summary_text.delta"),
|
|
3318
|
+
item_id: import_v416.z.string(),
|
|
3319
|
+
summary_index: import_v416.z.number(),
|
|
3320
|
+
delta: import_v416.z.string()
|
|
3091
3321
|
}),
|
|
3092
|
-
|
|
3093
|
-
type:
|
|
3094
|
-
item_id:
|
|
3095
|
-
summary_index:
|
|
3322
|
+
import_v416.z.object({
|
|
3323
|
+
type: import_v416.z.literal("response.reasoning_summary_part.done"),
|
|
3324
|
+
item_id: import_v416.z.string(),
|
|
3325
|
+
summary_index: import_v416.z.number()
|
|
3096
3326
|
}),
|
|
3097
|
-
|
|
3098
|
-
type:
|
|
3099
|
-
sequence_number:
|
|
3100
|
-
error:
|
|
3101
|
-
type:
|
|
3102
|
-
code:
|
|
3103
|
-
message:
|
|
3104
|
-
param:
|
|
3327
|
+
import_v416.z.object({
|
|
3328
|
+
type: import_v416.z.literal("error"),
|
|
3329
|
+
sequence_number: import_v416.z.number(),
|
|
3330
|
+
error: import_v416.z.object({
|
|
3331
|
+
type: import_v416.z.string(),
|
|
3332
|
+
code: import_v416.z.string(),
|
|
3333
|
+
message: import_v416.z.string(),
|
|
3334
|
+
param: import_v416.z.string().nullish()
|
|
3105
3335
|
})
|
|
3106
3336
|
}),
|
|
3107
|
-
|
|
3337
|
+
import_v416.z.object({ type: import_v416.z.string() }).loose().transform((value) => ({
|
|
3108
3338
|
type: "unknown_chunk",
|
|
3109
3339
|
message: value.type
|
|
3110
3340
|
}))
|
|
@@ -3112,389 +3342,203 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
|
|
|
3112
3342
|
])
|
|
3113
3343
|
)
|
|
3114
3344
|
);
|
|
3115
|
-
var openaiResponsesResponseSchema = (0,
|
|
3116
|
-
() => (0,
|
|
3117
|
-
|
|
3118
|
-
id:
|
|
3119
|
-
created_at:
|
|
3120
|
-
error:
|
|
3121
|
-
message:
|
|
3122
|
-
type:
|
|
3123
|
-
param:
|
|
3124
|
-
code:
|
|
3345
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3346
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3347
|
+
import_v416.z.object({
|
|
3348
|
+
id: import_v416.z.string().optional(),
|
|
3349
|
+
created_at: import_v416.z.number().optional(),
|
|
3350
|
+
error: import_v416.z.object({
|
|
3351
|
+
message: import_v416.z.string(),
|
|
3352
|
+
type: import_v416.z.string(),
|
|
3353
|
+
param: import_v416.z.string().nullish(),
|
|
3354
|
+
code: import_v416.z.string()
|
|
3125
3355
|
}).nullish(),
|
|
3126
|
-
model:
|
|
3127
|
-
output:
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
type:
|
|
3131
|
-
role:
|
|
3132
|
-
id:
|
|
3133
|
-
phase:
|
|
3134
|
-
content:
|
|
3135
|
-
|
|
3136
|
-
type:
|
|
3137
|
-
text:
|
|
3138
|
-
logprobs:
|
|
3139
|
-
|
|
3140
|
-
token:
|
|
3141
|
-
logprob:
|
|
3142
|
-
top_logprobs:
|
|
3143
|
-
|
|
3144
|
-
token:
|
|
3145
|
-
logprob:
|
|
3356
|
+
model: import_v416.z.string().optional(),
|
|
3357
|
+
output: import_v416.z.array(
|
|
3358
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3359
|
+
import_v416.z.object({
|
|
3360
|
+
type: import_v416.z.literal("message"),
|
|
3361
|
+
role: import_v416.z.literal("assistant"),
|
|
3362
|
+
id: import_v416.z.string(),
|
|
3363
|
+
phase: import_v416.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3364
|
+
content: import_v416.z.array(
|
|
3365
|
+
import_v416.z.object({
|
|
3366
|
+
type: import_v416.z.literal("output_text"),
|
|
3367
|
+
text: import_v416.z.string(),
|
|
3368
|
+
logprobs: import_v416.z.array(
|
|
3369
|
+
import_v416.z.object({
|
|
3370
|
+
token: import_v416.z.string(),
|
|
3371
|
+
logprob: import_v416.z.number(),
|
|
3372
|
+
top_logprobs: import_v416.z.array(
|
|
3373
|
+
import_v416.z.object({
|
|
3374
|
+
token: import_v416.z.string(),
|
|
3375
|
+
logprob: import_v416.z.number()
|
|
3146
3376
|
})
|
|
3147
3377
|
)
|
|
3148
3378
|
})
|
|
3149
3379
|
).nullish(),
|
|
3150
|
-
annotations:
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
type:
|
|
3154
|
-
start_index:
|
|
3155
|
-
end_index:
|
|
3156
|
-
url:
|
|
3157
|
-
title:
|
|
3380
|
+
annotations: import_v416.z.array(
|
|
3381
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3382
|
+
import_v416.z.object({
|
|
3383
|
+
type: import_v416.z.literal("url_citation"),
|
|
3384
|
+
start_index: import_v416.z.number(),
|
|
3385
|
+
end_index: import_v416.z.number(),
|
|
3386
|
+
url: import_v416.z.string(),
|
|
3387
|
+
title: import_v416.z.string()
|
|
3158
3388
|
}),
|
|
3159
|
-
|
|
3160
|
-
type:
|
|
3161
|
-
file_id:
|
|
3162
|
-
filename:
|
|
3163
|
-
index:
|
|
3164
|
-
start_index:
|
|
3165
|
-
end_index:
|
|
3166
|
-
quote:
|
|
3389
|
+
import_v416.z.object({
|
|
3390
|
+
type: import_v416.z.literal("file_citation"),
|
|
3391
|
+
file_id: import_v416.z.string(),
|
|
3392
|
+
filename: import_v416.z.string().nullish(),
|
|
3393
|
+
index: import_v416.z.number().nullish(),
|
|
3394
|
+
start_index: import_v416.z.number().nullish(),
|
|
3395
|
+
end_index: import_v416.z.number().nullish(),
|
|
3396
|
+
quote: import_v416.z.string().nullish()
|
|
3167
3397
|
}),
|
|
3168
|
-
|
|
3169
|
-
type:
|
|
3170
|
-
container_id:
|
|
3171
|
-
file_id:
|
|
3172
|
-
filename:
|
|
3173
|
-
start_index:
|
|
3174
|
-
end_index:
|
|
3175
|
-
index:
|
|
3398
|
+
import_v416.z.object({
|
|
3399
|
+
type: import_v416.z.literal("container_file_citation"),
|
|
3400
|
+
container_id: import_v416.z.string(),
|
|
3401
|
+
file_id: import_v416.z.string(),
|
|
3402
|
+
filename: import_v416.z.string().nullish(),
|
|
3403
|
+
start_index: import_v416.z.number().nullish(),
|
|
3404
|
+
end_index: import_v416.z.number().nullish(),
|
|
3405
|
+
index: import_v416.z.number().nullish()
|
|
3176
3406
|
}),
|
|
3177
|
-
|
|
3178
|
-
type:
|
|
3179
|
-
file_id:
|
|
3180
|
-
index:
|
|
3407
|
+
import_v416.z.object({
|
|
3408
|
+
type: import_v416.z.literal("file_path"),
|
|
3409
|
+
file_id: import_v416.z.string(),
|
|
3410
|
+
index: import_v416.z.number().nullish()
|
|
3181
3411
|
})
|
|
3182
3412
|
])
|
|
3183
3413
|
)
|
|
3184
3414
|
})
|
|
3185
3415
|
)
|
|
3186
3416
|
}),
|
|
3187
|
-
|
|
3188
|
-
type:
|
|
3189
|
-
id:
|
|
3190
|
-
status:
|
|
3191
|
-
action:
|
|
3192
|
-
|
|
3193
|
-
type:
|
|
3194
|
-
query:
|
|
3195
|
-
sources:
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
type:
|
|
3200
|
-
name:
|
|
3417
|
+
import_v416.z.object({
|
|
3418
|
+
type: import_v416.z.literal("web_search_call"),
|
|
3419
|
+
id: import_v416.z.string(),
|
|
3420
|
+
status: import_v416.z.string(),
|
|
3421
|
+
action: import_v416.z.discriminatedUnion("type", [
|
|
3422
|
+
import_v416.z.object({
|
|
3423
|
+
type: import_v416.z.literal("search"),
|
|
3424
|
+
query: import_v416.z.string().nullish(),
|
|
3425
|
+
sources: import_v416.z.array(
|
|
3426
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3427
|
+
import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
|
|
3428
|
+
import_v416.z.object({
|
|
3429
|
+
type: import_v416.z.literal("api"),
|
|
3430
|
+
name: import_v416.z.string()
|
|
3201
3431
|
})
|
|
3202
3432
|
])
|
|
3203
3433
|
).nullish()
|
|
3204
3434
|
}),
|
|
3205
|
-
|
|
3206
|
-
type:
|
|
3207
|
-
url:
|
|
3435
|
+
import_v416.z.object({
|
|
3436
|
+
type: import_v416.z.literal("open_page"),
|
|
3437
|
+
url: import_v416.z.string().nullish()
|
|
3208
3438
|
}),
|
|
3209
|
-
|
|
3210
|
-
type:
|
|
3211
|
-
url:
|
|
3212
|
-
pattern:
|
|
3439
|
+
import_v416.z.object({
|
|
3440
|
+
type: import_v416.z.literal("find_in_page"),
|
|
3441
|
+
url: import_v416.z.string().nullish(),
|
|
3442
|
+
pattern: import_v416.z.string().nullish()
|
|
3213
3443
|
})
|
|
3214
3444
|
]).nullish()
|
|
3215
3445
|
}),
|
|
3216
|
-
|
|
3217
|
-
type:
|
|
3218
|
-
id:
|
|
3219
|
-
queries:
|
|
3220
|
-
results:
|
|
3221
|
-
|
|
3222
|
-
attributes:
|
|
3223
|
-
|
|
3224
|
-
|
|
3446
|
+
import_v416.z.object({
|
|
3447
|
+
type: import_v416.z.literal("file_search_call"),
|
|
3448
|
+
id: import_v416.z.string(),
|
|
3449
|
+
queries: import_v416.z.array(import_v416.z.string()),
|
|
3450
|
+
results: import_v416.z.array(
|
|
3451
|
+
import_v416.z.object({
|
|
3452
|
+
attributes: import_v416.z.record(
|
|
3453
|
+
import_v416.z.string(),
|
|
3454
|
+
import_v416.z.union([import_v416.z.string(), import_v416.z.number(), import_v416.z.boolean()])
|
|
3225
3455
|
),
|
|
3226
|
-
file_id:
|
|
3227
|
-
filename:
|
|
3228
|
-
score:
|
|
3229
|
-
text:
|
|
3456
|
+
file_id: import_v416.z.string(),
|
|
3457
|
+
filename: import_v416.z.string(),
|
|
3458
|
+
score: import_v416.z.number(),
|
|
3459
|
+
text: import_v416.z.string()
|
|
3230
3460
|
})
|
|
3231
3461
|
).nullish()
|
|
3232
3462
|
}),
|
|
3233
|
-
|
|
3234
|
-
type:
|
|
3235
|
-
id:
|
|
3236
|
-
code:
|
|
3237
|
-
container_id:
|
|
3238
|
-
outputs:
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3463
|
+
import_v416.z.object({
|
|
3464
|
+
type: import_v416.z.literal("code_interpreter_call"),
|
|
3465
|
+
id: import_v416.z.string(),
|
|
3466
|
+
code: import_v416.z.string().nullable(),
|
|
3467
|
+
container_id: import_v416.z.string(),
|
|
3468
|
+
outputs: import_v416.z.array(
|
|
3469
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3470
|
+
import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
|
|
3471
|
+
import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
|
|
3242
3472
|
])
|
|
3243
3473
|
).nullable()
|
|
3244
3474
|
}),
|
|
3245
|
-
|
|
3246
|
-
type:
|
|
3247
|
-
id:
|
|
3248
|
-
result:
|
|
3475
|
+
import_v416.z.object({
|
|
3476
|
+
type: import_v416.z.literal("image_generation_call"),
|
|
3477
|
+
id: import_v416.z.string(),
|
|
3478
|
+
result: import_v416.z.string()
|
|
3249
3479
|
}),
|
|
3250
|
-
|
|
3251
|
-
type:
|
|
3252
|
-
id:
|
|
3253
|
-
call_id:
|
|
3254
|
-
action:
|
|
3255
|
-
type:
|
|
3256
|
-
command:
|
|
3257
|
-
timeout_ms:
|
|
3258
|
-
user:
|
|
3259
|
-
working_directory:
|
|
3260
|
-
env:
|
|
3480
|
+
import_v416.z.object({
|
|
3481
|
+
type: import_v416.z.literal("local_shell_call"),
|
|
3482
|
+
id: import_v416.z.string(),
|
|
3483
|
+
call_id: import_v416.z.string(),
|
|
3484
|
+
action: import_v416.z.object({
|
|
3485
|
+
type: import_v416.z.literal("exec"),
|
|
3486
|
+
command: import_v416.z.array(import_v416.z.string()),
|
|
3487
|
+
timeout_ms: import_v416.z.number().optional(),
|
|
3488
|
+
user: import_v416.z.string().optional(),
|
|
3489
|
+
working_directory: import_v416.z.string().optional(),
|
|
3490
|
+
env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
|
|
3261
3491
|
})
|
|
3262
3492
|
}),
|
|
3263
|
-
|
|
3264
|
-
type:
|
|
3265
|
-
call_id:
|
|
3266
|
-
name:
|
|
3267
|
-
arguments:
|
|
3268
|
-
id:
|
|
3269
|
-
async:
|
|
3493
|
+
import_v416.z.object({
|
|
3494
|
+
type: import_v416.z.literal("function_call"),
|
|
3495
|
+
call_id: import_v416.z.string(),
|
|
3496
|
+
name: import_v416.z.string(),
|
|
3497
|
+
arguments: import_v416.z.string(),
|
|
3498
|
+
id: import_v416.z.string(),
|
|
3499
|
+
async: import_v416.z.boolean().nullish()
|
|
3270
3500
|
}),
|
|
3271
|
-
|
|
3272
|
-
type:
|
|
3273
|
-
id:
|
|
3274
|
-
status:
|
|
3501
|
+
import_v416.z.object({
|
|
3502
|
+
type: import_v416.z.literal("computer_call"),
|
|
3503
|
+
id: import_v416.z.string(),
|
|
3504
|
+
status: import_v416.z.string().optional()
|
|
3275
3505
|
}),
|
|
3276
|
-
|
|
3277
|
-
type:
|
|
3278
|
-
id:
|
|
3279
|
-
encrypted_content:
|
|
3280
|
-
summary:
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
text:
|
|
3506
|
+
import_v416.z.object({
|
|
3507
|
+
type: import_v416.z.literal("reasoning"),
|
|
3508
|
+
id: import_v416.z.string(),
|
|
3509
|
+
encrypted_content: import_v416.z.string().nullish(),
|
|
3510
|
+
summary: import_v416.z.array(
|
|
3511
|
+
import_v416.z.object({
|
|
3512
|
+
type: import_v416.z.literal("summary_text"),
|
|
3513
|
+
text: import_v416.z.string()
|
|
3284
3514
|
})
|
|
3285
3515
|
)
|
|
3286
3516
|
})
|
|
3287
3517
|
])
|
|
3288
3518
|
).optional(),
|
|
3289
|
-
service_tier:
|
|
3290
|
-
reasoning:
|
|
3291
|
-
context:
|
|
3519
|
+
service_tier: import_v416.z.string().nullish(),
|
|
3520
|
+
reasoning: import_v416.z.object({
|
|
3521
|
+
context: import_v416.z.string().nullish()
|
|
3292
3522
|
}).nullish(),
|
|
3293
|
-
incomplete_details:
|
|
3294
|
-
usage:
|
|
3295
|
-
input_tokens:
|
|
3296
|
-
input_tokens_details:
|
|
3297
|
-
cached_tokens:
|
|
3298
|
-
cache_write_tokens:
|
|
3299
|
-
orchestration_input_tokens:
|
|
3300
|
-
orchestration_input_cached_tokens:
|
|
3523
|
+
incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
|
|
3524
|
+
usage: import_v416.z.object({
|
|
3525
|
+
input_tokens: import_v416.z.number(),
|
|
3526
|
+
input_tokens_details: import_v416.z.object({
|
|
3527
|
+
cached_tokens: import_v416.z.number().nullish(),
|
|
3528
|
+
cache_write_tokens: import_v416.z.number().nullish(),
|
|
3529
|
+
orchestration_input_tokens: import_v416.z.number().nullish(),
|
|
3530
|
+
orchestration_input_cached_tokens: import_v416.z.number().nullish()
|
|
3301
3531
|
}).nullish(),
|
|
3302
|
-
output_tokens:
|
|
3303
|
-
output_tokens_details:
|
|
3304
|
-
reasoning_tokens:
|
|
3305
|
-
orchestration_output_tokens:
|
|
3532
|
+
output_tokens: import_v416.z.number(),
|
|
3533
|
+
output_tokens_details: import_v416.z.object({
|
|
3534
|
+
reasoning_tokens: import_v416.z.number().nullish(),
|
|
3535
|
+
orchestration_output_tokens: import_v416.z.number().nullish()
|
|
3306
3536
|
}).nullish()
|
|
3307
3537
|
}).optional()
|
|
3308
3538
|
})
|
|
3309
3539
|
)
|
|
3310
3540
|
);
|
|
3311
3541
|
|
|
3312
|
-
// src/responses/openai-responses-options.ts
|
|
3313
|
-
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3314
|
-
var import_v416 = require("zod/v4");
|
|
3315
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
3316
|
-
var openaiResponsesReasoningModelIds = [
|
|
3317
|
-
"o1",
|
|
3318
|
-
"o1-2024-12-17",
|
|
3319
|
-
"o3",
|
|
3320
|
-
"o3-2025-04-16",
|
|
3321
|
-
"o3-deep-research",
|
|
3322
|
-
"o3-deep-research-2025-06-26",
|
|
3323
|
-
"o3-mini",
|
|
3324
|
-
"o3-mini-2025-01-31",
|
|
3325
|
-
"o4-mini",
|
|
3326
|
-
"o4-mini-2025-04-16",
|
|
3327
|
-
"o4-mini-deep-research",
|
|
3328
|
-
"o4-mini-deep-research-2025-06-26",
|
|
3329
|
-
"codex-mini-latest",
|
|
3330
|
-
"computer-use-preview",
|
|
3331
|
-
"gpt-5",
|
|
3332
|
-
"gpt-5-2025-08-07",
|
|
3333
|
-
"gpt-5-codex",
|
|
3334
|
-
"gpt-5-mini",
|
|
3335
|
-
"gpt-5-mini-2025-08-07",
|
|
3336
|
-
"gpt-5-nano",
|
|
3337
|
-
"gpt-5-nano-2025-08-07",
|
|
3338
|
-
"gpt-5-pro",
|
|
3339
|
-
"gpt-5-pro-2025-10-06",
|
|
3340
|
-
"gpt-5.1",
|
|
3341
|
-
"gpt-5.1-chat-latest",
|
|
3342
|
-
"gpt-5.1-codex-mini",
|
|
3343
|
-
"gpt-5.1-codex",
|
|
3344
|
-
"gpt-5.1-codex-max",
|
|
3345
|
-
"gpt-5.2",
|
|
3346
|
-
"gpt-5.2-chat-latest",
|
|
3347
|
-
"gpt-5.2-pro",
|
|
3348
|
-
"gpt-5.2-codex",
|
|
3349
|
-
"gpt-5.3-chat-latest",
|
|
3350
|
-
"gpt-5.3-codex",
|
|
3351
|
-
"gpt-5.4",
|
|
3352
|
-
"gpt-5.4-2026-03-05",
|
|
3353
|
-
"gpt-5.4-mini",
|
|
3354
|
-
"gpt-5.4-mini-2026-03-17",
|
|
3355
|
-
"gpt-5.4-nano",
|
|
3356
|
-
"gpt-5.4-nano-2026-03-17",
|
|
3357
|
-
"gpt-5.4-pro",
|
|
3358
|
-
"gpt-5.4-pro-2026-03-05",
|
|
3359
|
-
"gpt-5.6",
|
|
3360
|
-
"gpt-5.6-luna",
|
|
3361
|
-
"gpt-5.6-sol",
|
|
3362
|
-
"gpt-5.6-terra",
|
|
3363
|
-
"gpt-6-astra",
|
|
3364
|
-
"gpt-6-luna",
|
|
3365
|
-
"gpt-6-sol"
|
|
3366
|
-
];
|
|
3367
|
-
var openaiResponsesModelIds = [
|
|
3368
|
-
"gpt-4.1",
|
|
3369
|
-
"gpt-4.1-2025-04-14",
|
|
3370
|
-
"gpt-4.1-mini",
|
|
3371
|
-
"gpt-4.1-mini-2025-04-14",
|
|
3372
|
-
"gpt-4.1-nano",
|
|
3373
|
-
"gpt-4.1-nano-2025-04-14",
|
|
3374
|
-
"gpt-4o",
|
|
3375
|
-
"gpt-4o-2024-05-13",
|
|
3376
|
-
"gpt-4o-2024-08-06",
|
|
3377
|
-
"gpt-4o-2024-11-20",
|
|
3378
|
-
"gpt-4o-audio-preview",
|
|
3379
|
-
"gpt-4o-audio-preview-2024-10-01",
|
|
3380
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
3381
|
-
"gpt-4o-search-preview",
|
|
3382
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
3383
|
-
"gpt-4o-mini-search-preview",
|
|
3384
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3385
|
-
"gpt-4o-mini",
|
|
3386
|
-
"gpt-4o-mini-2024-07-18",
|
|
3387
|
-
"gpt-4-turbo",
|
|
3388
|
-
"gpt-4-turbo-2024-04-09",
|
|
3389
|
-
"gpt-4-turbo-preview",
|
|
3390
|
-
"gpt-4-0125-preview",
|
|
3391
|
-
"gpt-4-1106-preview",
|
|
3392
|
-
"gpt-4",
|
|
3393
|
-
"gpt-4-0613",
|
|
3394
|
-
"gpt-4.5-preview",
|
|
3395
|
-
"gpt-4.5-preview-2025-02-27",
|
|
3396
|
-
"gpt-3.5-turbo-0125",
|
|
3397
|
-
"gpt-3.5-turbo",
|
|
3398
|
-
"gpt-3.5-turbo-1106",
|
|
3399
|
-
"chatgpt-4o-latest",
|
|
3400
|
-
"gpt-5-chat-latest",
|
|
3401
|
-
...openaiResponsesReasoningModelIds
|
|
3402
|
-
];
|
|
3403
|
-
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3404
|
-
() => (0, import_provider_utils23.zodSchema)(
|
|
3405
|
-
import_v416.z.object({
|
|
3406
|
-
conversation: import_v416.z.string().nullish(),
|
|
3407
|
-
include: import_v416.z.array(
|
|
3408
|
-
import_v416.z.enum([
|
|
3409
|
-
"reasoning.encrypted_content",
|
|
3410
|
-
// handled internally by default, only needed for unknown reasoning models
|
|
3411
|
-
"file_search_call.results",
|
|
3412
|
-
"message.output_text.logprobs"
|
|
3413
|
-
])
|
|
3414
|
-
).nullish(),
|
|
3415
|
-
instructions: import_v416.z.string().nullish(),
|
|
3416
|
-
/**
|
|
3417
|
-
* Return the log probabilities of the tokens.
|
|
3418
|
-
*
|
|
3419
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
3420
|
-
* were generated.
|
|
3421
|
-
*
|
|
3422
|
-
* Setting to a number will return the log probabilities of the top n
|
|
3423
|
-
* tokens that were generated.
|
|
3424
|
-
*
|
|
3425
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3426
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3427
|
-
*/
|
|
3428
|
-
logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3429
|
-
/**
|
|
3430
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3431
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3432
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
3433
|
-
*/
|
|
3434
|
-
maxToolCalls: import_v416.z.number().nullish(),
|
|
3435
|
-
metadata: import_v416.z.any().nullish(),
|
|
3436
|
-
parallelToolCalls: import_v416.z.boolean().nullish(),
|
|
3437
|
-
previousResponseId: import_v416.z.string().nullish(),
|
|
3438
|
-
promptCacheKey: import_v416.z.string().nullish(),
|
|
3439
|
-
/**
|
|
3440
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3441
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3442
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3443
|
-
*/
|
|
3444
|
-
promptCacheOptions: import_v416.z.object({
|
|
3445
|
-
mode: import_v416.z.enum(["implicit", "explicit"]).optional(),
|
|
3446
|
-
ttl: import_v416.z.literal("30m").optional()
|
|
3447
|
-
}).optional(),
|
|
3448
|
-
/**
|
|
3449
|
-
* The retention policy for the prompt cache.
|
|
3450
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3451
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3452
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
3453
|
-
*
|
|
3454
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3455
|
-
*
|
|
3456
|
-
* @default 'in_memory'
|
|
3457
|
-
*/
|
|
3458
|
-
promptCacheRetention: import_v416.z.enum(["in_memory", "24h"]).nullish(),
|
|
3459
|
-
/**
|
|
3460
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3461
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3462
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3463
|
-
* Supported values vary by model.
|
|
3464
|
-
*/
|
|
3465
|
-
reasoningEffort: import_v416.z.string().nullish(),
|
|
3466
|
-
/**
|
|
3467
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3468
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
3469
|
-
* request prefix for prompt caching.
|
|
3470
|
-
*
|
|
3471
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3472
|
-
* combined with automatic truncation.
|
|
3473
|
-
*/
|
|
3474
|
-
reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3475
|
-
/**
|
|
3476
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3477
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3478
|
-
*/
|
|
3479
|
-
reasoningMode: import_v416.z.enum(["standard", "pro"]).optional(),
|
|
3480
|
-
/**
|
|
3481
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
3482
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3483
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3484
|
-
*/
|
|
3485
|
-
reasoningContext: import_v416.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3486
|
-
reasoningSummary: import_v416.z.string().nullish(),
|
|
3487
|
-
safetyIdentifier: import_v416.z.string().nullish(),
|
|
3488
|
-
serviceTier: import_v416.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3489
|
-
store: import_v416.z.boolean().nullish(),
|
|
3490
|
-
strictJsonSchema: import_v416.z.boolean().nullish(),
|
|
3491
|
-
textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
|
|
3492
|
-
truncation: import_v416.z.enum(["auto", "disabled"]).nullish(),
|
|
3493
|
-
user: import_v416.z.string().nullish()
|
|
3494
|
-
})
|
|
3495
|
-
)
|
|
3496
|
-
);
|
|
3497
|
-
|
|
3498
3542
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3499
3543
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3500
3544
|
|
|
@@ -3906,6 +3950,18 @@ function resolveAsyncToolOption({
|
|
|
3906
3950
|
}
|
|
3907
3951
|
|
|
3908
3952
|
// src/responses/openai-responses-language-model.ts
|
|
3953
|
+
function getConfigurationUpdateUnsupportedReason({
|
|
3954
|
+
modelCapabilities,
|
|
3955
|
+
options
|
|
3956
|
+
}) {
|
|
3957
|
+
if (!modelCapabilities.supportsConfigurationUpdate) {
|
|
3958
|
+
return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
3959
|
+
}
|
|
3960
|
+
if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
|
|
3961
|
+
return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
|
|
3962
|
+
}
|
|
3963
|
+
return void 0;
|
|
3964
|
+
}
|
|
3909
3965
|
var OpenAIResponsesLanguageModel = class {
|
|
3910
3966
|
constructor(modelId, config) {
|
|
3911
3967
|
this.specificationVersion = "v2";
|
|
@@ -3970,8 +4026,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3970
4026
|
details: "conversation and previousResponseId cannot be used together"
|
|
3971
4027
|
});
|
|
3972
4028
|
}
|
|
4029
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
4030
|
+
modelCapabilities,
|
|
4031
|
+
options: openaiOptions
|
|
4032
|
+
});
|
|
3973
4033
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3974
4034
|
prompt,
|
|
4035
|
+
configurationUpdateUnsupportedReason,
|
|
4036
|
+
providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
|
|
3975
4037
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
3976
4038
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
3977
4039
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
@@ -3991,18 +4053,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3991
4053
|
resolvedReasoningEffort = void 0;
|
|
3992
4054
|
}
|
|
3993
4055
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
3994
|
-
|
|
3995
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
4056
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
3996
4057
|
warnings.push({
|
|
3997
4058
|
type: "unsupported-setting",
|
|
3998
4059
|
setting: "reasoningEffortUpdate",
|
|
3999
|
-
details:
|
|
4060
|
+
details: configurationUpdateUnsupportedReason
|
|
4000
4061
|
});
|
|
4001
4062
|
} else if (reasoningEffortUpdate != null) {
|
|
4002
|
-
input
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4063
|
+
const firstItem = input[0];
|
|
4064
|
+
if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
|
|
4065
|
+
input.unshift({
|
|
4066
|
+
type: "configuration_update",
|
|
4067
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
4068
|
+
});
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
for (let i = 1; i < input.length; i++) {
|
|
4072
|
+
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
4073
|
+
throw new import_provider8.UnsupportedFunctionalityError({
|
|
4074
|
+
functionality: "Adjacent reasoning effort configuration updates"
|
|
4075
|
+
});
|
|
4076
|
+
}
|
|
4006
4077
|
}
|
|
4007
4078
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
4008
4079
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|