@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.js
CHANGED
|
@@ -419,6 +419,9 @@ var openaiChatResponseSchema = (0, import_provider_utils3.lazyValidator)(
|
|
|
419
419
|
message: import_v42.z.object({
|
|
420
420
|
role: import_v42.z.literal("assistant").nullish(),
|
|
421
421
|
content: import_v42.z.string().nullish(),
|
|
422
|
+
audio: import_v42.z.object({
|
|
423
|
+
transcript: import_v42.z.string().nullish()
|
|
424
|
+
}).nullish(),
|
|
422
425
|
tool_calls: import_v42.z.array(
|
|
423
426
|
import_v42.z.object({
|
|
424
427
|
id: import_v42.z.string().nullish(),
|
|
@@ -954,7 +957,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
954
957
|
};
|
|
955
958
|
}
|
|
956
959
|
async doGenerate(options) {
|
|
957
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
960
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
958
961
|
const { args: body, warnings } = await this.getArgs(options);
|
|
959
962
|
const {
|
|
960
963
|
responseHeaders,
|
|
@@ -982,19 +985,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
982
985
|
});
|
|
983
986
|
}
|
|
984
987
|
const content = [];
|
|
985
|
-
const text = choice.message.content;
|
|
988
|
+
const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
|
|
986
989
|
if (text != null && text.length > 0) {
|
|
987
990
|
content.push({ type: "text", text });
|
|
988
991
|
}
|
|
989
|
-
for (const toolCall of (
|
|
992
|
+
for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
|
|
990
993
|
content.push({
|
|
991
994
|
type: "tool-call",
|
|
992
|
-
toolCallId: (
|
|
995
|
+
toolCallId: (_c = toolCall.id) != null ? _c : (0, import_provider_utils5.generateId)(),
|
|
993
996
|
toolName: toolCall.function.name,
|
|
994
997
|
input: toolCall.function.arguments
|
|
995
998
|
});
|
|
996
999
|
}
|
|
997
|
-
for (const annotation of (
|
|
1000
|
+
for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
|
|
998
1001
|
content.push({
|
|
999
1002
|
type: "source",
|
|
1000
1003
|
sourceType: "url",
|
|
@@ -1003,8 +1006,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
1003
1006
|
title: annotation.url_citation.title
|
|
1004
1007
|
});
|
|
1005
1008
|
}
|
|
1006
|
-
const completionTokenDetails = (
|
|
1007
|
-
const promptTokenDetails = (
|
|
1009
|
+
const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
|
|
1010
|
+
const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
|
|
1008
1011
|
const providerMetadata = { openai: {} };
|
|
1009
1012
|
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
|
|
1010
1013
|
providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
|
|
@@ -1017,18 +1020,18 @@ var OpenAIChatLanguageModel = class {
|
|
|
1017
1020
|
cacheWriteTokens: promptTokenDetails.cache_write_tokens
|
|
1018
1021
|
};
|
|
1019
1022
|
}
|
|
1020
|
-
if (((
|
|
1023
|
+
if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
|
|
1021
1024
|
providerMetadata.openai.logprobs = choice.logprobs.content;
|
|
1022
1025
|
}
|
|
1023
1026
|
return {
|
|
1024
1027
|
content,
|
|
1025
1028
|
finishReason: mapOpenAIFinishReason(choice.finish_reason),
|
|
1026
1029
|
usage: {
|
|
1027
|
-
inputTokens: (
|
|
1028
|
-
outputTokens: (
|
|
1029
|
-
totalTokens: (
|
|
1030
|
-
reasoningTokens: (
|
|
1031
|
-
cachedInputTokens: (
|
|
1030
|
+
inputTokens: (_i = (_h = response.usage) == null ? void 0 : _h.prompt_tokens) != null ? _i : void 0,
|
|
1031
|
+
outputTokens: (_k = (_j = response.usage) == null ? void 0 : _j.completion_tokens) != null ? _k : void 0,
|
|
1032
|
+
totalTokens: (_m = (_l = response.usage) == null ? void 0 : _l.total_tokens) != null ? _m : void 0,
|
|
1033
|
+
reasoningTokens: (_n = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _n : void 0,
|
|
1034
|
+
cachedInputTokens: (_o = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _o : void 0
|
|
1032
1035
|
},
|
|
1033
1036
|
request: { body },
|
|
1034
1037
|
response: {
|
|
@@ -2398,30 +2401,231 @@ var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
|
2398
2401
|
|
|
2399
2402
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2400
2403
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2401
|
-
var
|
|
2402
|
-
var
|
|
2404
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2405
|
+
var import_v415 = require("zod/v4");
|
|
2403
2406
|
|
|
2404
|
-
// src/
|
|
2407
|
+
// src/responses/openai-responses-options.ts
|
|
2405
2408
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2406
2409
|
var import_v413 = require("zod/v4");
|
|
2407
|
-
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)(
|
|
2499
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2500
|
+
import_v413.z.object({
|
|
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)(
|
|
2408
2593
|
() => (0, import_provider_utils20.zodSchema)(
|
|
2409
2594
|
import_v413.z.object({
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
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()
|
|
2417
2621
|
})
|
|
2418
2622
|
})
|
|
2419
2623
|
)
|
|
2420
2624
|
);
|
|
2421
|
-
var localShellOutputSchema = (0,
|
|
2422
|
-
() => (0,
|
|
2625
|
+
var localShellOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2626
|
+
() => (0, import_provider_utils21.zodSchema)(import_v414.z.object({ output: import_v414.z.string() }))
|
|
2423
2627
|
);
|
|
2424
|
-
var localShell = (0,
|
|
2628
|
+
var localShell = (0, import_provider_utils21.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2425
2629
|
id: "openai.local_shell",
|
|
2426
2630
|
name: "local_shell",
|
|
2427
2631
|
inputSchema: localShellInputSchema,
|
|
@@ -2440,9 +2644,11 @@ function isFileId(data, prefixes) {
|
|
|
2440
2644
|
async function convertToOpenAIResponsesInput({
|
|
2441
2645
|
prompt,
|
|
2442
2646
|
systemMessageMode,
|
|
2647
|
+
providerOptionsName = "openai",
|
|
2443
2648
|
explicitMessageItemType = false,
|
|
2444
2649
|
fileIdPrefixes,
|
|
2445
2650
|
store,
|
|
2651
|
+
configurationUpdateUnsupportedReason,
|
|
2446
2652
|
hasLocalShellTool = false
|
|
2447
2653
|
}) {
|
|
2448
2654
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -2451,6 +2657,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
2451
2657
|
for (const { role, content, providerOptions } of prompt) {
|
|
2452
2658
|
switch (role) {
|
|
2453
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
|
+
}
|
|
2454
2687
|
switch (systemMessageMode) {
|
|
2455
2688
|
case "system": {
|
|
2456
2689
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
|
|
@@ -2526,7 +2759,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2526
2759
|
return {
|
|
2527
2760
|
type: "input_image",
|
|
2528
2761
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2529
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2762
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2530
2763
|
},
|
|
2531
2764
|
detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3.openai) == null ? void 0 : _b2.imageDetail,
|
|
2532
2765
|
...promptCacheBreakpoint != null && {
|
|
@@ -2547,7 +2780,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2547
2780
|
type: "input_file",
|
|
2548
2781
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2549
2782
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2550
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2783
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2551
2784
|
},
|
|
2552
2785
|
...promptCacheBreakpoint != null && {
|
|
2553
2786
|
prompt_cache_breakpoint: promptCacheBreakpoint
|
|
@@ -2597,7 +2830,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2597
2830
|
break;
|
|
2598
2831
|
}
|
|
2599
2832
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2600
|
-
const parsedInput = await (0,
|
|
2833
|
+
const parsedInput = await (0, import_provider_utils22.validateTypes)({
|
|
2601
2834
|
value: part.input,
|
|
2602
2835
|
schema: localShellInputSchema
|
|
2603
2836
|
});
|
|
@@ -2639,7 +2872,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2639
2872
|
break;
|
|
2640
2873
|
}
|
|
2641
2874
|
case "reasoning": {
|
|
2642
|
-
const providerOptions2 = await (0,
|
|
2875
|
+
const providerOptions2 = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2643
2876
|
provider: "openai",
|
|
2644
2877
|
providerOptions: part.providerOptions,
|
|
2645
2878
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2703,7 +2936,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2703
2936
|
part.providerOptions
|
|
2704
2937
|
);
|
|
2705
2938
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2706
|
-
const parsedOutput = await (0,
|
|
2939
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2707
2940
|
value: output.value,
|
|
2708
2941
|
schema: localShellOutputSchema
|
|
2709
2942
|
});
|
|
@@ -2796,9 +3029,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2796
3029
|
}
|
|
2797
3030
|
return { input, warnings };
|
|
2798
3031
|
}
|
|
2799
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2800
|
-
itemId:
|
|
2801
|
-
reasoningEncryptedContent:
|
|
3032
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
|
|
3033
|
+
itemId: import_v415.z.string().nullish(),
|
|
3034
|
+
reasoningEncryptedContent: import_v415.z.string().nullish()
|
|
2802
3035
|
});
|
|
2803
3036
|
|
|
2804
3037
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2820,288 +3053,288 @@ function mapOpenAIResponseFinishReason({
|
|
|
2820
3053
|
}
|
|
2821
3054
|
|
|
2822
3055
|
// src/responses/openai-responses-api.ts
|
|
2823
|
-
var
|
|
2824
|
-
var
|
|
2825
|
-
var openaiResponsesChunkSchema = (0,
|
|
2826
|
-
() => (0,
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
type:
|
|
2830
|
-
item_id:
|
|
2831
|
-
delta:
|
|
2832
|
-
logprobs:
|
|
2833
|
-
|
|
2834
|
-
token:
|
|
2835
|
-
logprob:
|
|
2836
|
-
top_logprobs:
|
|
2837
|
-
|
|
2838
|
-
token:
|
|
2839
|
-
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()
|
|
2840
3073
|
})
|
|
2841
3074
|
)
|
|
2842
3075
|
})
|
|
2843
3076
|
).nullish()
|
|
2844
3077
|
}),
|
|
2845
|
-
|
|
2846
|
-
type:
|
|
2847
|
-
response:
|
|
2848
|
-
incomplete_details:
|
|
2849
|
-
usage:
|
|
2850
|
-
input_tokens:
|
|
2851
|
-
input_tokens_details:
|
|
2852
|
-
cached_tokens:
|
|
2853
|
-
cache_write_tokens:
|
|
2854
|
-
orchestration_input_tokens:
|
|
2855
|
-
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()
|
|
2856
3089
|
}).nullish(),
|
|
2857
|
-
output_tokens:
|
|
2858
|
-
output_tokens_details:
|
|
2859
|
-
reasoning_tokens:
|
|
2860
|
-
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()
|
|
2861
3094
|
}).nullish()
|
|
2862
3095
|
}),
|
|
2863
|
-
reasoning:
|
|
2864
|
-
context:
|
|
3096
|
+
reasoning: import_v416.z.object({
|
|
3097
|
+
context: import_v416.z.string().nullish()
|
|
2865
3098
|
}).nullish(),
|
|
2866
|
-
service_tier:
|
|
3099
|
+
service_tier: import_v416.z.string().nullish()
|
|
2867
3100
|
})
|
|
2868
3101
|
}),
|
|
2869
|
-
|
|
2870
|
-
type:
|
|
2871
|
-
response:
|
|
2872
|
-
id:
|
|
2873
|
-
created_at:
|
|
2874
|
-
model:
|
|
2875
|
-
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()
|
|
2876
3109
|
})
|
|
2877
3110
|
}),
|
|
2878
|
-
|
|
2879
|
-
type:
|
|
2880
|
-
output_index:
|
|
2881
|
-
item:
|
|
2882
|
-
|
|
2883
|
-
type:
|
|
2884
|
-
id:
|
|
2885
|
-
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()
|
|
2886
3119
|
}),
|
|
2887
|
-
|
|
2888
|
-
type:
|
|
2889
|
-
id:
|
|
2890
|
-
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()
|
|
2891
3124
|
}),
|
|
2892
|
-
|
|
2893
|
-
type:
|
|
2894
|
-
id:
|
|
2895
|
-
call_id:
|
|
2896
|
-
name:
|
|
2897
|
-
arguments:
|
|
2898
|
-
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()
|
|
2899
3132
|
}),
|
|
2900
|
-
|
|
2901
|
-
type:
|
|
2902
|
-
id:
|
|
2903
|
-
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()
|
|
2904
3137
|
}),
|
|
2905
|
-
|
|
2906
|
-
type:
|
|
2907
|
-
id:
|
|
2908
|
-
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()
|
|
2909
3142
|
}),
|
|
2910
|
-
|
|
2911
|
-
type:
|
|
2912
|
-
id:
|
|
3143
|
+
import_v416.z.object({
|
|
3144
|
+
type: import_v416.z.literal("file_search_call"),
|
|
3145
|
+
id: import_v416.z.string()
|
|
2913
3146
|
}),
|
|
2914
|
-
|
|
2915
|
-
type:
|
|
2916
|
-
id:
|
|
3147
|
+
import_v416.z.object({
|
|
3148
|
+
type: import_v416.z.literal("image_generation_call"),
|
|
3149
|
+
id: import_v416.z.string()
|
|
2917
3150
|
}),
|
|
2918
|
-
|
|
2919
|
-
type:
|
|
2920
|
-
id:
|
|
2921
|
-
container_id:
|
|
2922
|
-
code:
|
|
2923
|
-
outputs:
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
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() })
|
|
2927
3160
|
])
|
|
2928
3161
|
).nullable(),
|
|
2929
|
-
status:
|
|
3162
|
+
status: import_v416.z.string()
|
|
2930
3163
|
})
|
|
2931
3164
|
])
|
|
2932
3165
|
}),
|
|
2933
|
-
|
|
2934
|
-
type:
|
|
2935
|
-
output_index:
|
|
2936
|
-
item:
|
|
2937
|
-
|
|
2938
|
-
type:
|
|
2939
|
-
id:
|
|
2940
|
-
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()
|
|
2941
3174
|
}),
|
|
2942
|
-
|
|
2943
|
-
type:
|
|
2944
|
-
id:
|
|
2945
|
-
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()
|
|
2946
3179
|
}),
|
|
2947
|
-
|
|
2948
|
-
type:
|
|
2949
|
-
id:
|
|
2950
|
-
call_id:
|
|
2951
|
-
name:
|
|
2952
|
-
arguments:
|
|
2953
|
-
async:
|
|
2954
|
-
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"])
|
|
2955
3188
|
}),
|
|
2956
|
-
|
|
2957
|
-
type:
|
|
2958
|
-
id:
|
|
2959
|
-
code:
|
|
2960
|
-
container_id:
|
|
2961
|
-
outputs:
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
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() })
|
|
2965
3198
|
])
|
|
2966
3199
|
).nullable()
|
|
2967
3200
|
}),
|
|
2968
|
-
|
|
2969
|
-
type:
|
|
2970
|
-
id:
|
|
2971
|
-
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()
|
|
2972
3205
|
}),
|
|
2973
|
-
|
|
2974
|
-
type:
|
|
2975
|
-
id:
|
|
2976
|
-
status:
|
|
2977
|
-
action:
|
|
2978
|
-
|
|
2979
|
-
type:
|
|
2980
|
-
query:
|
|
2981
|
-
sources:
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
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() })
|
|
2985
3218
|
])
|
|
2986
3219
|
).nullish()
|
|
2987
3220
|
}),
|
|
2988
|
-
|
|
2989
|
-
type:
|
|
2990
|
-
url:
|
|
3221
|
+
import_v416.z.object({
|
|
3222
|
+
type: import_v416.z.literal("open_page"),
|
|
3223
|
+
url: import_v416.z.string().nullish()
|
|
2991
3224
|
}),
|
|
2992
|
-
|
|
2993
|
-
type:
|
|
2994
|
-
url:
|
|
2995
|
-
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()
|
|
2996
3229
|
})
|
|
2997
3230
|
]).nullish()
|
|
2998
3231
|
}),
|
|
2999
|
-
|
|
3000
|
-
type:
|
|
3001
|
-
id:
|
|
3002
|
-
queries:
|
|
3003
|
-
results:
|
|
3004
|
-
|
|
3005
|
-
attributes:
|
|
3006
|
-
file_id:
|
|
3007
|
-
filename:
|
|
3008
|
-
score:
|
|
3009
|
-
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()
|
|
3010
3243
|
})
|
|
3011
3244
|
).nullish()
|
|
3012
3245
|
}),
|
|
3013
|
-
|
|
3014
|
-
type:
|
|
3015
|
-
id:
|
|
3016
|
-
call_id:
|
|
3017
|
-
action:
|
|
3018
|
-
type:
|
|
3019
|
-
command:
|
|
3020
|
-
timeout_ms:
|
|
3021
|
-
user:
|
|
3022
|
-
working_directory:
|
|
3023
|
-
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()
|
|
3024
3257
|
})
|
|
3025
3258
|
}),
|
|
3026
|
-
|
|
3027
|
-
type:
|
|
3028
|
-
id:
|
|
3029
|
-
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")
|
|
3030
3263
|
})
|
|
3031
3264
|
])
|
|
3032
3265
|
}),
|
|
3033
|
-
|
|
3034
|
-
type:
|
|
3035
|
-
item_id:
|
|
3036
|
-
output_index:
|
|
3037
|
-
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()
|
|
3038
3271
|
}),
|
|
3039
|
-
|
|
3040
|
-
type:
|
|
3041
|
-
item_id:
|
|
3042
|
-
output_index:
|
|
3043
|
-
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()
|
|
3044
3277
|
}),
|
|
3045
|
-
|
|
3046
|
-
type:
|
|
3047
|
-
item_id:
|
|
3048
|
-
output_index:
|
|
3049
|
-
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()
|
|
3050
3283
|
}),
|
|
3051
|
-
|
|
3052
|
-
type:
|
|
3053
|
-
item_id:
|
|
3054
|
-
output_index:
|
|
3055
|
-
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()
|
|
3056
3289
|
}),
|
|
3057
|
-
|
|
3058
|
-
type:
|
|
3059
|
-
annotation:
|
|
3060
|
-
|
|
3061
|
-
type:
|
|
3062
|
-
start_index:
|
|
3063
|
-
end_index:
|
|
3064
|
-
url:
|
|
3065
|
-
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()
|
|
3066
3299
|
}),
|
|
3067
|
-
|
|
3068
|
-
type:
|
|
3069
|
-
file_id:
|
|
3070
|
-
filename:
|
|
3071
|
-
index:
|
|
3072
|
-
start_index:
|
|
3073
|
-
end_index:
|
|
3074
|
-
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()
|
|
3075
3308
|
})
|
|
3076
3309
|
])
|
|
3077
3310
|
}),
|
|
3078
|
-
|
|
3079
|
-
type:
|
|
3080
|
-
item_id:
|
|
3081
|
-
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()
|
|
3082
3315
|
}),
|
|
3083
|
-
|
|
3084
|
-
type:
|
|
3085
|
-
item_id:
|
|
3086
|
-
summary_index:
|
|
3087
|
-
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()
|
|
3088
3321
|
}),
|
|
3089
|
-
|
|
3090
|
-
type:
|
|
3091
|
-
item_id:
|
|
3092
|
-
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()
|
|
3093
3326
|
}),
|
|
3094
|
-
|
|
3095
|
-
type:
|
|
3096
|
-
sequence_number:
|
|
3097
|
-
error:
|
|
3098
|
-
type:
|
|
3099
|
-
code:
|
|
3100
|
-
message:
|
|
3101
|
-
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()
|
|
3102
3335
|
})
|
|
3103
3336
|
}),
|
|
3104
|
-
|
|
3337
|
+
import_v416.z.object({ type: import_v416.z.string() }).loose().transform((value) => ({
|
|
3105
3338
|
type: "unknown_chunk",
|
|
3106
3339
|
message: value.type
|
|
3107
3340
|
}))
|
|
@@ -3109,389 +3342,203 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
|
|
|
3109
3342
|
])
|
|
3110
3343
|
)
|
|
3111
3344
|
);
|
|
3112
|
-
var openaiResponsesResponseSchema = (0,
|
|
3113
|
-
() => (0,
|
|
3114
|
-
|
|
3115
|
-
id:
|
|
3116
|
-
created_at:
|
|
3117
|
-
error:
|
|
3118
|
-
message:
|
|
3119
|
-
type:
|
|
3120
|
-
param:
|
|
3121
|
-
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()
|
|
3122
3355
|
}).nullish(),
|
|
3123
|
-
model:
|
|
3124
|
-
output:
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
type:
|
|
3128
|
-
role:
|
|
3129
|
-
id:
|
|
3130
|
-
phase:
|
|
3131
|
-
content:
|
|
3132
|
-
|
|
3133
|
-
type:
|
|
3134
|
-
text:
|
|
3135
|
-
logprobs:
|
|
3136
|
-
|
|
3137
|
-
token:
|
|
3138
|
-
logprob:
|
|
3139
|
-
top_logprobs:
|
|
3140
|
-
|
|
3141
|
-
token:
|
|
3142
|
-
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()
|
|
3143
3376
|
})
|
|
3144
3377
|
)
|
|
3145
3378
|
})
|
|
3146
3379
|
).nullish(),
|
|
3147
|
-
annotations:
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
type:
|
|
3151
|
-
start_index:
|
|
3152
|
-
end_index:
|
|
3153
|
-
url:
|
|
3154
|
-
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()
|
|
3155
3388
|
}),
|
|
3156
|
-
|
|
3157
|
-
type:
|
|
3158
|
-
file_id:
|
|
3159
|
-
filename:
|
|
3160
|
-
index:
|
|
3161
|
-
start_index:
|
|
3162
|
-
end_index:
|
|
3163
|
-
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()
|
|
3164
3397
|
}),
|
|
3165
|
-
|
|
3166
|
-
type:
|
|
3167
|
-
container_id:
|
|
3168
|
-
file_id:
|
|
3169
|
-
filename:
|
|
3170
|
-
start_index:
|
|
3171
|
-
end_index:
|
|
3172
|
-
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()
|
|
3173
3406
|
}),
|
|
3174
|
-
|
|
3175
|
-
type:
|
|
3176
|
-
file_id:
|
|
3177
|
-
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()
|
|
3178
3411
|
})
|
|
3179
3412
|
])
|
|
3180
3413
|
)
|
|
3181
3414
|
})
|
|
3182
3415
|
)
|
|
3183
3416
|
}),
|
|
3184
|
-
|
|
3185
|
-
type:
|
|
3186
|
-
id:
|
|
3187
|
-
status:
|
|
3188
|
-
action:
|
|
3189
|
-
|
|
3190
|
-
type:
|
|
3191
|
-
query:
|
|
3192
|
-
sources:
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
type:
|
|
3197
|
-
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()
|
|
3198
3431
|
})
|
|
3199
3432
|
])
|
|
3200
3433
|
).nullish()
|
|
3201
3434
|
}),
|
|
3202
|
-
|
|
3203
|
-
type:
|
|
3204
|
-
url:
|
|
3435
|
+
import_v416.z.object({
|
|
3436
|
+
type: import_v416.z.literal("open_page"),
|
|
3437
|
+
url: import_v416.z.string().nullish()
|
|
3205
3438
|
}),
|
|
3206
|
-
|
|
3207
|
-
type:
|
|
3208
|
-
url:
|
|
3209
|
-
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()
|
|
3210
3443
|
})
|
|
3211
3444
|
]).nullish()
|
|
3212
3445
|
}),
|
|
3213
|
-
|
|
3214
|
-
type:
|
|
3215
|
-
id:
|
|
3216
|
-
queries:
|
|
3217
|
-
results:
|
|
3218
|
-
|
|
3219
|
-
attributes:
|
|
3220
|
-
|
|
3221
|
-
|
|
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()])
|
|
3222
3455
|
),
|
|
3223
|
-
file_id:
|
|
3224
|
-
filename:
|
|
3225
|
-
score:
|
|
3226
|
-
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()
|
|
3227
3460
|
})
|
|
3228
3461
|
).nullish()
|
|
3229
3462
|
}),
|
|
3230
|
-
|
|
3231
|
-
type:
|
|
3232
|
-
id:
|
|
3233
|
-
code:
|
|
3234
|
-
container_id:
|
|
3235
|
-
outputs:
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
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() })
|
|
3239
3472
|
])
|
|
3240
3473
|
).nullable()
|
|
3241
3474
|
}),
|
|
3242
|
-
|
|
3243
|
-
type:
|
|
3244
|
-
id:
|
|
3245
|
-
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()
|
|
3246
3479
|
}),
|
|
3247
|
-
|
|
3248
|
-
type:
|
|
3249
|
-
id:
|
|
3250
|
-
call_id:
|
|
3251
|
-
action:
|
|
3252
|
-
type:
|
|
3253
|
-
command:
|
|
3254
|
-
timeout_ms:
|
|
3255
|
-
user:
|
|
3256
|
-
working_directory:
|
|
3257
|
-
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()
|
|
3258
3491
|
})
|
|
3259
3492
|
}),
|
|
3260
|
-
|
|
3261
|
-
type:
|
|
3262
|
-
call_id:
|
|
3263
|
-
name:
|
|
3264
|
-
arguments:
|
|
3265
|
-
id:
|
|
3266
|
-
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()
|
|
3267
3500
|
}),
|
|
3268
|
-
|
|
3269
|
-
type:
|
|
3270
|
-
id:
|
|
3271
|
-
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()
|
|
3272
3505
|
}),
|
|
3273
|
-
|
|
3274
|
-
type:
|
|
3275
|
-
id:
|
|
3276
|
-
encrypted_content:
|
|
3277
|
-
summary:
|
|
3278
|
-
|
|
3279
|
-
type:
|
|
3280
|
-
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()
|
|
3281
3514
|
})
|
|
3282
3515
|
)
|
|
3283
3516
|
})
|
|
3284
3517
|
])
|
|
3285
3518
|
).optional(),
|
|
3286
|
-
service_tier:
|
|
3287
|
-
reasoning:
|
|
3288
|
-
context:
|
|
3519
|
+
service_tier: import_v416.z.string().nullish(),
|
|
3520
|
+
reasoning: import_v416.z.object({
|
|
3521
|
+
context: import_v416.z.string().nullish()
|
|
3289
3522
|
}).nullish(),
|
|
3290
|
-
incomplete_details:
|
|
3291
|
-
usage:
|
|
3292
|
-
input_tokens:
|
|
3293
|
-
input_tokens_details:
|
|
3294
|
-
cached_tokens:
|
|
3295
|
-
cache_write_tokens:
|
|
3296
|
-
orchestration_input_tokens:
|
|
3297
|
-
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()
|
|
3298
3531
|
}).nullish(),
|
|
3299
|
-
output_tokens:
|
|
3300
|
-
output_tokens_details:
|
|
3301
|
-
reasoning_tokens:
|
|
3302
|
-
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()
|
|
3303
3536
|
}).nullish()
|
|
3304
3537
|
}).optional()
|
|
3305
3538
|
})
|
|
3306
3539
|
)
|
|
3307
3540
|
);
|
|
3308
3541
|
|
|
3309
|
-
// src/responses/openai-responses-options.ts
|
|
3310
|
-
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3311
|
-
var import_v416 = require("zod/v4");
|
|
3312
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
3313
|
-
var openaiResponsesReasoningModelIds = [
|
|
3314
|
-
"o1",
|
|
3315
|
-
"o1-2024-12-17",
|
|
3316
|
-
"o3",
|
|
3317
|
-
"o3-2025-04-16",
|
|
3318
|
-
"o3-deep-research",
|
|
3319
|
-
"o3-deep-research-2025-06-26",
|
|
3320
|
-
"o3-mini",
|
|
3321
|
-
"o3-mini-2025-01-31",
|
|
3322
|
-
"o4-mini",
|
|
3323
|
-
"o4-mini-2025-04-16",
|
|
3324
|
-
"o4-mini-deep-research",
|
|
3325
|
-
"o4-mini-deep-research-2025-06-26",
|
|
3326
|
-
"codex-mini-latest",
|
|
3327
|
-
"computer-use-preview",
|
|
3328
|
-
"gpt-5",
|
|
3329
|
-
"gpt-5-2025-08-07",
|
|
3330
|
-
"gpt-5-codex",
|
|
3331
|
-
"gpt-5-mini",
|
|
3332
|
-
"gpt-5-mini-2025-08-07",
|
|
3333
|
-
"gpt-5-nano",
|
|
3334
|
-
"gpt-5-nano-2025-08-07",
|
|
3335
|
-
"gpt-5-pro",
|
|
3336
|
-
"gpt-5-pro-2025-10-06",
|
|
3337
|
-
"gpt-5.1",
|
|
3338
|
-
"gpt-5.1-chat-latest",
|
|
3339
|
-
"gpt-5.1-codex-mini",
|
|
3340
|
-
"gpt-5.1-codex",
|
|
3341
|
-
"gpt-5.1-codex-max",
|
|
3342
|
-
"gpt-5.2",
|
|
3343
|
-
"gpt-5.2-chat-latest",
|
|
3344
|
-
"gpt-5.2-pro",
|
|
3345
|
-
"gpt-5.2-codex",
|
|
3346
|
-
"gpt-5.3-chat-latest",
|
|
3347
|
-
"gpt-5.3-codex",
|
|
3348
|
-
"gpt-5.4",
|
|
3349
|
-
"gpt-5.4-2026-03-05",
|
|
3350
|
-
"gpt-5.4-mini",
|
|
3351
|
-
"gpt-5.4-mini-2026-03-17",
|
|
3352
|
-
"gpt-5.4-nano",
|
|
3353
|
-
"gpt-5.4-nano-2026-03-17",
|
|
3354
|
-
"gpt-5.4-pro",
|
|
3355
|
-
"gpt-5.4-pro-2026-03-05",
|
|
3356
|
-
"gpt-5.6",
|
|
3357
|
-
"gpt-5.6-luna",
|
|
3358
|
-
"gpt-5.6-sol",
|
|
3359
|
-
"gpt-5.6-terra",
|
|
3360
|
-
"gpt-6-astra",
|
|
3361
|
-
"gpt-6-luna",
|
|
3362
|
-
"gpt-6-sol"
|
|
3363
|
-
];
|
|
3364
|
-
var openaiResponsesModelIds = [
|
|
3365
|
-
"gpt-4.1",
|
|
3366
|
-
"gpt-4.1-2025-04-14",
|
|
3367
|
-
"gpt-4.1-mini",
|
|
3368
|
-
"gpt-4.1-mini-2025-04-14",
|
|
3369
|
-
"gpt-4.1-nano",
|
|
3370
|
-
"gpt-4.1-nano-2025-04-14",
|
|
3371
|
-
"gpt-4o",
|
|
3372
|
-
"gpt-4o-2024-05-13",
|
|
3373
|
-
"gpt-4o-2024-08-06",
|
|
3374
|
-
"gpt-4o-2024-11-20",
|
|
3375
|
-
"gpt-4o-audio-preview",
|
|
3376
|
-
"gpt-4o-audio-preview-2024-10-01",
|
|
3377
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
3378
|
-
"gpt-4o-search-preview",
|
|
3379
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
3380
|
-
"gpt-4o-mini-search-preview",
|
|
3381
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3382
|
-
"gpt-4o-mini",
|
|
3383
|
-
"gpt-4o-mini-2024-07-18",
|
|
3384
|
-
"gpt-4-turbo",
|
|
3385
|
-
"gpt-4-turbo-2024-04-09",
|
|
3386
|
-
"gpt-4-turbo-preview",
|
|
3387
|
-
"gpt-4-0125-preview",
|
|
3388
|
-
"gpt-4-1106-preview",
|
|
3389
|
-
"gpt-4",
|
|
3390
|
-
"gpt-4-0613",
|
|
3391
|
-
"gpt-4.5-preview",
|
|
3392
|
-
"gpt-4.5-preview-2025-02-27",
|
|
3393
|
-
"gpt-3.5-turbo-0125",
|
|
3394
|
-
"gpt-3.5-turbo",
|
|
3395
|
-
"gpt-3.5-turbo-1106",
|
|
3396
|
-
"chatgpt-4o-latest",
|
|
3397
|
-
"gpt-5-chat-latest",
|
|
3398
|
-
...openaiResponsesReasoningModelIds
|
|
3399
|
-
];
|
|
3400
|
-
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3401
|
-
() => (0, import_provider_utils23.zodSchema)(
|
|
3402
|
-
import_v416.z.object({
|
|
3403
|
-
conversation: import_v416.z.string().nullish(),
|
|
3404
|
-
include: import_v416.z.array(
|
|
3405
|
-
import_v416.z.enum([
|
|
3406
|
-
"reasoning.encrypted_content",
|
|
3407
|
-
// handled internally by default, only needed for unknown reasoning models
|
|
3408
|
-
"file_search_call.results",
|
|
3409
|
-
"message.output_text.logprobs"
|
|
3410
|
-
])
|
|
3411
|
-
).nullish(),
|
|
3412
|
-
instructions: import_v416.z.string().nullish(),
|
|
3413
|
-
/**
|
|
3414
|
-
* Return the log probabilities of the tokens.
|
|
3415
|
-
*
|
|
3416
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
3417
|
-
* were generated.
|
|
3418
|
-
*
|
|
3419
|
-
* Setting to a number will return the log probabilities of the top n
|
|
3420
|
-
* tokens that were generated.
|
|
3421
|
-
*
|
|
3422
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3423
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3424
|
-
*/
|
|
3425
|
-
logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3426
|
-
/**
|
|
3427
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3428
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3429
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
3430
|
-
*/
|
|
3431
|
-
maxToolCalls: import_v416.z.number().nullish(),
|
|
3432
|
-
metadata: import_v416.z.any().nullish(),
|
|
3433
|
-
parallelToolCalls: import_v416.z.boolean().nullish(),
|
|
3434
|
-
previousResponseId: import_v416.z.string().nullish(),
|
|
3435
|
-
promptCacheKey: import_v416.z.string().nullish(),
|
|
3436
|
-
/**
|
|
3437
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3438
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3439
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3440
|
-
*/
|
|
3441
|
-
promptCacheOptions: import_v416.z.object({
|
|
3442
|
-
mode: import_v416.z.enum(["implicit", "explicit"]).optional(),
|
|
3443
|
-
ttl: import_v416.z.literal("30m").optional()
|
|
3444
|
-
}).optional(),
|
|
3445
|
-
/**
|
|
3446
|
-
* The retention policy for the prompt cache.
|
|
3447
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3448
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3449
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
3450
|
-
*
|
|
3451
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3452
|
-
*
|
|
3453
|
-
* @default 'in_memory'
|
|
3454
|
-
*/
|
|
3455
|
-
promptCacheRetention: import_v416.z.enum(["in_memory", "24h"]).nullish(),
|
|
3456
|
-
/**
|
|
3457
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3458
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3459
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3460
|
-
* Supported values vary by model.
|
|
3461
|
-
*/
|
|
3462
|
-
reasoningEffort: import_v416.z.string().nullish(),
|
|
3463
|
-
/**
|
|
3464
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3465
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
3466
|
-
* request prefix for prompt caching.
|
|
3467
|
-
*
|
|
3468
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3469
|
-
* combined with automatic truncation.
|
|
3470
|
-
*/
|
|
3471
|
-
reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3472
|
-
/**
|
|
3473
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3474
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3475
|
-
*/
|
|
3476
|
-
reasoningMode: import_v416.z.enum(["standard", "pro"]).optional(),
|
|
3477
|
-
/**
|
|
3478
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
3479
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3480
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3481
|
-
*/
|
|
3482
|
-
reasoningContext: import_v416.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3483
|
-
reasoningSummary: import_v416.z.string().nullish(),
|
|
3484
|
-
safetyIdentifier: import_v416.z.string().nullish(),
|
|
3485
|
-
serviceTier: import_v416.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3486
|
-
store: import_v416.z.boolean().nullish(),
|
|
3487
|
-
strictJsonSchema: import_v416.z.boolean().nullish(),
|
|
3488
|
-
textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
|
|
3489
|
-
truncation: import_v416.z.enum(["auto", "disabled"]).nullish(),
|
|
3490
|
-
user: import_v416.z.string().nullish()
|
|
3491
|
-
})
|
|
3492
|
-
)
|
|
3493
|
-
);
|
|
3494
|
-
|
|
3495
3542
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3496
3543
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3497
3544
|
|
|
@@ -3903,6 +3950,18 @@ function resolveAsyncToolOption({
|
|
|
3903
3950
|
}
|
|
3904
3951
|
|
|
3905
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
|
+
}
|
|
3906
3965
|
var OpenAIResponsesLanguageModel = class {
|
|
3907
3966
|
constructor(modelId, config) {
|
|
3908
3967
|
this.specificationVersion = "v2";
|
|
@@ -3967,8 +4026,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3967
4026
|
details: "conversation and previousResponseId cannot be used together"
|
|
3968
4027
|
});
|
|
3969
4028
|
}
|
|
4029
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
4030
|
+
modelCapabilities,
|
|
4031
|
+
options: openaiOptions
|
|
4032
|
+
});
|
|
3970
4033
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3971
4034
|
prompt,
|
|
4035
|
+
configurationUpdateUnsupportedReason,
|
|
4036
|
+
providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
|
|
3972
4037
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
3973
4038
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
3974
4039
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
@@ -3988,18 +4053,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3988
4053
|
resolvedReasoningEffort = void 0;
|
|
3989
4054
|
}
|
|
3990
4055
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
3991
|
-
|
|
3992
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
4056
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
3993
4057
|
warnings.push({
|
|
3994
4058
|
type: "unsupported-setting",
|
|
3995
4059
|
setting: "reasoningEffortUpdate",
|
|
3996
|
-
details:
|
|
4060
|
+
details: configurationUpdateUnsupportedReason
|
|
3997
4061
|
});
|
|
3998
4062
|
} else if (reasoningEffortUpdate != null) {
|
|
3999
|
-
input
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
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
|
+
}
|
|
4003
4077
|
}
|
|
4004
4078
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
4005
4079
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
@@ -4654,7 +4728,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4654
4728
|
providerExecuted: true
|
|
4655
4729
|
});
|
|
4656
4730
|
} else if (value.item.type === "message") {
|
|
4657
|
-
ongoingAnnotations.splice(0
|
|
4731
|
+
ongoingAnnotations.splice(0);
|
|
4658
4732
|
activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
|
|
4659
4733
|
controller.enqueue({
|
|
4660
4734
|
type: "text-start",
|