@ai-sdk/openai 2.0.128 → 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 +15 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +664 -588
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +664 -587
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +675 -601
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +674 -599
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -374,6 +374,9 @@ var openaiChatResponseSchema = lazyValidator(
|
|
|
374
374
|
message: z2.object({
|
|
375
375
|
role: z2.literal("assistant").nullish(),
|
|
376
376
|
content: z2.string().nullish(),
|
|
377
|
+
audio: z2.object({
|
|
378
|
+
transcript: z2.string().nullish()
|
|
379
|
+
}).nullish(),
|
|
377
380
|
tool_calls: z2.array(
|
|
378
381
|
z2.object({
|
|
379
382
|
id: z2.string().nullish(),
|
|
@@ -914,7 +917,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
914
917
|
};
|
|
915
918
|
}
|
|
916
919
|
async doGenerate(options) {
|
|
917
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
920
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
918
921
|
const { args: body, warnings } = await this.getArgs(options);
|
|
919
922
|
const {
|
|
920
923
|
responseHeaders,
|
|
@@ -942,19 +945,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
942
945
|
});
|
|
943
946
|
}
|
|
944
947
|
const content = [];
|
|
945
|
-
const text = choice.message.content;
|
|
948
|
+
const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
|
|
946
949
|
if (text != null && text.length > 0) {
|
|
947
950
|
content.push({ type: "text", text });
|
|
948
951
|
}
|
|
949
|
-
for (const toolCall of (
|
|
952
|
+
for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
|
|
950
953
|
content.push({
|
|
951
954
|
type: "tool-call",
|
|
952
|
-
toolCallId: (
|
|
955
|
+
toolCallId: (_c = toolCall.id) != null ? _c : generateId(),
|
|
953
956
|
toolName: toolCall.function.name,
|
|
954
957
|
input: toolCall.function.arguments
|
|
955
958
|
});
|
|
956
959
|
}
|
|
957
|
-
for (const annotation of (
|
|
960
|
+
for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
|
|
958
961
|
content.push({
|
|
959
962
|
type: "source",
|
|
960
963
|
sourceType: "url",
|
|
@@ -963,8 +966,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
963
966
|
title: annotation.url_citation.title
|
|
964
967
|
});
|
|
965
968
|
}
|
|
966
|
-
const completionTokenDetails = (
|
|
967
|
-
const promptTokenDetails = (
|
|
969
|
+
const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
|
|
970
|
+
const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
|
|
968
971
|
const providerMetadata = { openai: {} };
|
|
969
972
|
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
|
|
970
973
|
providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
|
|
@@ -977,18 +980,18 @@ var OpenAIChatLanguageModel = class {
|
|
|
977
980
|
cacheWriteTokens: promptTokenDetails.cache_write_tokens
|
|
978
981
|
};
|
|
979
982
|
}
|
|
980
|
-
if (((
|
|
983
|
+
if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
|
|
981
984
|
providerMetadata.openai.logprobs = choice.logprobs.content;
|
|
982
985
|
}
|
|
983
986
|
return {
|
|
984
987
|
content,
|
|
985
988
|
finishReason: mapOpenAIFinishReason(choice.finish_reason),
|
|
986
989
|
usage: {
|
|
987
|
-
inputTokens: (
|
|
988
|
-
outputTokens: (
|
|
989
|
-
totalTokens: (
|
|
990
|
-
reasoningTokens: (
|
|
991
|
-
cachedInputTokens: (
|
|
990
|
+
inputTokens: (_i = (_h = response.usage) == null ? void 0 : _h.prompt_tokens) != null ? _i : void 0,
|
|
991
|
+
outputTokens: (_k = (_j = response.usage) == null ? void 0 : _j.completion_tokens) != null ? _k : void 0,
|
|
992
|
+
totalTokens: (_m = (_l = response.usage) == null ? void 0 : _l.total_tokens) != null ? _m : void 0,
|
|
993
|
+
reasoningTokens: (_n = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _n : void 0,
|
|
994
|
+
cachedInputTokens: (_o = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _o : void 0
|
|
992
995
|
},
|
|
993
996
|
request: { body },
|
|
994
997
|
response: {
|
|
@@ -2406,6 +2409,7 @@ var OpenAISpeechModel = class {
|
|
|
2406
2409
|
|
|
2407
2410
|
// src/responses/openai-responses-language-model.ts
|
|
2408
2411
|
import {
|
|
2412
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError6,
|
|
2409
2413
|
APICallError
|
|
2410
2414
|
} from "@ai-sdk/provider";
|
|
2411
2415
|
import {
|
|
@@ -2426,31 +2430,235 @@ import {
|
|
|
2426
2430
|
parseProviderOptions as parseProviderOptions7,
|
|
2427
2431
|
validateTypes
|
|
2428
2432
|
} from "@ai-sdk/provider-utils";
|
|
2429
|
-
import { z as
|
|
2433
|
+
import { z as z15 } from "zod/v4";
|
|
2430
2434
|
|
|
2431
|
-
// src/
|
|
2435
|
+
// src/responses/openai-responses-options.ts
|
|
2432
2436
|
import {
|
|
2433
|
-
|
|
2434
|
-
lazySchema,
|
|
2437
|
+
lazyValidator as lazyValidator12,
|
|
2435
2438
|
zodSchema as zodSchema12
|
|
2436
2439
|
} from "@ai-sdk/provider-utils";
|
|
2437
2440
|
import { z as z13 } from "zod/v4";
|
|
2438
|
-
var
|
|
2441
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
2442
|
+
var openaiResponsesReasoningModelIds = [
|
|
2443
|
+
"o1",
|
|
2444
|
+
"o1-2024-12-17",
|
|
2445
|
+
"o3",
|
|
2446
|
+
"o3-2025-04-16",
|
|
2447
|
+
"o3-deep-research",
|
|
2448
|
+
"o3-deep-research-2025-06-26",
|
|
2449
|
+
"o3-mini",
|
|
2450
|
+
"o3-mini-2025-01-31",
|
|
2451
|
+
"o4-mini",
|
|
2452
|
+
"o4-mini-2025-04-16",
|
|
2453
|
+
"o4-mini-deep-research",
|
|
2454
|
+
"o4-mini-deep-research-2025-06-26",
|
|
2455
|
+
"codex-mini-latest",
|
|
2456
|
+
"computer-use-preview",
|
|
2457
|
+
"gpt-5",
|
|
2458
|
+
"gpt-5-2025-08-07",
|
|
2459
|
+
"gpt-5-codex",
|
|
2460
|
+
"gpt-5-mini",
|
|
2461
|
+
"gpt-5-mini-2025-08-07",
|
|
2462
|
+
"gpt-5-nano",
|
|
2463
|
+
"gpt-5-nano-2025-08-07",
|
|
2464
|
+
"gpt-5-pro",
|
|
2465
|
+
"gpt-5-pro-2025-10-06",
|
|
2466
|
+
"gpt-5.1",
|
|
2467
|
+
"gpt-5.1-chat-latest",
|
|
2468
|
+
"gpt-5.1-codex-mini",
|
|
2469
|
+
"gpt-5.1-codex",
|
|
2470
|
+
"gpt-5.1-codex-max",
|
|
2471
|
+
"gpt-5.2",
|
|
2472
|
+
"gpt-5.2-chat-latest",
|
|
2473
|
+
"gpt-5.2-pro",
|
|
2474
|
+
"gpt-5.2-codex",
|
|
2475
|
+
"gpt-5.3-chat-latest",
|
|
2476
|
+
"gpt-5.3-codex",
|
|
2477
|
+
"gpt-5.4",
|
|
2478
|
+
"gpt-5.4-2026-03-05",
|
|
2479
|
+
"gpt-5.4-mini",
|
|
2480
|
+
"gpt-5.4-mini-2026-03-17",
|
|
2481
|
+
"gpt-5.4-nano",
|
|
2482
|
+
"gpt-5.4-nano-2026-03-17",
|
|
2483
|
+
"gpt-5.4-pro",
|
|
2484
|
+
"gpt-5.4-pro-2026-03-05",
|
|
2485
|
+
"gpt-5.6",
|
|
2486
|
+
"gpt-5.6-luna",
|
|
2487
|
+
"gpt-5.6-sol",
|
|
2488
|
+
"gpt-5.6-terra",
|
|
2489
|
+
"gpt-6-astra",
|
|
2490
|
+
"gpt-6-luna",
|
|
2491
|
+
"gpt-6-sol"
|
|
2492
|
+
];
|
|
2493
|
+
var openaiResponsesModelIds = [
|
|
2494
|
+
"gpt-4.1",
|
|
2495
|
+
"gpt-4.1-2025-04-14",
|
|
2496
|
+
"gpt-4.1-mini",
|
|
2497
|
+
"gpt-4.1-mini-2025-04-14",
|
|
2498
|
+
"gpt-4.1-nano",
|
|
2499
|
+
"gpt-4.1-nano-2025-04-14",
|
|
2500
|
+
"gpt-4o",
|
|
2501
|
+
"gpt-4o-2024-05-13",
|
|
2502
|
+
"gpt-4o-2024-08-06",
|
|
2503
|
+
"gpt-4o-2024-11-20",
|
|
2504
|
+
"gpt-4o-audio-preview",
|
|
2505
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
2506
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
2507
|
+
"gpt-4o-search-preview",
|
|
2508
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
2509
|
+
"gpt-4o-mini-search-preview",
|
|
2510
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
2511
|
+
"gpt-4o-mini",
|
|
2512
|
+
"gpt-4o-mini-2024-07-18",
|
|
2513
|
+
"gpt-4-turbo",
|
|
2514
|
+
"gpt-4-turbo-2024-04-09",
|
|
2515
|
+
"gpt-4-turbo-preview",
|
|
2516
|
+
"gpt-4-0125-preview",
|
|
2517
|
+
"gpt-4-1106-preview",
|
|
2518
|
+
"gpt-4",
|
|
2519
|
+
"gpt-4-0613",
|
|
2520
|
+
"gpt-4.5-preview",
|
|
2521
|
+
"gpt-4.5-preview-2025-02-27",
|
|
2522
|
+
"gpt-3.5-turbo-0125",
|
|
2523
|
+
"gpt-3.5-turbo",
|
|
2524
|
+
"gpt-3.5-turbo-1106",
|
|
2525
|
+
"chatgpt-4o-latest",
|
|
2526
|
+
"gpt-5-chat-latest",
|
|
2527
|
+
...openaiResponsesReasoningModelIds
|
|
2528
|
+
];
|
|
2529
|
+
var openaiResponsesProviderOptionsSchema = lazyValidator12(
|
|
2439
2530
|
() => zodSchema12(
|
|
2440
2531
|
z13.object({
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2532
|
+
conversation: z13.string().nullish(),
|
|
2533
|
+
include: z13.array(
|
|
2534
|
+
z13.enum([
|
|
2535
|
+
"reasoning.encrypted_content",
|
|
2536
|
+
// handled internally by default, only needed for unknown reasoning models
|
|
2537
|
+
"file_search_call.results",
|
|
2538
|
+
"message.output_text.logprobs"
|
|
2539
|
+
])
|
|
2540
|
+
).nullish(),
|
|
2541
|
+
instructions: z13.string().nullish(),
|
|
2542
|
+
/**
|
|
2543
|
+
* Return the log probabilities of the tokens.
|
|
2544
|
+
*
|
|
2545
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
2546
|
+
* were generated.
|
|
2547
|
+
*
|
|
2548
|
+
* Setting to a number will return the log probabilities of the top n
|
|
2549
|
+
* tokens that were generated.
|
|
2550
|
+
*
|
|
2551
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2552
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2553
|
+
*/
|
|
2554
|
+
logprobs: z13.union([z13.boolean(), z13.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2555
|
+
/**
|
|
2556
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2557
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2558
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
2559
|
+
*/
|
|
2560
|
+
maxToolCalls: z13.number().nullish(),
|
|
2561
|
+
metadata: z13.any().nullish(),
|
|
2562
|
+
parallelToolCalls: z13.boolean().nullish(),
|
|
2563
|
+
previousResponseId: z13.string().nullish(),
|
|
2564
|
+
promptCacheKey: z13.string().nullish(),
|
|
2565
|
+
/**
|
|
2566
|
+
* Prompt cache behavior for GPT-5.6 and later models.
|
|
2567
|
+
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
2568
|
+
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
2569
|
+
*/
|
|
2570
|
+
promptCacheOptions: z13.object({
|
|
2571
|
+
mode: z13.enum(["implicit", "explicit"]).optional(),
|
|
2572
|
+
ttl: z13.literal("30m").optional()
|
|
2573
|
+
}).optional(),
|
|
2574
|
+
/**
|
|
2575
|
+
* The retention policy for the prompt cache.
|
|
2576
|
+
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
2577
|
+
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
2578
|
+
* Available for models before GPT-5.6 that support extended caching.
|
|
2579
|
+
*
|
|
2580
|
+
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
2581
|
+
*
|
|
2582
|
+
* @default 'in_memory'
|
|
2583
|
+
*/
|
|
2584
|
+
promptCacheRetention: z13.enum(["in_memory", "24h"]).nullish(),
|
|
2585
|
+
/**
|
|
2586
|
+
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
2587
|
+
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
2588
|
+
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
2589
|
+
* Supported values vary by model.
|
|
2590
|
+
*/
|
|
2591
|
+
reasoningEffort: z13.string().nullish(),
|
|
2592
|
+
/**
|
|
2593
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
2594
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
2595
|
+
* request prefix for prompt caching.
|
|
2596
|
+
*
|
|
2597
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
2598
|
+
* combined with automatic truncation.
|
|
2599
|
+
*/
|
|
2600
|
+
reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
2601
|
+
/**
|
|
2602
|
+
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
2603
|
+
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
2604
|
+
*/
|
|
2605
|
+
reasoningMode: z13.enum(["standard", "pro"]).optional(),
|
|
2606
|
+
/**
|
|
2607
|
+
* Controls which available reasoning items GPT-5.6 can use.
|
|
2608
|
+
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
2609
|
+
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
2610
|
+
*/
|
|
2611
|
+
reasoningContext: z13.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
2612
|
+
reasoningSummary: z13.string().nullish(),
|
|
2613
|
+
safetyIdentifier: z13.string().nullish(),
|
|
2614
|
+
serviceTier: z13.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
2615
|
+
store: z13.boolean().nullish(),
|
|
2616
|
+
strictJsonSchema: z13.boolean().nullish(),
|
|
2617
|
+
textVerbosity: z13.enum(["low", "medium", "high"]).nullish(),
|
|
2618
|
+
truncation: z13.enum(["auto", "disabled"]).nullish(),
|
|
2619
|
+
user: z13.string().nullish()
|
|
2620
|
+
})
|
|
2621
|
+
)
|
|
2622
|
+
);
|
|
2623
|
+
var openaiResponsesSystemMessageOptionsSchema = lazyValidator12(
|
|
2624
|
+
() => zodSchema12(
|
|
2625
|
+
z13.object({
|
|
2626
|
+
/**
|
|
2627
|
+
* Emit a configuration update at this position in Responses history.
|
|
2628
|
+
* Requires empty system message content and the same supported
|
|
2629
|
+
* configuration as the request-level reasoningEffortUpdate option.
|
|
2630
|
+
* Unsupported historical updates throw instead of being omitted.
|
|
2631
|
+
*
|
|
2632
|
+
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
2633
|
+
*/
|
|
2634
|
+
reasoningEffortUpdate: z13.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
2635
|
+
})
|
|
2636
|
+
)
|
|
2637
|
+
);
|
|
2638
|
+
|
|
2639
|
+
// src/tool/local-shell.ts
|
|
2640
|
+
import {
|
|
2641
|
+
createProviderDefinedToolFactoryWithOutputSchema,
|
|
2642
|
+
lazySchema,
|
|
2643
|
+
zodSchema as zodSchema13
|
|
2644
|
+
} from "@ai-sdk/provider-utils";
|
|
2645
|
+
import { z as z14 } from "zod/v4";
|
|
2646
|
+
var localShellInputSchema = lazySchema(
|
|
2647
|
+
() => zodSchema13(
|
|
2648
|
+
z14.object({
|
|
2649
|
+
action: z14.object({
|
|
2650
|
+
type: z14.literal("exec"),
|
|
2651
|
+
command: z14.array(z14.string()),
|
|
2652
|
+
timeoutMs: z14.number().optional(),
|
|
2653
|
+
user: z14.string().optional(),
|
|
2654
|
+
workingDirectory: z14.string().optional(),
|
|
2655
|
+
env: z14.record(z14.string(), z14.string()).optional()
|
|
2448
2656
|
})
|
|
2449
2657
|
})
|
|
2450
2658
|
)
|
|
2451
2659
|
);
|
|
2452
2660
|
var localShellOutputSchema = lazySchema(
|
|
2453
|
-
() =>
|
|
2661
|
+
() => zodSchema13(z14.object({ output: z14.string() }))
|
|
2454
2662
|
);
|
|
2455
2663
|
var localShell = createProviderDefinedToolFactoryWithOutputSchema({
|
|
2456
2664
|
id: "openai.local_shell",
|
|
@@ -2471,9 +2679,11 @@ function isFileId(data, prefixes) {
|
|
|
2471
2679
|
async function convertToOpenAIResponsesInput({
|
|
2472
2680
|
prompt,
|
|
2473
2681
|
systemMessageMode,
|
|
2682
|
+
providerOptionsName = "openai",
|
|
2474
2683
|
explicitMessageItemType = false,
|
|
2475
2684
|
fileIdPrefixes,
|
|
2476
2685
|
store,
|
|
2686
|
+
configurationUpdateUnsupportedReason,
|
|
2477
2687
|
hasLocalShellTool = false
|
|
2478
2688
|
}) {
|
|
2479
2689
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -2482,6 +2692,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
2482
2692
|
for (const { role, content, providerOptions } of prompt) {
|
|
2483
2693
|
switch (role) {
|
|
2484
2694
|
case "system": {
|
|
2695
|
+
let options = await parseProviderOptions7({
|
|
2696
|
+
provider: providerOptionsName,
|
|
2697
|
+
providerOptions,
|
|
2698
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2699
|
+
});
|
|
2700
|
+
if (options == null && providerOptionsName !== "openai") {
|
|
2701
|
+
options = await parseProviderOptions7({
|
|
2702
|
+
provider: "openai",
|
|
2703
|
+
providerOptions,
|
|
2704
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2707
|
+
const effort = options == null ? void 0 : options.reasoningEffortUpdate;
|
|
2708
|
+
if (effort != null) {
|
|
2709
|
+
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
2710
|
+
if (unsupportedReason != null) {
|
|
2711
|
+
throw new UnsupportedFunctionalityError4({
|
|
2712
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
2713
|
+
message: unsupportedReason
|
|
2714
|
+
});
|
|
2715
|
+
}
|
|
2716
|
+
input.push({
|
|
2717
|
+
type: "configuration_update",
|
|
2718
|
+
reasoning: { effort }
|
|
2719
|
+
});
|
|
2720
|
+
break;
|
|
2721
|
+
}
|
|
2485
2722
|
switch (systemMessageMode) {
|
|
2486
2723
|
case "system": {
|
|
2487
2724
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
|
|
@@ -2827,9 +3064,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2827
3064
|
}
|
|
2828
3065
|
return { input, warnings };
|
|
2829
3066
|
}
|
|
2830
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2831
|
-
itemId:
|
|
2832
|
-
reasoningEncryptedContent:
|
|
3067
|
+
var openaiResponsesReasoningProviderOptionsSchema = z15.object({
|
|
3068
|
+
itemId: z15.string().nullish(),
|
|
3069
|
+
reasoningEncryptedContent: z15.string().nullish()
|
|
2833
3070
|
});
|
|
2834
3071
|
|
|
2835
3072
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2852,290 +3089,290 @@ function mapOpenAIResponseFinishReason({
|
|
|
2852
3089
|
|
|
2853
3090
|
// src/responses/openai-responses-api.ts
|
|
2854
3091
|
import {
|
|
2855
|
-
lazyValidator as
|
|
2856
|
-
zodSchema as
|
|
3092
|
+
lazyValidator as lazyValidator13,
|
|
3093
|
+
zodSchema as zodSchema14
|
|
2857
3094
|
} from "@ai-sdk/provider-utils";
|
|
2858
|
-
import { z as
|
|
2859
|
-
var openaiResponsesChunkSchema =
|
|
2860
|
-
() =>
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
type:
|
|
2864
|
-
item_id:
|
|
2865
|
-
delta:
|
|
2866
|
-
logprobs:
|
|
2867
|
-
|
|
2868
|
-
token:
|
|
2869
|
-
logprob:
|
|
2870
|
-
top_logprobs:
|
|
2871
|
-
|
|
2872
|
-
token:
|
|
2873
|
-
logprob:
|
|
3095
|
+
import { z as z16 } from "zod/v4";
|
|
3096
|
+
var openaiResponsesChunkSchema = lazyValidator13(
|
|
3097
|
+
() => zodSchema14(
|
|
3098
|
+
z16.union([
|
|
3099
|
+
z16.object({
|
|
3100
|
+
type: z16.literal("response.output_text.delta"),
|
|
3101
|
+
item_id: z16.string(),
|
|
3102
|
+
delta: z16.string(),
|
|
3103
|
+
logprobs: z16.array(
|
|
3104
|
+
z16.object({
|
|
3105
|
+
token: z16.string(),
|
|
3106
|
+
logprob: z16.number(),
|
|
3107
|
+
top_logprobs: z16.array(
|
|
3108
|
+
z16.object({
|
|
3109
|
+
token: z16.string(),
|
|
3110
|
+
logprob: z16.number()
|
|
2874
3111
|
})
|
|
2875
3112
|
)
|
|
2876
3113
|
})
|
|
2877
3114
|
).nullish()
|
|
2878
3115
|
}),
|
|
2879
|
-
|
|
2880
|
-
type:
|
|
2881
|
-
response:
|
|
2882
|
-
incomplete_details:
|
|
2883
|
-
usage:
|
|
2884
|
-
input_tokens:
|
|
2885
|
-
input_tokens_details:
|
|
2886
|
-
cached_tokens:
|
|
2887
|
-
cache_write_tokens:
|
|
2888
|
-
orchestration_input_tokens:
|
|
2889
|
-
orchestration_input_cached_tokens:
|
|
3116
|
+
z16.object({
|
|
3117
|
+
type: z16.enum(["response.completed", "response.incomplete"]),
|
|
3118
|
+
response: z16.object({
|
|
3119
|
+
incomplete_details: z16.object({ reason: z16.string() }).nullish(),
|
|
3120
|
+
usage: z16.object({
|
|
3121
|
+
input_tokens: z16.number(),
|
|
3122
|
+
input_tokens_details: z16.object({
|
|
3123
|
+
cached_tokens: z16.number().nullish(),
|
|
3124
|
+
cache_write_tokens: z16.number().nullish(),
|
|
3125
|
+
orchestration_input_tokens: z16.number().nullish(),
|
|
3126
|
+
orchestration_input_cached_tokens: z16.number().nullish()
|
|
2890
3127
|
}).nullish(),
|
|
2891
|
-
output_tokens:
|
|
2892
|
-
output_tokens_details:
|
|
2893
|
-
reasoning_tokens:
|
|
2894
|
-
orchestration_output_tokens:
|
|
3128
|
+
output_tokens: z16.number(),
|
|
3129
|
+
output_tokens_details: z16.object({
|
|
3130
|
+
reasoning_tokens: z16.number().nullish(),
|
|
3131
|
+
orchestration_output_tokens: z16.number().nullish()
|
|
2895
3132
|
}).nullish()
|
|
2896
3133
|
}),
|
|
2897
|
-
reasoning:
|
|
2898
|
-
context:
|
|
3134
|
+
reasoning: z16.object({
|
|
3135
|
+
context: z16.string().nullish()
|
|
2899
3136
|
}).nullish(),
|
|
2900
|
-
service_tier:
|
|
3137
|
+
service_tier: z16.string().nullish()
|
|
2901
3138
|
})
|
|
2902
3139
|
}),
|
|
2903
|
-
|
|
2904
|
-
type:
|
|
2905
|
-
response:
|
|
2906
|
-
id:
|
|
2907
|
-
created_at:
|
|
2908
|
-
model:
|
|
2909
|
-
service_tier:
|
|
3140
|
+
z16.object({
|
|
3141
|
+
type: z16.literal("response.created"),
|
|
3142
|
+
response: z16.object({
|
|
3143
|
+
id: z16.string(),
|
|
3144
|
+
created_at: z16.number(),
|
|
3145
|
+
model: z16.string(),
|
|
3146
|
+
service_tier: z16.string().nullish()
|
|
2910
3147
|
})
|
|
2911
3148
|
}),
|
|
2912
|
-
|
|
2913
|
-
type:
|
|
2914
|
-
output_index:
|
|
2915
|
-
item:
|
|
2916
|
-
|
|
2917
|
-
type:
|
|
2918
|
-
id:
|
|
2919
|
-
phase:
|
|
3149
|
+
z16.object({
|
|
3150
|
+
type: z16.literal("response.output_item.added"),
|
|
3151
|
+
output_index: z16.number(),
|
|
3152
|
+
item: z16.discriminatedUnion("type", [
|
|
3153
|
+
z16.object({
|
|
3154
|
+
type: z16.literal("message"),
|
|
3155
|
+
id: z16.string(),
|
|
3156
|
+
phase: z16.enum(["commentary", "final_answer"]).nullish()
|
|
2920
3157
|
}),
|
|
2921
|
-
|
|
2922
|
-
type:
|
|
2923
|
-
id:
|
|
2924
|
-
encrypted_content:
|
|
3158
|
+
z16.object({
|
|
3159
|
+
type: z16.literal("reasoning"),
|
|
3160
|
+
id: z16.string(),
|
|
3161
|
+
encrypted_content: z16.string().nullish()
|
|
2925
3162
|
}),
|
|
2926
|
-
|
|
2927
|
-
type:
|
|
2928
|
-
id:
|
|
2929
|
-
call_id:
|
|
2930
|
-
name:
|
|
2931
|
-
arguments:
|
|
2932
|
-
async:
|
|
3163
|
+
z16.object({
|
|
3164
|
+
type: z16.literal("function_call"),
|
|
3165
|
+
id: z16.string(),
|
|
3166
|
+
call_id: z16.string(),
|
|
3167
|
+
name: z16.string(),
|
|
3168
|
+
arguments: z16.string(),
|
|
3169
|
+
async: z16.boolean().nullish()
|
|
2933
3170
|
}),
|
|
2934
|
-
|
|
2935
|
-
type:
|
|
2936
|
-
id:
|
|
2937
|
-
status:
|
|
3171
|
+
z16.object({
|
|
3172
|
+
type: z16.literal("web_search_call"),
|
|
3173
|
+
id: z16.string(),
|
|
3174
|
+
status: z16.string()
|
|
2938
3175
|
}),
|
|
2939
|
-
|
|
2940
|
-
type:
|
|
2941
|
-
id:
|
|
2942
|
-
status:
|
|
3176
|
+
z16.object({
|
|
3177
|
+
type: z16.literal("computer_call"),
|
|
3178
|
+
id: z16.string(),
|
|
3179
|
+
status: z16.string()
|
|
2943
3180
|
}),
|
|
2944
|
-
|
|
2945
|
-
type:
|
|
2946
|
-
id:
|
|
3181
|
+
z16.object({
|
|
3182
|
+
type: z16.literal("file_search_call"),
|
|
3183
|
+
id: z16.string()
|
|
2947
3184
|
}),
|
|
2948
|
-
|
|
2949
|
-
type:
|
|
2950
|
-
id:
|
|
3185
|
+
z16.object({
|
|
3186
|
+
type: z16.literal("image_generation_call"),
|
|
3187
|
+
id: z16.string()
|
|
2951
3188
|
}),
|
|
2952
|
-
|
|
2953
|
-
type:
|
|
2954
|
-
id:
|
|
2955
|
-
container_id:
|
|
2956
|
-
code:
|
|
2957
|
-
outputs:
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
3189
|
+
z16.object({
|
|
3190
|
+
type: z16.literal("code_interpreter_call"),
|
|
3191
|
+
id: z16.string(),
|
|
3192
|
+
container_id: z16.string(),
|
|
3193
|
+
code: z16.string().nullable(),
|
|
3194
|
+
outputs: z16.array(
|
|
3195
|
+
z16.discriminatedUnion("type", [
|
|
3196
|
+
z16.object({ type: z16.literal("logs"), logs: z16.string() }),
|
|
3197
|
+
z16.object({ type: z16.literal("image"), url: z16.string() })
|
|
2961
3198
|
])
|
|
2962
3199
|
).nullable(),
|
|
2963
|
-
status:
|
|
3200
|
+
status: z16.string()
|
|
2964
3201
|
})
|
|
2965
3202
|
])
|
|
2966
3203
|
}),
|
|
2967
|
-
|
|
2968
|
-
type:
|
|
2969
|
-
output_index:
|
|
2970
|
-
item:
|
|
2971
|
-
|
|
2972
|
-
type:
|
|
2973
|
-
id:
|
|
2974
|
-
phase:
|
|
3204
|
+
z16.object({
|
|
3205
|
+
type: z16.literal("response.output_item.done"),
|
|
3206
|
+
output_index: z16.number(),
|
|
3207
|
+
item: z16.discriminatedUnion("type", [
|
|
3208
|
+
z16.object({
|
|
3209
|
+
type: z16.literal("message"),
|
|
3210
|
+
id: z16.string(),
|
|
3211
|
+
phase: z16.enum(["commentary", "final_answer"]).nullish()
|
|
2975
3212
|
}),
|
|
2976
|
-
|
|
2977
|
-
type:
|
|
2978
|
-
id:
|
|
2979
|
-
encrypted_content:
|
|
3213
|
+
z16.object({
|
|
3214
|
+
type: z16.literal("reasoning"),
|
|
3215
|
+
id: z16.string(),
|
|
3216
|
+
encrypted_content: z16.string().nullish()
|
|
2980
3217
|
}),
|
|
2981
|
-
|
|
2982
|
-
type:
|
|
2983
|
-
id:
|
|
2984
|
-
call_id:
|
|
2985
|
-
name:
|
|
2986
|
-
arguments:
|
|
2987
|
-
async:
|
|
2988
|
-
status:
|
|
3218
|
+
z16.object({
|
|
3219
|
+
type: z16.literal("function_call"),
|
|
3220
|
+
id: z16.string(),
|
|
3221
|
+
call_id: z16.string(),
|
|
3222
|
+
name: z16.string(),
|
|
3223
|
+
arguments: z16.string(),
|
|
3224
|
+
async: z16.boolean().nullish(),
|
|
3225
|
+
status: z16.enum(["in_progress", "completed", "incomplete"])
|
|
2989
3226
|
}),
|
|
2990
|
-
|
|
2991
|
-
type:
|
|
2992
|
-
id:
|
|
2993
|
-
code:
|
|
2994
|
-
container_id:
|
|
2995
|
-
outputs:
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
3227
|
+
z16.object({
|
|
3228
|
+
type: z16.literal("code_interpreter_call"),
|
|
3229
|
+
id: z16.string(),
|
|
3230
|
+
code: z16.string().nullable(),
|
|
3231
|
+
container_id: z16.string(),
|
|
3232
|
+
outputs: z16.array(
|
|
3233
|
+
z16.discriminatedUnion("type", [
|
|
3234
|
+
z16.object({ type: z16.literal("logs"), logs: z16.string() }),
|
|
3235
|
+
z16.object({ type: z16.literal("image"), url: z16.string() })
|
|
2999
3236
|
])
|
|
3000
3237
|
).nullable()
|
|
3001
3238
|
}),
|
|
3002
|
-
|
|
3003
|
-
type:
|
|
3004
|
-
id:
|
|
3005
|
-
result:
|
|
3239
|
+
z16.object({
|
|
3240
|
+
type: z16.literal("image_generation_call"),
|
|
3241
|
+
id: z16.string(),
|
|
3242
|
+
result: z16.string()
|
|
3006
3243
|
}),
|
|
3007
|
-
|
|
3008
|
-
type:
|
|
3009
|
-
id:
|
|
3010
|
-
status:
|
|
3011
|
-
action:
|
|
3012
|
-
|
|
3013
|
-
type:
|
|
3014
|
-
query:
|
|
3015
|
-
sources:
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3244
|
+
z16.object({
|
|
3245
|
+
type: z16.literal("web_search_call"),
|
|
3246
|
+
id: z16.string(),
|
|
3247
|
+
status: z16.string(),
|
|
3248
|
+
action: z16.discriminatedUnion("type", [
|
|
3249
|
+
z16.object({
|
|
3250
|
+
type: z16.literal("search"),
|
|
3251
|
+
query: z16.string().nullish(),
|
|
3252
|
+
sources: z16.array(
|
|
3253
|
+
z16.discriminatedUnion("type", [
|
|
3254
|
+
z16.object({ type: z16.literal("url"), url: z16.string() }),
|
|
3255
|
+
z16.object({ type: z16.literal("api"), name: z16.string() })
|
|
3019
3256
|
])
|
|
3020
3257
|
).nullish()
|
|
3021
3258
|
}),
|
|
3022
|
-
|
|
3023
|
-
type:
|
|
3024
|
-
url:
|
|
3259
|
+
z16.object({
|
|
3260
|
+
type: z16.literal("open_page"),
|
|
3261
|
+
url: z16.string().nullish()
|
|
3025
3262
|
}),
|
|
3026
|
-
|
|
3027
|
-
type:
|
|
3028
|
-
url:
|
|
3029
|
-
pattern:
|
|
3263
|
+
z16.object({
|
|
3264
|
+
type: z16.literal("find_in_page"),
|
|
3265
|
+
url: z16.string().nullish(),
|
|
3266
|
+
pattern: z16.string().nullish()
|
|
3030
3267
|
})
|
|
3031
3268
|
]).nullish()
|
|
3032
3269
|
}),
|
|
3033
|
-
|
|
3034
|
-
type:
|
|
3035
|
-
id:
|
|
3036
|
-
queries:
|
|
3037
|
-
results:
|
|
3038
|
-
|
|
3039
|
-
attributes:
|
|
3040
|
-
file_id:
|
|
3041
|
-
filename:
|
|
3042
|
-
score:
|
|
3043
|
-
text:
|
|
3270
|
+
z16.object({
|
|
3271
|
+
type: z16.literal("file_search_call"),
|
|
3272
|
+
id: z16.string(),
|
|
3273
|
+
queries: z16.array(z16.string()),
|
|
3274
|
+
results: z16.array(
|
|
3275
|
+
z16.object({
|
|
3276
|
+
attributes: z16.record(z16.string(), z16.unknown()),
|
|
3277
|
+
file_id: z16.string(),
|
|
3278
|
+
filename: z16.string(),
|
|
3279
|
+
score: z16.number(),
|
|
3280
|
+
text: z16.string()
|
|
3044
3281
|
})
|
|
3045
3282
|
).nullish()
|
|
3046
3283
|
}),
|
|
3047
|
-
|
|
3048
|
-
type:
|
|
3049
|
-
id:
|
|
3050
|
-
call_id:
|
|
3051
|
-
action:
|
|
3052
|
-
type:
|
|
3053
|
-
command:
|
|
3054
|
-
timeout_ms:
|
|
3055
|
-
user:
|
|
3056
|
-
working_directory:
|
|
3057
|
-
env:
|
|
3284
|
+
z16.object({
|
|
3285
|
+
type: z16.literal("local_shell_call"),
|
|
3286
|
+
id: z16.string(),
|
|
3287
|
+
call_id: z16.string(),
|
|
3288
|
+
action: z16.object({
|
|
3289
|
+
type: z16.literal("exec"),
|
|
3290
|
+
command: z16.array(z16.string()),
|
|
3291
|
+
timeout_ms: z16.number().optional(),
|
|
3292
|
+
user: z16.string().optional(),
|
|
3293
|
+
working_directory: z16.string().optional(),
|
|
3294
|
+
env: z16.record(z16.string(), z16.string()).optional()
|
|
3058
3295
|
})
|
|
3059
3296
|
}),
|
|
3060
|
-
|
|
3061
|
-
type:
|
|
3062
|
-
id:
|
|
3063
|
-
status:
|
|
3297
|
+
z16.object({
|
|
3298
|
+
type: z16.literal("computer_call"),
|
|
3299
|
+
id: z16.string(),
|
|
3300
|
+
status: z16.literal("completed")
|
|
3064
3301
|
})
|
|
3065
3302
|
])
|
|
3066
3303
|
}),
|
|
3067
|
-
|
|
3068
|
-
type:
|
|
3069
|
-
item_id:
|
|
3070
|
-
output_index:
|
|
3071
|
-
delta:
|
|
3304
|
+
z16.object({
|
|
3305
|
+
type: z16.literal("response.function_call_arguments.delta"),
|
|
3306
|
+
item_id: z16.string(),
|
|
3307
|
+
output_index: z16.number(),
|
|
3308
|
+
delta: z16.string()
|
|
3072
3309
|
}),
|
|
3073
|
-
|
|
3074
|
-
type:
|
|
3075
|
-
item_id:
|
|
3076
|
-
output_index:
|
|
3077
|
-
partial_image_b64:
|
|
3310
|
+
z16.object({
|
|
3311
|
+
type: z16.literal("response.image_generation_call.partial_image"),
|
|
3312
|
+
item_id: z16.string(),
|
|
3313
|
+
output_index: z16.number(),
|
|
3314
|
+
partial_image_b64: z16.string()
|
|
3078
3315
|
}),
|
|
3079
|
-
|
|
3080
|
-
type:
|
|
3081
|
-
item_id:
|
|
3082
|
-
output_index:
|
|
3083
|
-
delta:
|
|
3316
|
+
z16.object({
|
|
3317
|
+
type: z16.literal("response.code_interpreter_call_code.delta"),
|
|
3318
|
+
item_id: z16.string(),
|
|
3319
|
+
output_index: z16.number(),
|
|
3320
|
+
delta: z16.string()
|
|
3084
3321
|
}),
|
|
3085
|
-
|
|
3086
|
-
type:
|
|
3087
|
-
item_id:
|
|
3088
|
-
output_index:
|
|
3089
|
-
code:
|
|
3322
|
+
z16.object({
|
|
3323
|
+
type: z16.literal("response.code_interpreter_call_code.done"),
|
|
3324
|
+
item_id: z16.string(),
|
|
3325
|
+
output_index: z16.number(),
|
|
3326
|
+
code: z16.string()
|
|
3090
3327
|
}),
|
|
3091
|
-
|
|
3092
|
-
type:
|
|
3093
|
-
annotation:
|
|
3094
|
-
|
|
3095
|
-
type:
|
|
3096
|
-
start_index:
|
|
3097
|
-
end_index:
|
|
3098
|
-
url:
|
|
3099
|
-
title:
|
|
3328
|
+
z16.object({
|
|
3329
|
+
type: z16.literal("response.output_text.annotation.added"),
|
|
3330
|
+
annotation: z16.discriminatedUnion("type", [
|
|
3331
|
+
z16.object({
|
|
3332
|
+
type: z16.literal("url_citation"),
|
|
3333
|
+
start_index: z16.number(),
|
|
3334
|
+
end_index: z16.number(),
|
|
3335
|
+
url: z16.string(),
|
|
3336
|
+
title: z16.string()
|
|
3100
3337
|
}),
|
|
3101
|
-
|
|
3102
|
-
type:
|
|
3103
|
-
file_id:
|
|
3104
|
-
filename:
|
|
3105
|
-
index:
|
|
3106
|
-
start_index:
|
|
3107
|
-
end_index:
|
|
3108
|
-
quote:
|
|
3338
|
+
z16.object({
|
|
3339
|
+
type: z16.literal("file_citation"),
|
|
3340
|
+
file_id: z16.string(),
|
|
3341
|
+
filename: z16.string().nullish(),
|
|
3342
|
+
index: z16.number().nullish(),
|
|
3343
|
+
start_index: z16.number().nullish(),
|
|
3344
|
+
end_index: z16.number().nullish(),
|
|
3345
|
+
quote: z16.string().nullish()
|
|
3109
3346
|
})
|
|
3110
3347
|
])
|
|
3111
3348
|
}),
|
|
3112
|
-
|
|
3113
|
-
type:
|
|
3114
|
-
item_id:
|
|
3115
|
-
summary_index:
|
|
3349
|
+
z16.object({
|
|
3350
|
+
type: z16.literal("response.reasoning_summary_part.added"),
|
|
3351
|
+
item_id: z16.string(),
|
|
3352
|
+
summary_index: z16.number()
|
|
3116
3353
|
}),
|
|
3117
|
-
|
|
3118
|
-
type:
|
|
3119
|
-
item_id:
|
|
3120
|
-
summary_index:
|
|
3121
|
-
delta:
|
|
3354
|
+
z16.object({
|
|
3355
|
+
type: z16.literal("response.reasoning_summary_text.delta"),
|
|
3356
|
+
item_id: z16.string(),
|
|
3357
|
+
summary_index: z16.number(),
|
|
3358
|
+
delta: z16.string()
|
|
3122
3359
|
}),
|
|
3123
|
-
|
|
3124
|
-
type:
|
|
3125
|
-
item_id:
|
|
3126
|
-
summary_index:
|
|
3360
|
+
z16.object({
|
|
3361
|
+
type: z16.literal("response.reasoning_summary_part.done"),
|
|
3362
|
+
item_id: z16.string(),
|
|
3363
|
+
summary_index: z16.number()
|
|
3127
3364
|
}),
|
|
3128
|
-
|
|
3129
|
-
type:
|
|
3130
|
-
sequence_number:
|
|
3131
|
-
error:
|
|
3132
|
-
type:
|
|
3133
|
-
code:
|
|
3134
|
-
message:
|
|
3135
|
-
param:
|
|
3365
|
+
z16.object({
|
|
3366
|
+
type: z16.literal("error"),
|
|
3367
|
+
sequence_number: z16.number(),
|
|
3368
|
+
error: z16.object({
|
|
3369
|
+
type: z16.string(),
|
|
3370
|
+
code: z16.string(),
|
|
3371
|
+
message: z16.string(),
|
|
3372
|
+
param: z16.string().nullish()
|
|
3136
3373
|
})
|
|
3137
3374
|
}),
|
|
3138
|
-
|
|
3375
|
+
z16.object({ type: z16.string() }).loose().transform((value) => ({
|
|
3139
3376
|
type: "unknown_chunk",
|
|
3140
3377
|
message: value.type
|
|
3141
3378
|
}))
|
|
@@ -3143,392 +3380,203 @@ var openaiResponsesChunkSchema = lazyValidator12(
|
|
|
3143
3380
|
])
|
|
3144
3381
|
)
|
|
3145
3382
|
);
|
|
3146
|
-
var openaiResponsesResponseSchema =
|
|
3147
|
-
() =>
|
|
3148
|
-
|
|
3149
|
-
id:
|
|
3150
|
-
created_at:
|
|
3151
|
-
error:
|
|
3152
|
-
message:
|
|
3153
|
-
type:
|
|
3154
|
-
param:
|
|
3155
|
-
code:
|
|
3383
|
+
var openaiResponsesResponseSchema = lazyValidator13(
|
|
3384
|
+
() => zodSchema14(
|
|
3385
|
+
z16.object({
|
|
3386
|
+
id: z16.string().optional(),
|
|
3387
|
+
created_at: z16.number().optional(),
|
|
3388
|
+
error: z16.object({
|
|
3389
|
+
message: z16.string(),
|
|
3390
|
+
type: z16.string(),
|
|
3391
|
+
param: z16.string().nullish(),
|
|
3392
|
+
code: z16.string()
|
|
3156
3393
|
}).nullish(),
|
|
3157
|
-
model:
|
|
3158
|
-
output:
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
type:
|
|
3162
|
-
role:
|
|
3163
|
-
id:
|
|
3164
|
-
phase:
|
|
3165
|
-
content:
|
|
3166
|
-
|
|
3167
|
-
type:
|
|
3168
|
-
text:
|
|
3169
|
-
logprobs:
|
|
3170
|
-
|
|
3171
|
-
token:
|
|
3172
|
-
logprob:
|
|
3173
|
-
top_logprobs:
|
|
3174
|
-
|
|
3175
|
-
token:
|
|
3176
|
-
logprob:
|
|
3394
|
+
model: z16.string().optional(),
|
|
3395
|
+
output: z16.array(
|
|
3396
|
+
z16.discriminatedUnion("type", [
|
|
3397
|
+
z16.object({
|
|
3398
|
+
type: z16.literal("message"),
|
|
3399
|
+
role: z16.literal("assistant"),
|
|
3400
|
+
id: z16.string(),
|
|
3401
|
+
phase: z16.enum(["commentary", "final_answer"]).nullish(),
|
|
3402
|
+
content: z16.array(
|
|
3403
|
+
z16.object({
|
|
3404
|
+
type: z16.literal("output_text"),
|
|
3405
|
+
text: z16.string(),
|
|
3406
|
+
logprobs: z16.array(
|
|
3407
|
+
z16.object({
|
|
3408
|
+
token: z16.string(),
|
|
3409
|
+
logprob: z16.number(),
|
|
3410
|
+
top_logprobs: z16.array(
|
|
3411
|
+
z16.object({
|
|
3412
|
+
token: z16.string(),
|
|
3413
|
+
logprob: z16.number()
|
|
3177
3414
|
})
|
|
3178
3415
|
)
|
|
3179
3416
|
})
|
|
3180
3417
|
).nullish(),
|
|
3181
|
-
annotations:
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
type:
|
|
3185
|
-
start_index:
|
|
3186
|
-
end_index:
|
|
3187
|
-
url:
|
|
3188
|
-
title:
|
|
3418
|
+
annotations: z16.array(
|
|
3419
|
+
z16.discriminatedUnion("type", [
|
|
3420
|
+
z16.object({
|
|
3421
|
+
type: z16.literal("url_citation"),
|
|
3422
|
+
start_index: z16.number(),
|
|
3423
|
+
end_index: z16.number(),
|
|
3424
|
+
url: z16.string(),
|
|
3425
|
+
title: z16.string()
|
|
3189
3426
|
}),
|
|
3190
|
-
|
|
3191
|
-
type:
|
|
3192
|
-
file_id:
|
|
3193
|
-
filename:
|
|
3194
|
-
index:
|
|
3195
|
-
start_index:
|
|
3196
|
-
end_index:
|
|
3197
|
-
quote:
|
|
3427
|
+
z16.object({
|
|
3428
|
+
type: z16.literal("file_citation"),
|
|
3429
|
+
file_id: z16.string(),
|
|
3430
|
+
filename: z16.string().nullish(),
|
|
3431
|
+
index: z16.number().nullish(),
|
|
3432
|
+
start_index: z16.number().nullish(),
|
|
3433
|
+
end_index: z16.number().nullish(),
|
|
3434
|
+
quote: z16.string().nullish()
|
|
3198
3435
|
}),
|
|
3199
|
-
|
|
3200
|
-
type:
|
|
3201
|
-
container_id:
|
|
3202
|
-
file_id:
|
|
3203
|
-
filename:
|
|
3204
|
-
start_index:
|
|
3205
|
-
end_index:
|
|
3206
|
-
index:
|
|
3436
|
+
z16.object({
|
|
3437
|
+
type: z16.literal("container_file_citation"),
|
|
3438
|
+
container_id: z16.string(),
|
|
3439
|
+
file_id: z16.string(),
|
|
3440
|
+
filename: z16.string().nullish(),
|
|
3441
|
+
start_index: z16.number().nullish(),
|
|
3442
|
+
end_index: z16.number().nullish(),
|
|
3443
|
+
index: z16.number().nullish()
|
|
3207
3444
|
}),
|
|
3208
|
-
|
|
3209
|
-
type:
|
|
3210
|
-
file_id:
|
|
3211
|
-
index:
|
|
3445
|
+
z16.object({
|
|
3446
|
+
type: z16.literal("file_path"),
|
|
3447
|
+
file_id: z16.string(),
|
|
3448
|
+
index: z16.number().nullish()
|
|
3212
3449
|
})
|
|
3213
3450
|
])
|
|
3214
3451
|
)
|
|
3215
3452
|
})
|
|
3216
3453
|
)
|
|
3217
3454
|
}),
|
|
3218
|
-
|
|
3219
|
-
type:
|
|
3220
|
-
id:
|
|
3221
|
-
status:
|
|
3222
|
-
action:
|
|
3223
|
-
|
|
3224
|
-
type:
|
|
3225
|
-
query:
|
|
3226
|
-
sources:
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
type:
|
|
3231
|
-
name:
|
|
3455
|
+
z16.object({
|
|
3456
|
+
type: z16.literal("web_search_call"),
|
|
3457
|
+
id: z16.string(),
|
|
3458
|
+
status: z16.string(),
|
|
3459
|
+
action: z16.discriminatedUnion("type", [
|
|
3460
|
+
z16.object({
|
|
3461
|
+
type: z16.literal("search"),
|
|
3462
|
+
query: z16.string().nullish(),
|
|
3463
|
+
sources: z16.array(
|
|
3464
|
+
z16.discriminatedUnion("type", [
|
|
3465
|
+
z16.object({ type: z16.literal("url"), url: z16.string() }),
|
|
3466
|
+
z16.object({
|
|
3467
|
+
type: z16.literal("api"),
|
|
3468
|
+
name: z16.string()
|
|
3232
3469
|
})
|
|
3233
3470
|
])
|
|
3234
3471
|
).nullish()
|
|
3235
3472
|
}),
|
|
3236
|
-
|
|
3237
|
-
type:
|
|
3238
|
-
url:
|
|
3473
|
+
z16.object({
|
|
3474
|
+
type: z16.literal("open_page"),
|
|
3475
|
+
url: z16.string().nullish()
|
|
3239
3476
|
}),
|
|
3240
|
-
|
|
3241
|
-
type:
|
|
3242
|
-
url:
|
|
3243
|
-
pattern:
|
|
3477
|
+
z16.object({
|
|
3478
|
+
type: z16.literal("find_in_page"),
|
|
3479
|
+
url: z16.string().nullish(),
|
|
3480
|
+
pattern: z16.string().nullish()
|
|
3244
3481
|
})
|
|
3245
3482
|
]).nullish()
|
|
3246
3483
|
}),
|
|
3247
|
-
|
|
3248
|
-
type:
|
|
3249
|
-
id:
|
|
3250
|
-
queries:
|
|
3251
|
-
results:
|
|
3252
|
-
|
|
3253
|
-
attributes:
|
|
3254
|
-
|
|
3255
|
-
|
|
3484
|
+
z16.object({
|
|
3485
|
+
type: z16.literal("file_search_call"),
|
|
3486
|
+
id: z16.string(),
|
|
3487
|
+
queries: z16.array(z16.string()),
|
|
3488
|
+
results: z16.array(
|
|
3489
|
+
z16.object({
|
|
3490
|
+
attributes: z16.record(
|
|
3491
|
+
z16.string(),
|
|
3492
|
+
z16.union([z16.string(), z16.number(), z16.boolean()])
|
|
3256
3493
|
),
|
|
3257
|
-
file_id:
|
|
3258
|
-
filename:
|
|
3259
|
-
score:
|
|
3260
|
-
text:
|
|
3494
|
+
file_id: z16.string(),
|
|
3495
|
+
filename: z16.string(),
|
|
3496
|
+
score: z16.number(),
|
|
3497
|
+
text: z16.string()
|
|
3261
3498
|
})
|
|
3262
3499
|
).nullish()
|
|
3263
3500
|
}),
|
|
3264
|
-
|
|
3265
|
-
type:
|
|
3266
|
-
id:
|
|
3267
|
-
code:
|
|
3268
|
-
container_id:
|
|
3269
|
-
outputs:
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3501
|
+
z16.object({
|
|
3502
|
+
type: z16.literal("code_interpreter_call"),
|
|
3503
|
+
id: z16.string(),
|
|
3504
|
+
code: z16.string().nullable(),
|
|
3505
|
+
container_id: z16.string(),
|
|
3506
|
+
outputs: z16.array(
|
|
3507
|
+
z16.discriminatedUnion("type", [
|
|
3508
|
+
z16.object({ type: z16.literal("logs"), logs: z16.string() }),
|
|
3509
|
+
z16.object({ type: z16.literal("image"), url: z16.string() })
|
|
3273
3510
|
])
|
|
3274
3511
|
).nullable()
|
|
3275
3512
|
}),
|
|
3276
|
-
|
|
3277
|
-
type:
|
|
3278
|
-
id:
|
|
3279
|
-
result:
|
|
3513
|
+
z16.object({
|
|
3514
|
+
type: z16.literal("image_generation_call"),
|
|
3515
|
+
id: z16.string(),
|
|
3516
|
+
result: z16.string()
|
|
3280
3517
|
}),
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
id:
|
|
3284
|
-
call_id:
|
|
3285
|
-
action:
|
|
3286
|
-
type:
|
|
3287
|
-
command:
|
|
3288
|
-
timeout_ms:
|
|
3289
|
-
user:
|
|
3290
|
-
working_directory:
|
|
3291
|
-
env:
|
|
3518
|
+
z16.object({
|
|
3519
|
+
type: z16.literal("local_shell_call"),
|
|
3520
|
+
id: z16.string(),
|
|
3521
|
+
call_id: z16.string(),
|
|
3522
|
+
action: z16.object({
|
|
3523
|
+
type: z16.literal("exec"),
|
|
3524
|
+
command: z16.array(z16.string()),
|
|
3525
|
+
timeout_ms: z16.number().optional(),
|
|
3526
|
+
user: z16.string().optional(),
|
|
3527
|
+
working_directory: z16.string().optional(),
|
|
3528
|
+
env: z16.record(z16.string(), z16.string()).optional()
|
|
3292
3529
|
})
|
|
3293
3530
|
}),
|
|
3294
|
-
|
|
3295
|
-
type:
|
|
3296
|
-
call_id:
|
|
3297
|
-
name:
|
|
3298
|
-
arguments:
|
|
3299
|
-
id:
|
|
3300
|
-
async:
|
|
3531
|
+
z16.object({
|
|
3532
|
+
type: z16.literal("function_call"),
|
|
3533
|
+
call_id: z16.string(),
|
|
3534
|
+
name: z16.string(),
|
|
3535
|
+
arguments: z16.string(),
|
|
3536
|
+
id: z16.string(),
|
|
3537
|
+
async: z16.boolean().nullish()
|
|
3301
3538
|
}),
|
|
3302
|
-
|
|
3303
|
-
type:
|
|
3304
|
-
id:
|
|
3305
|
-
status:
|
|
3539
|
+
z16.object({
|
|
3540
|
+
type: z16.literal("computer_call"),
|
|
3541
|
+
id: z16.string(),
|
|
3542
|
+
status: z16.string().optional()
|
|
3306
3543
|
}),
|
|
3307
|
-
|
|
3308
|
-
type:
|
|
3309
|
-
id:
|
|
3310
|
-
encrypted_content:
|
|
3311
|
-
summary:
|
|
3312
|
-
|
|
3313
|
-
type:
|
|
3314
|
-
text:
|
|
3544
|
+
z16.object({
|
|
3545
|
+
type: z16.literal("reasoning"),
|
|
3546
|
+
id: z16.string(),
|
|
3547
|
+
encrypted_content: z16.string().nullish(),
|
|
3548
|
+
summary: z16.array(
|
|
3549
|
+
z16.object({
|
|
3550
|
+
type: z16.literal("summary_text"),
|
|
3551
|
+
text: z16.string()
|
|
3315
3552
|
})
|
|
3316
3553
|
)
|
|
3317
3554
|
})
|
|
3318
3555
|
])
|
|
3319
3556
|
).optional(),
|
|
3320
|
-
service_tier:
|
|
3321
|
-
reasoning:
|
|
3322
|
-
context:
|
|
3557
|
+
service_tier: z16.string().nullish(),
|
|
3558
|
+
reasoning: z16.object({
|
|
3559
|
+
context: z16.string().nullish()
|
|
3323
3560
|
}).nullish(),
|
|
3324
|
-
incomplete_details:
|
|
3325
|
-
usage:
|
|
3326
|
-
input_tokens:
|
|
3327
|
-
input_tokens_details:
|
|
3328
|
-
cached_tokens:
|
|
3329
|
-
cache_write_tokens:
|
|
3330
|
-
orchestration_input_tokens:
|
|
3331
|
-
orchestration_input_cached_tokens:
|
|
3561
|
+
incomplete_details: z16.object({ reason: z16.string() }).nullish(),
|
|
3562
|
+
usage: z16.object({
|
|
3563
|
+
input_tokens: z16.number(),
|
|
3564
|
+
input_tokens_details: z16.object({
|
|
3565
|
+
cached_tokens: z16.number().nullish(),
|
|
3566
|
+
cache_write_tokens: z16.number().nullish(),
|
|
3567
|
+
orchestration_input_tokens: z16.number().nullish(),
|
|
3568
|
+
orchestration_input_cached_tokens: z16.number().nullish()
|
|
3332
3569
|
}).nullish(),
|
|
3333
|
-
output_tokens:
|
|
3334
|
-
output_tokens_details:
|
|
3335
|
-
reasoning_tokens:
|
|
3336
|
-
orchestration_output_tokens:
|
|
3570
|
+
output_tokens: z16.number(),
|
|
3571
|
+
output_tokens_details: z16.object({
|
|
3572
|
+
reasoning_tokens: z16.number().nullish(),
|
|
3573
|
+
orchestration_output_tokens: z16.number().nullish()
|
|
3337
3574
|
}).nullish()
|
|
3338
3575
|
}).optional()
|
|
3339
3576
|
})
|
|
3340
3577
|
)
|
|
3341
3578
|
);
|
|
3342
3579
|
|
|
3343
|
-
// src/responses/openai-responses-options.ts
|
|
3344
|
-
import {
|
|
3345
|
-
lazyValidator as lazyValidator13,
|
|
3346
|
-
zodSchema as zodSchema14
|
|
3347
|
-
} from "@ai-sdk/provider-utils";
|
|
3348
|
-
import { z as z16 } from "zod/v4";
|
|
3349
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
3350
|
-
var openaiResponsesReasoningModelIds = [
|
|
3351
|
-
"o1",
|
|
3352
|
-
"o1-2024-12-17",
|
|
3353
|
-
"o3",
|
|
3354
|
-
"o3-2025-04-16",
|
|
3355
|
-
"o3-deep-research",
|
|
3356
|
-
"o3-deep-research-2025-06-26",
|
|
3357
|
-
"o3-mini",
|
|
3358
|
-
"o3-mini-2025-01-31",
|
|
3359
|
-
"o4-mini",
|
|
3360
|
-
"o4-mini-2025-04-16",
|
|
3361
|
-
"o4-mini-deep-research",
|
|
3362
|
-
"o4-mini-deep-research-2025-06-26",
|
|
3363
|
-
"codex-mini-latest",
|
|
3364
|
-
"computer-use-preview",
|
|
3365
|
-
"gpt-5",
|
|
3366
|
-
"gpt-5-2025-08-07",
|
|
3367
|
-
"gpt-5-codex",
|
|
3368
|
-
"gpt-5-mini",
|
|
3369
|
-
"gpt-5-mini-2025-08-07",
|
|
3370
|
-
"gpt-5-nano",
|
|
3371
|
-
"gpt-5-nano-2025-08-07",
|
|
3372
|
-
"gpt-5-pro",
|
|
3373
|
-
"gpt-5-pro-2025-10-06",
|
|
3374
|
-
"gpt-5.1",
|
|
3375
|
-
"gpt-5.1-chat-latest",
|
|
3376
|
-
"gpt-5.1-codex-mini",
|
|
3377
|
-
"gpt-5.1-codex",
|
|
3378
|
-
"gpt-5.1-codex-max",
|
|
3379
|
-
"gpt-5.2",
|
|
3380
|
-
"gpt-5.2-chat-latest",
|
|
3381
|
-
"gpt-5.2-pro",
|
|
3382
|
-
"gpt-5.2-codex",
|
|
3383
|
-
"gpt-5.3-chat-latest",
|
|
3384
|
-
"gpt-5.3-codex",
|
|
3385
|
-
"gpt-5.4",
|
|
3386
|
-
"gpt-5.4-2026-03-05",
|
|
3387
|
-
"gpt-5.4-mini",
|
|
3388
|
-
"gpt-5.4-mini-2026-03-17",
|
|
3389
|
-
"gpt-5.4-nano",
|
|
3390
|
-
"gpt-5.4-nano-2026-03-17",
|
|
3391
|
-
"gpt-5.4-pro",
|
|
3392
|
-
"gpt-5.4-pro-2026-03-05",
|
|
3393
|
-
"gpt-5.6",
|
|
3394
|
-
"gpt-5.6-luna",
|
|
3395
|
-
"gpt-5.6-sol",
|
|
3396
|
-
"gpt-5.6-terra",
|
|
3397
|
-
"gpt-6-astra",
|
|
3398
|
-
"gpt-6-luna",
|
|
3399
|
-
"gpt-6-sol"
|
|
3400
|
-
];
|
|
3401
|
-
var openaiResponsesModelIds = [
|
|
3402
|
-
"gpt-4.1",
|
|
3403
|
-
"gpt-4.1-2025-04-14",
|
|
3404
|
-
"gpt-4.1-mini",
|
|
3405
|
-
"gpt-4.1-mini-2025-04-14",
|
|
3406
|
-
"gpt-4.1-nano",
|
|
3407
|
-
"gpt-4.1-nano-2025-04-14",
|
|
3408
|
-
"gpt-4o",
|
|
3409
|
-
"gpt-4o-2024-05-13",
|
|
3410
|
-
"gpt-4o-2024-08-06",
|
|
3411
|
-
"gpt-4o-2024-11-20",
|
|
3412
|
-
"gpt-4o-audio-preview",
|
|
3413
|
-
"gpt-4o-audio-preview-2024-10-01",
|
|
3414
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
3415
|
-
"gpt-4o-search-preview",
|
|
3416
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
3417
|
-
"gpt-4o-mini-search-preview",
|
|
3418
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3419
|
-
"gpt-4o-mini",
|
|
3420
|
-
"gpt-4o-mini-2024-07-18",
|
|
3421
|
-
"gpt-4-turbo",
|
|
3422
|
-
"gpt-4-turbo-2024-04-09",
|
|
3423
|
-
"gpt-4-turbo-preview",
|
|
3424
|
-
"gpt-4-0125-preview",
|
|
3425
|
-
"gpt-4-1106-preview",
|
|
3426
|
-
"gpt-4",
|
|
3427
|
-
"gpt-4-0613",
|
|
3428
|
-
"gpt-4.5-preview",
|
|
3429
|
-
"gpt-4.5-preview-2025-02-27",
|
|
3430
|
-
"gpt-3.5-turbo-0125",
|
|
3431
|
-
"gpt-3.5-turbo",
|
|
3432
|
-
"gpt-3.5-turbo-1106",
|
|
3433
|
-
"chatgpt-4o-latest",
|
|
3434
|
-
"gpt-5-chat-latest",
|
|
3435
|
-
...openaiResponsesReasoningModelIds
|
|
3436
|
-
];
|
|
3437
|
-
var openaiResponsesProviderOptionsSchema = lazyValidator13(
|
|
3438
|
-
() => zodSchema14(
|
|
3439
|
-
z16.object({
|
|
3440
|
-
conversation: z16.string().nullish(),
|
|
3441
|
-
include: z16.array(
|
|
3442
|
-
z16.enum([
|
|
3443
|
-
"reasoning.encrypted_content",
|
|
3444
|
-
// handled internally by default, only needed for unknown reasoning models
|
|
3445
|
-
"file_search_call.results",
|
|
3446
|
-
"message.output_text.logprobs"
|
|
3447
|
-
])
|
|
3448
|
-
).nullish(),
|
|
3449
|
-
instructions: z16.string().nullish(),
|
|
3450
|
-
/**
|
|
3451
|
-
* Return the log probabilities of the tokens.
|
|
3452
|
-
*
|
|
3453
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
3454
|
-
* were generated.
|
|
3455
|
-
*
|
|
3456
|
-
* Setting to a number will return the log probabilities of the top n
|
|
3457
|
-
* tokens that were generated.
|
|
3458
|
-
*
|
|
3459
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3460
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3461
|
-
*/
|
|
3462
|
-
logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3463
|
-
/**
|
|
3464
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3465
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3466
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
3467
|
-
*/
|
|
3468
|
-
maxToolCalls: z16.number().nullish(),
|
|
3469
|
-
metadata: z16.any().nullish(),
|
|
3470
|
-
parallelToolCalls: z16.boolean().nullish(),
|
|
3471
|
-
previousResponseId: z16.string().nullish(),
|
|
3472
|
-
promptCacheKey: z16.string().nullish(),
|
|
3473
|
-
/**
|
|
3474
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3475
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3476
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3477
|
-
*/
|
|
3478
|
-
promptCacheOptions: z16.object({
|
|
3479
|
-
mode: z16.enum(["implicit", "explicit"]).optional(),
|
|
3480
|
-
ttl: z16.literal("30m").optional()
|
|
3481
|
-
}).optional(),
|
|
3482
|
-
/**
|
|
3483
|
-
* The retention policy for the prompt cache.
|
|
3484
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3485
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3486
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
3487
|
-
*
|
|
3488
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3489
|
-
*
|
|
3490
|
-
* @default 'in_memory'
|
|
3491
|
-
*/
|
|
3492
|
-
promptCacheRetention: z16.enum(["in_memory", "24h"]).nullish(),
|
|
3493
|
-
/**
|
|
3494
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3495
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3496
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3497
|
-
* Supported values vary by model.
|
|
3498
|
-
*/
|
|
3499
|
-
reasoningEffort: z16.string().nullish(),
|
|
3500
|
-
/**
|
|
3501
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3502
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
3503
|
-
* request prefix for prompt caching.
|
|
3504
|
-
*
|
|
3505
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3506
|
-
* combined with automatic truncation.
|
|
3507
|
-
*/
|
|
3508
|
-
reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3509
|
-
/**
|
|
3510
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3511
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3512
|
-
*/
|
|
3513
|
-
reasoningMode: z16.enum(["standard", "pro"]).optional(),
|
|
3514
|
-
/**
|
|
3515
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
3516
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3517
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3518
|
-
*/
|
|
3519
|
-
reasoningContext: z16.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3520
|
-
reasoningSummary: z16.string().nullish(),
|
|
3521
|
-
safetyIdentifier: z16.string().nullish(),
|
|
3522
|
-
serviceTier: z16.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3523
|
-
store: z16.boolean().nullish(),
|
|
3524
|
-
strictJsonSchema: z16.boolean().nullish(),
|
|
3525
|
-
textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
|
|
3526
|
-
truncation: z16.enum(["auto", "disabled"]).nullish(),
|
|
3527
|
-
user: z16.string().nullish()
|
|
3528
|
-
})
|
|
3529
|
-
)
|
|
3530
|
-
);
|
|
3531
|
-
|
|
3532
3580
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3533
3581
|
import {
|
|
3534
3582
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError5
|
|
@@ -3962,6 +4010,18 @@ function resolveAsyncToolOption({
|
|
|
3962
4010
|
}
|
|
3963
4011
|
|
|
3964
4012
|
// src/responses/openai-responses-language-model.ts
|
|
4013
|
+
function getConfigurationUpdateUnsupportedReason({
|
|
4014
|
+
modelCapabilities,
|
|
4015
|
+
options
|
|
4016
|
+
}) {
|
|
4017
|
+
if (!modelCapabilities.supportsConfigurationUpdate) {
|
|
4018
|
+
return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
4019
|
+
}
|
|
4020
|
+
if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
|
|
4021
|
+
return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
|
|
4022
|
+
}
|
|
4023
|
+
return void 0;
|
|
4024
|
+
}
|
|
3965
4025
|
var OpenAIResponsesLanguageModel = class {
|
|
3966
4026
|
constructor(modelId, config) {
|
|
3967
4027
|
this.specificationVersion = "v2";
|
|
@@ -4026,8 +4086,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4026
4086
|
details: "conversation and previousResponseId cannot be used together"
|
|
4027
4087
|
});
|
|
4028
4088
|
}
|
|
4089
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
4090
|
+
modelCapabilities,
|
|
4091
|
+
options: openaiOptions
|
|
4092
|
+
});
|
|
4029
4093
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
4030
4094
|
prompt,
|
|
4095
|
+
configurationUpdateUnsupportedReason,
|
|
4096
|
+
providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
|
|
4031
4097
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
4032
4098
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
4033
4099
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
@@ -4047,18 +4113,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4047
4113
|
resolvedReasoningEffort = void 0;
|
|
4048
4114
|
}
|
|
4049
4115
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
4050
|
-
|
|
4051
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
4116
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
4052
4117
|
warnings.push({
|
|
4053
4118
|
type: "unsupported-setting",
|
|
4054
4119
|
setting: "reasoningEffortUpdate",
|
|
4055
|
-
details:
|
|
4120
|
+
details: configurationUpdateUnsupportedReason
|
|
4056
4121
|
});
|
|
4057
4122
|
} else if (reasoningEffortUpdate != null) {
|
|
4058
|
-
input
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4123
|
+
const firstItem = input[0];
|
|
4124
|
+
if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
|
|
4125
|
+
input.unshift({
|
|
4126
|
+
type: "configuration_update",
|
|
4127
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
4128
|
+
});
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4131
|
+
for (let i = 1; i < input.length; i++) {
|
|
4132
|
+
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
4133
|
+
throw new UnsupportedFunctionalityError6({
|
|
4134
|
+
functionality: "Adjacent reasoning effort configuration updates"
|
|
4135
|
+
});
|
|
4136
|
+
}
|
|
4062
4137
|
}
|
|
4063
4138
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
4064
4139
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
@@ -4713,7 +4788,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4713
4788
|
providerExecuted: true
|
|
4714
4789
|
});
|
|
4715
4790
|
} else if (value.item.type === "message") {
|
|
4716
|
-
ongoingAnnotations.splice(0
|
|
4791
|
+
ongoingAnnotations.splice(0);
|
|
4717
4792
|
activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
|
|
4718
4793
|
controller.enqueue({
|
|
4719
4794
|
type: "text-start",
|