@ai-sdk/openai 2.0.129 → 2.0.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +655 -660
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +656 -660
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +666 -673
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +666 -672
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
InvalidResponseDataError
|
|
12
12
|
} from "@ai-sdk/provider";
|
|
13
13
|
import {
|
|
14
|
+
StreamingToolCallTracker,
|
|
14
15
|
combineHeaders,
|
|
15
16
|
createEventSourceResponseHandler,
|
|
16
17
|
createJsonResponseHandler,
|
|
17
18
|
generateId,
|
|
18
|
-
isParsableJson,
|
|
19
19
|
parseProviderOptions,
|
|
20
20
|
postJsonToApi
|
|
21
21
|
} from "@ai-sdk/provider-utils";
|
|
@@ -1034,7 +1034,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1034
1034
|
abortSignal: options.abortSignal,
|
|
1035
1035
|
fetch: this.config.fetch
|
|
1036
1036
|
});
|
|
1037
|
-
|
|
1037
|
+
let toolCallTracker;
|
|
1038
1038
|
let finishReason = "unknown";
|
|
1039
1039
|
const usage = {
|
|
1040
1040
|
inputTokens: void 0,
|
|
@@ -1048,10 +1048,14 @@ var OpenAIChatLanguageModel = class {
|
|
|
1048
1048
|
stream: response.pipeThrough(
|
|
1049
1049
|
new TransformStream({
|
|
1050
1050
|
start(controller) {
|
|
1051
|
+
toolCallTracker = new StreamingToolCallTracker(controller, {
|
|
1052
|
+
generateId,
|
|
1053
|
+
typeValidation: "if-present"
|
|
1054
|
+
});
|
|
1051
1055
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1052
1056
|
},
|
|
1053
1057
|
transform(chunk, controller) {
|
|
1054
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m
|
|
1058
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1055
1059
|
if (options.includeRawChunks) {
|
|
1056
1060
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
1057
1061
|
}
|
|
@@ -1118,90 +1122,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1118
1122
|
}
|
|
1119
1123
|
if (delta.tool_calls != null) {
|
|
1120
1124
|
for (const toolCallDelta of delta.tool_calls) {
|
|
1121
|
-
|
|
1122
|
-
if (toolCalls[index] == null) {
|
|
1123
|
-
if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
|
|
1124
|
-
throw new InvalidResponseDataError({
|
|
1125
|
-
data: toolCallDelta,
|
|
1126
|
-
message: `Expected 'function' type.`
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
if (toolCallDelta.id == null) {
|
|
1130
|
-
throw new InvalidResponseDataError({
|
|
1131
|
-
data: toolCallDelta,
|
|
1132
|
-
message: `Expected 'id' to be a string.`
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
1135
|
-
if (((_n = toolCallDelta.function) == null ? void 0 : _n.name) == null) {
|
|
1136
|
-
throw new InvalidResponseDataError({
|
|
1137
|
-
data: toolCallDelta,
|
|
1138
|
-
message: `Expected 'function.name' to be a string.`
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
controller.enqueue({
|
|
1142
|
-
type: "tool-input-start",
|
|
1143
|
-
id: toolCallDelta.id,
|
|
1144
|
-
toolName: toolCallDelta.function.name
|
|
1145
|
-
});
|
|
1146
|
-
toolCalls[index] = {
|
|
1147
|
-
id: toolCallDelta.id,
|
|
1148
|
-
type: "function",
|
|
1149
|
-
function: {
|
|
1150
|
-
name: toolCallDelta.function.name,
|
|
1151
|
-
arguments: (_o = toolCallDelta.function.arguments) != null ? _o : ""
|
|
1152
|
-
},
|
|
1153
|
-
hasFinished: false
|
|
1154
|
-
};
|
|
1155
|
-
const toolCall2 = toolCalls[index];
|
|
1156
|
-
if (((_p = toolCall2.function) == null ? void 0 : _p.name) != null && ((_q = toolCall2.function) == null ? void 0 : _q.arguments) != null) {
|
|
1157
|
-
if (toolCall2.function.arguments.length > 0) {
|
|
1158
|
-
controller.enqueue({
|
|
1159
|
-
type: "tool-input-delta",
|
|
1160
|
-
id: toolCall2.id,
|
|
1161
|
-
delta: toolCall2.function.arguments
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
if (isParsableJson(toolCall2.function.arguments)) {
|
|
1165
|
-
controller.enqueue({
|
|
1166
|
-
type: "tool-input-end",
|
|
1167
|
-
id: toolCall2.id
|
|
1168
|
-
});
|
|
1169
|
-
controller.enqueue({
|
|
1170
|
-
type: "tool-call",
|
|
1171
|
-
toolCallId: (_r = toolCall2.id) != null ? _r : generateId(),
|
|
1172
|
-
toolName: toolCall2.function.name,
|
|
1173
|
-
input: toolCall2.function.arguments
|
|
1174
|
-
});
|
|
1175
|
-
toolCall2.hasFinished = true;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
continue;
|
|
1179
|
-
}
|
|
1180
|
-
const toolCall = toolCalls[index];
|
|
1181
|
-
if (toolCall.hasFinished) {
|
|
1182
|
-
continue;
|
|
1183
|
-
}
|
|
1184
|
-
if (((_s = toolCallDelta.function) == null ? void 0 : _s.arguments) != null) {
|
|
1185
|
-
toolCall.function.arguments += (_u = (_t = toolCallDelta.function) == null ? void 0 : _t.arguments) != null ? _u : "";
|
|
1186
|
-
}
|
|
1187
|
-
controller.enqueue({
|
|
1188
|
-
type: "tool-input-delta",
|
|
1189
|
-
id: toolCall.id,
|
|
1190
|
-
delta: (_v = toolCallDelta.function.arguments) != null ? _v : ""
|
|
1191
|
-
});
|
|
1192
|
-
if (((_w = toolCall.function) == null ? void 0 : _w.name) != null && ((_x = toolCall.function) == null ? void 0 : _x.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
1193
|
-
controller.enqueue({
|
|
1194
|
-
type: "tool-input-end",
|
|
1195
|
-
id: toolCall.id
|
|
1196
|
-
});
|
|
1197
|
-
controller.enqueue({
|
|
1198
|
-
type: "tool-call",
|
|
1199
|
-
toolCallId: (_y = toolCall.id) != null ? _y : generateId(),
|
|
1200
|
-
toolName: toolCall.function.name,
|
|
1201
|
-
input: toolCall.function.arguments
|
|
1202
|
-
});
|
|
1203
|
-
toolCall.hasFinished = true;
|
|
1204
|
-
}
|
|
1125
|
+
toolCallTracker.processDelta(toolCallDelta);
|
|
1205
1126
|
}
|
|
1206
1127
|
}
|
|
1207
1128
|
if (delta.annotations != null) {
|
|
@@ -1220,6 +1141,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1220
1141
|
if (isActiveText) {
|
|
1221
1142
|
controller.enqueue({ type: "text-end", id: "0" });
|
|
1222
1143
|
}
|
|
1144
|
+
toolCallTracker.flush();
|
|
1223
1145
|
controller.enqueue({
|
|
1224
1146
|
type: "finish",
|
|
1225
1147
|
finishReason,
|
|
@@ -2408,6 +2330,7 @@ var openaiTools = {
|
|
|
2408
2330
|
|
|
2409
2331
|
// src/responses/openai-responses-language-model.ts
|
|
2410
2332
|
import {
|
|
2333
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError6,
|
|
2411
2334
|
APICallError
|
|
2412
2335
|
} from "@ai-sdk/provider";
|
|
2413
2336
|
import {
|
|
@@ -2428,7 +2351,213 @@ import {
|
|
|
2428
2351
|
parseProviderOptions as parseProviderOptions5,
|
|
2429
2352
|
validateTypes
|
|
2430
2353
|
} from "@ai-sdk/provider-utils";
|
|
2354
|
+
import { z as z17 } from "zod/v4";
|
|
2355
|
+
|
|
2356
|
+
// src/responses/openai-responses-options.ts
|
|
2357
|
+
import {
|
|
2358
|
+
lazyValidator as lazyValidator9,
|
|
2359
|
+
zodSchema as zodSchema15
|
|
2360
|
+
} from "@ai-sdk/provider-utils";
|
|
2431
2361
|
import { z as z16 } from "zod/v4";
|
|
2362
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
2363
|
+
var openaiResponsesReasoningModelIds = [
|
|
2364
|
+
"o1",
|
|
2365
|
+
"o1-2024-12-17",
|
|
2366
|
+
"o3",
|
|
2367
|
+
"o3-2025-04-16",
|
|
2368
|
+
"o3-deep-research",
|
|
2369
|
+
"o3-deep-research-2025-06-26",
|
|
2370
|
+
"o3-mini",
|
|
2371
|
+
"o3-mini-2025-01-31",
|
|
2372
|
+
"o4-mini",
|
|
2373
|
+
"o4-mini-2025-04-16",
|
|
2374
|
+
"o4-mini-deep-research",
|
|
2375
|
+
"o4-mini-deep-research-2025-06-26",
|
|
2376
|
+
"codex-mini-latest",
|
|
2377
|
+
"computer-use-preview",
|
|
2378
|
+
"gpt-5",
|
|
2379
|
+
"gpt-5-2025-08-07",
|
|
2380
|
+
"gpt-5-codex",
|
|
2381
|
+
"gpt-5-mini",
|
|
2382
|
+
"gpt-5-mini-2025-08-07",
|
|
2383
|
+
"gpt-5-nano",
|
|
2384
|
+
"gpt-5-nano-2025-08-07",
|
|
2385
|
+
"gpt-5-pro",
|
|
2386
|
+
"gpt-5-pro-2025-10-06",
|
|
2387
|
+
"gpt-5.1",
|
|
2388
|
+
"gpt-5.1-chat-latest",
|
|
2389
|
+
"gpt-5.1-codex-mini",
|
|
2390
|
+
"gpt-5.1-codex",
|
|
2391
|
+
"gpt-5.1-codex-max",
|
|
2392
|
+
"gpt-5.2",
|
|
2393
|
+
"gpt-5.2-chat-latest",
|
|
2394
|
+
"gpt-5.2-pro",
|
|
2395
|
+
"gpt-5.2-codex",
|
|
2396
|
+
"gpt-5.3-chat-latest",
|
|
2397
|
+
"gpt-5.3-codex",
|
|
2398
|
+
"gpt-5.4",
|
|
2399
|
+
"gpt-5.4-2026-03-05",
|
|
2400
|
+
"gpt-5.4-mini",
|
|
2401
|
+
"gpt-5.4-mini-2026-03-17",
|
|
2402
|
+
"gpt-5.4-nano",
|
|
2403
|
+
"gpt-5.4-nano-2026-03-17",
|
|
2404
|
+
"gpt-5.4-pro",
|
|
2405
|
+
"gpt-5.4-pro-2026-03-05",
|
|
2406
|
+
"gpt-5.6",
|
|
2407
|
+
"gpt-5.6-luna",
|
|
2408
|
+
"gpt-5.6-sol",
|
|
2409
|
+
"gpt-5.6-terra",
|
|
2410
|
+
"gpt-6-astra",
|
|
2411
|
+
"gpt-6-luna",
|
|
2412
|
+
"gpt-6-sol"
|
|
2413
|
+
];
|
|
2414
|
+
var openaiResponsesModelIds = [
|
|
2415
|
+
"gpt-4.1",
|
|
2416
|
+
"gpt-4.1-2025-04-14",
|
|
2417
|
+
"gpt-4.1-mini",
|
|
2418
|
+
"gpt-4.1-mini-2025-04-14",
|
|
2419
|
+
"gpt-4.1-nano",
|
|
2420
|
+
"gpt-4.1-nano-2025-04-14",
|
|
2421
|
+
"gpt-4o",
|
|
2422
|
+
"gpt-4o-2024-05-13",
|
|
2423
|
+
"gpt-4o-2024-08-06",
|
|
2424
|
+
"gpt-4o-2024-11-20",
|
|
2425
|
+
"gpt-4o-audio-preview",
|
|
2426
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
2427
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
2428
|
+
"gpt-4o-search-preview",
|
|
2429
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
2430
|
+
"gpt-4o-mini-search-preview",
|
|
2431
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
2432
|
+
"gpt-4o-mini",
|
|
2433
|
+
"gpt-4o-mini-2024-07-18",
|
|
2434
|
+
"gpt-4-turbo",
|
|
2435
|
+
"gpt-4-turbo-2024-04-09",
|
|
2436
|
+
"gpt-4-turbo-preview",
|
|
2437
|
+
"gpt-4-0125-preview",
|
|
2438
|
+
"gpt-4-1106-preview",
|
|
2439
|
+
"gpt-4",
|
|
2440
|
+
"gpt-4-0613",
|
|
2441
|
+
"gpt-4.5-preview",
|
|
2442
|
+
"gpt-4.5-preview-2025-02-27",
|
|
2443
|
+
"gpt-3.5-turbo-0125",
|
|
2444
|
+
"gpt-3.5-turbo",
|
|
2445
|
+
"gpt-3.5-turbo-1106",
|
|
2446
|
+
"chatgpt-4o-latest",
|
|
2447
|
+
"gpt-5-chat-latest",
|
|
2448
|
+
...openaiResponsesReasoningModelIds
|
|
2449
|
+
];
|
|
2450
|
+
var openaiResponsesProviderOptionsSchema = lazyValidator9(
|
|
2451
|
+
() => zodSchema15(
|
|
2452
|
+
z16.object({
|
|
2453
|
+
conversation: z16.string().nullish(),
|
|
2454
|
+
include: z16.array(
|
|
2455
|
+
z16.enum([
|
|
2456
|
+
"reasoning.encrypted_content",
|
|
2457
|
+
// handled internally by default, only needed for unknown reasoning models
|
|
2458
|
+
"file_search_call.results",
|
|
2459
|
+
"message.output_text.logprobs"
|
|
2460
|
+
])
|
|
2461
|
+
).nullish(),
|
|
2462
|
+
instructions: z16.string().nullish(),
|
|
2463
|
+
/**
|
|
2464
|
+
* Return the log probabilities of the tokens.
|
|
2465
|
+
*
|
|
2466
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
2467
|
+
* were generated.
|
|
2468
|
+
*
|
|
2469
|
+
* Setting to a number will return the log probabilities of the top n
|
|
2470
|
+
* tokens that were generated.
|
|
2471
|
+
*
|
|
2472
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2473
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2474
|
+
*/
|
|
2475
|
+
logprobs: z16.union([z16.boolean(), z16.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2476
|
+
/**
|
|
2477
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2478
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2479
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
2480
|
+
*/
|
|
2481
|
+
maxToolCalls: z16.number().nullish(),
|
|
2482
|
+
metadata: z16.any().nullish(),
|
|
2483
|
+
parallelToolCalls: z16.boolean().nullish(),
|
|
2484
|
+
previousResponseId: z16.string().nullish(),
|
|
2485
|
+
promptCacheKey: z16.string().nullish(),
|
|
2486
|
+
/**
|
|
2487
|
+
* Prompt cache behavior for GPT-5.6 and later models.
|
|
2488
|
+
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
2489
|
+
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
2490
|
+
*/
|
|
2491
|
+
promptCacheOptions: z16.object({
|
|
2492
|
+
mode: z16.enum(["implicit", "explicit"]).optional(),
|
|
2493
|
+
ttl: z16.literal("30m").optional()
|
|
2494
|
+
}).optional(),
|
|
2495
|
+
/**
|
|
2496
|
+
* The retention policy for the prompt cache.
|
|
2497
|
+
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
2498
|
+
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
2499
|
+
* Available for models before GPT-5.6 that support extended caching.
|
|
2500
|
+
*
|
|
2501
|
+
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
2502
|
+
*
|
|
2503
|
+
* @default 'in_memory'
|
|
2504
|
+
*/
|
|
2505
|
+
promptCacheRetention: z16.enum(["in_memory", "24h"]).nullish(),
|
|
2506
|
+
/**
|
|
2507
|
+
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
2508
|
+
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
2509
|
+
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
2510
|
+
* Supported values vary by model.
|
|
2511
|
+
*/
|
|
2512
|
+
reasoningEffort: z16.string().nullish(),
|
|
2513
|
+
/**
|
|
2514
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
2515
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
2516
|
+
* request prefix for prompt caching.
|
|
2517
|
+
*
|
|
2518
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
2519
|
+
* combined with automatic truncation.
|
|
2520
|
+
*/
|
|
2521
|
+
reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
2522
|
+
/**
|
|
2523
|
+
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
2524
|
+
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
2525
|
+
*/
|
|
2526
|
+
reasoningMode: z16.enum(["standard", "pro"]).optional(),
|
|
2527
|
+
/**
|
|
2528
|
+
* Controls which available reasoning items GPT-5.6 can use.
|
|
2529
|
+
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
2530
|
+
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
2531
|
+
*/
|
|
2532
|
+
reasoningContext: z16.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
2533
|
+
reasoningSummary: z16.string().nullish(),
|
|
2534
|
+
safetyIdentifier: z16.string().nullish(),
|
|
2535
|
+
serviceTier: z16.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
2536
|
+
store: z16.boolean().nullish(),
|
|
2537
|
+
strictJsonSchema: z16.boolean().nullish(),
|
|
2538
|
+
textVerbosity: z16.enum(["low", "medium", "high"]).nullish(),
|
|
2539
|
+
truncation: z16.enum(["auto", "disabled"]).nullish(),
|
|
2540
|
+
user: z16.string().nullish()
|
|
2541
|
+
})
|
|
2542
|
+
)
|
|
2543
|
+
);
|
|
2544
|
+
var openaiResponsesSystemMessageOptionsSchema = lazyValidator9(
|
|
2545
|
+
() => zodSchema15(
|
|
2546
|
+
z16.object({
|
|
2547
|
+
/**
|
|
2548
|
+
* Emit a configuration update at this position in Responses history.
|
|
2549
|
+
* Requires empty system message content and the same supported
|
|
2550
|
+
* configuration as the request-level reasoningEffortUpdate option.
|
|
2551
|
+
* Unsupported historical updates throw instead of being omitted.
|
|
2552
|
+
*
|
|
2553
|
+
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
2554
|
+
*/
|
|
2555
|
+
reasoningEffortUpdate: z16.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
2556
|
+
})
|
|
2557
|
+
)
|
|
2558
|
+
);
|
|
2559
|
+
|
|
2560
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
2432
2561
|
function getPromptCacheBreakpoint2(providerOptions) {
|
|
2433
2562
|
var _a2;
|
|
2434
2563
|
return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
|
|
@@ -2440,9 +2569,11 @@ function isFileId(data, prefixes) {
|
|
|
2440
2569
|
async function convertToOpenAIResponsesInput({
|
|
2441
2570
|
prompt,
|
|
2442
2571
|
systemMessageMode,
|
|
2572
|
+
providerOptionsName = "openai",
|
|
2443
2573
|
explicitMessageItemType = false,
|
|
2444
2574
|
fileIdPrefixes,
|
|
2445
2575
|
store,
|
|
2576
|
+
configurationUpdateUnsupportedReason,
|
|
2446
2577
|
hasLocalShellTool = false
|
|
2447
2578
|
}) {
|
|
2448
2579
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -2451,6 +2582,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
2451
2582
|
for (const { role, content, providerOptions } of prompt) {
|
|
2452
2583
|
switch (role) {
|
|
2453
2584
|
case "system": {
|
|
2585
|
+
let options = await parseProviderOptions5({
|
|
2586
|
+
provider: providerOptionsName,
|
|
2587
|
+
providerOptions,
|
|
2588
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2589
|
+
});
|
|
2590
|
+
if (options == null && providerOptionsName !== "openai") {
|
|
2591
|
+
options = await parseProviderOptions5({
|
|
2592
|
+
provider: "openai",
|
|
2593
|
+
providerOptions,
|
|
2594
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2595
|
+
});
|
|
2596
|
+
}
|
|
2597
|
+
const effort = options == null ? void 0 : options.reasoningEffortUpdate;
|
|
2598
|
+
if (effort != null) {
|
|
2599
|
+
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
2600
|
+
if (unsupportedReason != null) {
|
|
2601
|
+
throw new UnsupportedFunctionalityError4({
|
|
2602
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
2603
|
+
message: unsupportedReason
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
input.push({
|
|
2607
|
+
type: "configuration_update",
|
|
2608
|
+
reasoning: { effort }
|
|
2609
|
+
});
|
|
2610
|
+
break;
|
|
2611
|
+
}
|
|
2454
2612
|
switch (systemMessageMode) {
|
|
2455
2613
|
case "system": {
|
|
2456
2614
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
|
|
@@ -2796,9 +2954,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2796
2954
|
}
|
|
2797
2955
|
return { input, warnings };
|
|
2798
2956
|
}
|
|
2799
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2800
|
-
itemId:
|
|
2801
|
-
reasoningEncryptedContent:
|
|
2957
|
+
var openaiResponsesReasoningProviderOptionsSchema = z17.object({
|
|
2958
|
+
itemId: z17.string().nullish(),
|
|
2959
|
+
reasoningEncryptedContent: z17.string().nullish()
|
|
2802
2960
|
});
|
|
2803
2961
|
|
|
2804
2962
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2821,290 +2979,290 @@ function mapOpenAIResponseFinishReason({
|
|
|
2821
2979
|
|
|
2822
2980
|
// src/responses/openai-responses-api.ts
|
|
2823
2981
|
import {
|
|
2824
|
-
lazyValidator as
|
|
2825
|
-
zodSchema as
|
|
2982
|
+
lazyValidator as lazyValidator10,
|
|
2983
|
+
zodSchema as zodSchema16
|
|
2826
2984
|
} from "@ai-sdk/provider-utils";
|
|
2827
|
-
import { z as
|
|
2828
|
-
var openaiResponsesChunkSchema =
|
|
2829
|
-
() =>
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
type:
|
|
2833
|
-
item_id:
|
|
2834
|
-
delta:
|
|
2835
|
-
logprobs:
|
|
2836
|
-
|
|
2837
|
-
token:
|
|
2838
|
-
logprob:
|
|
2839
|
-
top_logprobs:
|
|
2840
|
-
|
|
2841
|
-
token:
|
|
2842
|
-
logprob:
|
|
2985
|
+
import { z as z18 } from "zod/v4";
|
|
2986
|
+
var openaiResponsesChunkSchema = lazyValidator10(
|
|
2987
|
+
() => zodSchema16(
|
|
2988
|
+
z18.union([
|
|
2989
|
+
z18.object({
|
|
2990
|
+
type: z18.literal("response.output_text.delta"),
|
|
2991
|
+
item_id: z18.string(),
|
|
2992
|
+
delta: z18.string(),
|
|
2993
|
+
logprobs: z18.array(
|
|
2994
|
+
z18.object({
|
|
2995
|
+
token: z18.string(),
|
|
2996
|
+
logprob: z18.number(),
|
|
2997
|
+
top_logprobs: z18.array(
|
|
2998
|
+
z18.object({
|
|
2999
|
+
token: z18.string(),
|
|
3000
|
+
logprob: z18.number()
|
|
2843
3001
|
})
|
|
2844
3002
|
)
|
|
2845
3003
|
})
|
|
2846
3004
|
).nullish()
|
|
2847
3005
|
}),
|
|
2848
|
-
|
|
2849
|
-
type:
|
|
2850
|
-
response:
|
|
2851
|
-
incomplete_details:
|
|
2852
|
-
usage:
|
|
2853
|
-
input_tokens:
|
|
2854
|
-
input_tokens_details:
|
|
2855
|
-
cached_tokens:
|
|
2856
|
-
cache_write_tokens:
|
|
2857
|
-
orchestration_input_tokens:
|
|
2858
|
-
orchestration_input_cached_tokens:
|
|
3006
|
+
z18.object({
|
|
3007
|
+
type: z18.enum(["response.completed", "response.incomplete"]),
|
|
3008
|
+
response: z18.object({
|
|
3009
|
+
incomplete_details: z18.object({ reason: z18.string() }).nullish(),
|
|
3010
|
+
usage: z18.object({
|
|
3011
|
+
input_tokens: z18.number(),
|
|
3012
|
+
input_tokens_details: z18.object({
|
|
3013
|
+
cached_tokens: z18.number().nullish(),
|
|
3014
|
+
cache_write_tokens: z18.number().nullish(),
|
|
3015
|
+
orchestration_input_tokens: z18.number().nullish(),
|
|
3016
|
+
orchestration_input_cached_tokens: z18.number().nullish()
|
|
2859
3017
|
}).nullish(),
|
|
2860
|
-
output_tokens:
|
|
2861
|
-
output_tokens_details:
|
|
2862
|
-
reasoning_tokens:
|
|
2863
|
-
orchestration_output_tokens:
|
|
3018
|
+
output_tokens: z18.number(),
|
|
3019
|
+
output_tokens_details: z18.object({
|
|
3020
|
+
reasoning_tokens: z18.number().nullish(),
|
|
3021
|
+
orchestration_output_tokens: z18.number().nullish()
|
|
2864
3022
|
}).nullish()
|
|
2865
3023
|
}),
|
|
2866
|
-
reasoning:
|
|
2867
|
-
context:
|
|
3024
|
+
reasoning: z18.object({
|
|
3025
|
+
context: z18.string().nullish()
|
|
2868
3026
|
}).nullish(),
|
|
2869
|
-
service_tier:
|
|
3027
|
+
service_tier: z18.string().nullish()
|
|
2870
3028
|
})
|
|
2871
3029
|
}),
|
|
2872
|
-
|
|
2873
|
-
type:
|
|
2874
|
-
response:
|
|
2875
|
-
id:
|
|
2876
|
-
created_at:
|
|
2877
|
-
model:
|
|
2878
|
-
service_tier:
|
|
3030
|
+
z18.object({
|
|
3031
|
+
type: z18.literal("response.created"),
|
|
3032
|
+
response: z18.object({
|
|
3033
|
+
id: z18.string(),
|
|
3034
|
+
created_at: z18.number(),
|
|
3035
|
+
model: z18.string(),
|
|
3036
|
+
service_tier: z18.string().nullish()
|
|
2879
3037
|
})
|
|
2880
3038
|
}),
|
|
2881
|
-
|
|
2882
|
-
type:
|
|
2883
|
-
output_index:
|
|
2884
|
-
item:
|
|
2885
|
-
|
|
2886
|
-
type:
|
|
2887
|
-
id:
|
|
2888
|
-
phase:
|
|
3039
|
+
z18.object({
|
|
3040
|
+
type: z18.literal("response.output_item.added"),
|
|
3041
|
+
output_index: z18.number(),
|
|
3042
|
+
item: z18.discriminatedUnion("type", [
|
|
3043
|
+
z18.object({
|
|
3044
|
+
type: z18.literal("message"),
|
|
3045
|
+
id: z18.string(),
|
|
3046
|
+
phase: z18.enum(["commentary", "final_answer"]).nullish()
|
|
2889
3047
|
}),
|
|
2890
|
-
|
|
2891
|
-
type:
|
|
2892
|
-
id:
|
|
2893
|
-
encrypted_content:
|
|
3048
|
+
z18.object({
|
|
3049
|
+
type: z18.literal("reasoning"),
|
|
3050
|
+
id: z18.string(),
|
|
3051
|
+
encrypted_content: z18.string().nullish()
|
|
2894
3052
|
}),
|
|
2895
|
-
|
|
2896
|
-
type:
|
|
2897
|
-
id:
|
|
2898
|
-
call_id:
|
|
2899
|
-
name:
|
|
2900
|
-
arguments:
|
|
2901
|
-
async:
|
|
3053
|
+
z18.object({
|
|
3054
|
+
type: z18.literal("function_call"),
|
|
3055
|
+
id: z18.string(),
|
|
3056
|
+
call_id: z18.string(),
|
|
3057
|
+
name: z18.string(),
|
|
3058
|
+
arguments: z18.string(),
|
|
3059
|
+
async: z18.boolean().nullish()
|
|
2902
3060
|
}),
|
|
2903
|
-
|
|
2904
|
-
type:
|
|
2905
|
-
id:
|
|
2906
|
-
status:
|
|
3061
|
+
z18.object({
|
|
3062
|
+
type: z18.literal("web_search_call"),
|
|
3063
|
+
id: z18.string(),
|
|
3064
|
+
status: z18.string()
|
|
2907
3065
|
}),
|
|
2908
|
-
|
|
2909
|
-
type:
|
|
2910
|
-
id:
|
|
2911
|
-
status:
|
|
3066
|
+
z18.object({
|
|
3067
|
+
type: z18.literal("computer_call"),
|
|
3068
|
+
id: z18.string(),
|
|
3069
|
+
status: z18.string()
|
|
2912
3070
|
}),
|
|
2913
|
-
|
|
2914
|
-
type:
|
|
2915
|
-
id:
|
|
3071
|
+
z18.object({
|
|
3072
|
+
type: z18.literal("file_search_call"),
|
|
3073
|
+
id: z18.string()
|
|
2916
3074
|
}),
|
|
2917
|
-
|
|
2918
|
-
type:
|
|
2919
|
-
id:
|
|
3075
|
+
z18.object({
|
|
3076
|
+
type: z18.literal("image_generation_call"),
|
|
3077
|
+
id: z18.string()
|
|
2920
3078
|
}),
|
|
2921
|
-
|
|
2922
|
-
type:
|
|
2923
|
-
id:
|
|
2924
|
-
container_id:
|
|
2925
|
-
code:
|
|
2926
|
-
outputs:
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3079
|
+
z18.object({
|
|
3080
|
+
type: z18.literal("code_interpreter_call"),
|
|
3081
|
+
id: z18.string(),
|
|
3082
|
+
container_id: z18.string(),
|
|
3083
|
+
code: z18.string().nullable(),
|
|
3084
|
+
outputs: z18.array(
|
|
3085
|
+
z18.discriminatedUnion("type", [
|
|
3086
|
+
z18.object({ type: z18.literal("logs"), logs: z18.string() }),
|
|
3087
|
+
z18.object({ type: z18.literal("image"), url: z18.string() })
|
|
2930
3088
|
])
|
|
2931
3089
|
).nullable(),
|
|
2932
|
-
status:
|
|
3090
|
+
status: z18.string()
|
|
2933
3091
|
})
|
|
2934
3092
|
])
|
|
2935
3093
|
}),
|
|
2936
|
-
|
|
2937
|
-
type:
|
|
2938
|
-
output_index:
|
|
2939
|
-
item:
|
|
2940
|
-
|
|
2941
|
-
type:
|
|
2942
|
-
id:
|
|
2943
|
-
phase:
|
|
3094
|
+
z18.object({
|
|
3095
|
+
type: z18.literal("response.output_item.done"),
|
|
3096
|
+
output_index: z18.number(),
|
|
3097
|
+
item: z18.discriminatedUnion("type", [
|
|
3098
|
+
z18.object({
|
|
3099
|
+
type: z18.literal("message"),
|
|
3100
|
+
id: z18.string(),
|
|
3101
|
+
phase: z18.enum(["commentary", "final_answer"]).nullish()
|
|
2944
3102
|
}),
|
|
2945
|
-
|
|
2946
|
-
type:
|
|
2947
|
-
id:
|
|
2948
|
-
encrypted_content:
|
|
3103
|
+
z18.object({
|
|
3104
|
+
type: z18.literal("reasoning"),
|
|
3105
|
+
id: z18.string(),
|
|
3106
|
+
encrypted_content: z18.string().nullish()
|
|
2949
3107
|
}),
|
|
2950
|
-
|
|
2951
|
-
type:
|
|
2952
|
-
id:
|
|
2953
|
-
call_id:
|
|
2954
|
-
name:
|
|
2955
|
-
arguments:
|
|
2956
|
-
async:
|
|
2957
|
-
status:
|
|
3108
|
+
z18.object({
|
|
3109
|
+
type: z18.literal("function_call"),
|
|
3110
|
+
id: z18.string(),
|
|
3111
|
+
call_id: z18.string(),
|
|
3112
|
+
name: z18.string(),
|
|
3113
|
+
arguments: z18.string(),
|
|
3114
|
+
async: z18.boolean().nullish(),
|
|
3115
|
+
status: z18.enum(["in_progress", "completed", "incomplete"])
|
|
2958
3116
|
}),
|
|
2959
|
-
|
|
2960
|
-
type:
|
|
2961
|
-
id:
|
|
2962
|
-
code:
|
|
2963
|
-
container_id:
|
|
2964
|
-
outputs:
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
3117
|
+
z18.object({
|
|
3118
|
+
type: z18.literal("code_interpreter_call"),
|
|
3119
|
+
id: z18.string(),
|
|
3120
|
+
code: z18.string().nullable(),
|
|
3121
|
+
container_id: z18.string(),
|
|
3122
|
+
outputs: z18.array(
|
|
3123
|
+
z18.discriminatedUnion("type", [
|
|
3124
|
+
z18.object({ type: z18.literal("logs"), logs: z18.string() }),
|
|
3125
|
+
z18.object({ type: z18.literal("image"), url: z18.string() })
|
|
2968
3126
|
])
|
|
2969
3127
|
).nullable()
|
|
2970
3128
|
}),
|
|
2971
|
-
|
|
2972
|
-
type:
|
|
2973
|
-
id:
|
|
2974
|
-
result:
|
|
3129
|
+
z18.object({
|
|
3130
|
+
type: z18.literal("image_generation_call"),
|
|
3131
|
+
id: z18.string(),
|
|
3132
|
+
result: z18.string()
|
|
2975
3133
|
}),
|
|
2976
|
-
|
|
2977
|
-
type:
|
|
2978
|
-
id:
|
|
2979
|
-
status:
|
|
2980
|
-
action:
|
|
2981
|
-
|
|
2982
|
-
type:
|
|
2983
|
-
query:
|
|
2984
|
-
sources:
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
3134
|
+
z18.object({
|
|
3135
|
+
type: z18.literal("web_search_call"),
|
|
3136
|
+
id: z18.string(),
|
|
3137
|
+
status: z18.string(),
|
|
3138
|
+
action: z18.discriminatedUnion("type", [
|
|
3139
|
+
z18.object({
|
|
3140
|
+
type: z18.literal("search"),
|
|
3141
|
+
query: z18.string().nullish(),
|
|
3142
|
+
sources: z18.array(
|
|
3143
|
+
z18.discriminatedUnion("type", [
|
|
3144
|
+
z18.object({ type: z18.literal("url"), url: z18.string() }),
|
|
3145
|
+
z18.object({ type: z18.literal("api"), name: z18.string() })
|
|
2988
3146
|
])
|
|
2989
3147
|
).nullish()
|
|
2990
3148
|
}),
|
|
2991
|
-
|
|
2992
|
-
type:
|
|
2993
|
-
url:
|
|
3149
|
+
z18.object({
|
|
3150
|
+
type: z18.literal("open_page"),
|
|
3151
|
+
url: z18.string().nullish()
|
|
2994
3152
|
}),
|
|
2995
|
-
|
|
2996
|
-
type:
|
|
2997
|
-
url:
|
|
2998
|
-
pattern:
|
|
3153
|
+
z18.object({
|
|
3154
|
+
type: z18.literal("find_in_page"),
|
|
3155
|
+
url: z18.string().nullish(),
|
|
3156
|
+
pattern: z18.string().nullish()
|
|
2999
3157
|
})
|
|
3000
3158
|
]).nullish()
|
|
3001
3159
|
}),
|
|
3002
|
-
|
|
3003
|
-
type:
|
|
3004
|
-
id:
|
|
3005
|
-
queries:
|
|
3006
|
-
results:
|
|
3007
|
-
|
|
3008
|
-
attributes:
|
|
3009
|
-
file_id:
|
|
3010
|
-
filename:
|
|
3011
|
-
score:
|
|
3012
|
-
text:
|
|
3160
|
+
z18.object({
|
|
3161
|
+
type: z18.literal("file_search_call"),
|
|
3162
|
+
id: z18.string(),
|
|
3163
|
+
queries: z18.array(z18.string()),
|
|
3164
|
+
results: z18.array(
|
|
3165
|
+
z18.object({
|
|
3166
|
+
attributes: z18.record(z18.string(), z18.unknown()),
|
|
3167
|
+
file_id: z18.string(),
|
|
3168
|
+
filename: z18.string(),
|
|
3169
|
+
score: z18.number(),
|
|
3170
|
+
text: z18.string()
|
|
3013
3171
|
})
|
|
3014
3172
|
).nullish()
|
|
3015
3173
|
}),
|
|
3016
|
-
|
|
3017
|
-
type:
|
|
3018
|
-
id:
|
|
3019
|
-
call_id:
|
|
3020
|
-
action:
|
|
3021
|
-
type:
|
|
3022
|
-
command:
|
|
3023
|
-
timeout_ms:
|
|
3024
|
-
user:
|
|
3025
|
-
working_directory:
|
|
3026
|
-
env:
|
|
3174
|
+
z18.object({
|
|
3175
|
+
type: z18.literal("local_shell_call"),
|
|
3176
|
+
id: z18.string(),
|
|
3177
|
+
call_id: z18.string(),
|
|
3178
|
+
action: z18.object({
|
|
3179
|
+
type: z18.literal("exec"),
|
|
3180
|
+
command: z18.array(z18.string()),
|
|
3181
|
+
timeout_ms: z18.number().optional(),
|
|
3182
|
+
user: z18.string().optional(),
|
|
3183
|
+
working_directory: z18.string().optional(),
|
|
3184
|
+
env: z18.record(z18.string(), z18.string()).optional()
|
|
3027
3185
|
})
|
|
3028
3186
|
}),
|
|
3029
|
-
|
|
3030
|
-
type:
|
|
3031
|
-
id:
|
|
3032
|
-
status:
|
|
3187
|
+
z18.object({
|
|
3188
|
+
type: z18.literal("computer_call"),
|
|
3189
|
+
id: z18.string(),
|
|
3190
|
+
status: z18.literal("completed")
|
|
3033
3191
|
})
|
|
3034
3192
|
])
|
|
3035
3193
|
}),
|
|
3036
|
-
|
|
3037
|
-
type:
|
|
3038
|
-
item_id:
|
|
3039
|
-
output_index:
|
|
3040
|
-
delta:
|
|
3194
|
+
z18.object({
|
|
3195
|
+
type: z18.literal("response.function_call_arguments.delta"),
|
|
3196
|
+
item_id: z18.string(),
|
|
3197
|
+
output_index: z18.number(),
|
|
3198
|
+
delta: z18.string()
|
|
3041
3199
|
}),
|
|
3042
|
-
|
|
3043
|
-
type:
|
|
3044
|
-
item_id:
|
|
3045
|
-
output_index:
|
|
3046
|
-
partial_image_b64:
|
|
3200
|
+
z18.object({
|
|
3201
|
+
type: z18.literal("response.image_generation_call.partial_image"),
|
|
3202
|
+
item_id: z18.string(),
|
|
3203
|
+
output_index: z18.number(),
|
|
3204
|
+
partial_image_b64: z18.string()
|
|
3047
3205
|
}),
|
|
3048
|
-
|
|
3049
|
-
type:
|
|
3050
|
-
item_id:
|
|
3051
|
-
output_index:
|
|
3052
|
-
delta:
|
|
3206
|
+
z18.object({
|
|
3207
|
+
type: z18.literal("response.code_interpreter_call_code.delta"),
|
|
3208
|
+
item_id: z18.string(),
|
|
3209
|
+
output_index: z18.number(),
|
|
3210
|
+
delta: z18.string()
|
|
3053
3211
|
}),
|
|
3054
|
-
|
|
3055
|
-
type:
|
|
3056
|
-
item_id:
|
|
3057
|
-
output_index:
|
|
3058
|
-
code:
|
|
3212
|
+
z18.object({
|
|
3213
|
+
type: z18.literal("response.code_interpreter_call_code.done"),
|
|
3214
|
+
item_id: z18.string(),
|
|
3215
|
+
output_index: z18.number(),
|
|
3216
|
+
code: z18.string()
|
|
3059
3217
|
}),
|
|
3060
|
-
|
|
3061
|
-
type:
|
|
3062
|
-
annotation:
|
|
3063
|
-
|
|
3064
|
-
type:
|
|
3065
|
-
start_index:
|
|
3066
|
-
end_index:
|
|
3067
|
-
url:
|
|
3068
|
-
title:
|
|
3218
|
+
z18.object({
|
|
3219
|
+
type: z18.literal("response.output_text.annotation.added"),
|
|
3220
|
+
annotation: z18.discriminatedUnion("type", [
|
|
3221
|
+
z18.object({
|
|
3222
|
+
type: z18.literal("url_citation"),
|
|
3223
|
+
start_index: z18.number(),
|
|
3224
|
+
end_index: z18.number(),
|
|
3225
|
+
url: z18.string(),
|
|
3226
|
+
title: z18.string()
|
|
3069
3227
|
}),
|
|
3070
|
-
|
|
3071
|
-
type:
|
|
3072
|
-
file_id:
|
|
3073
|
-
filename:
|
|
3074
|
-
index:
|
|
3075
|
-
start_index:
|
|
3076
|
-
end_index:
|
|
3077
|
-
quote:
|
|
3228
|
+
z18.object({
|
|
3229
|
+
type: z18.literal("file_citation"),
|
|
3230
|
+
file_id: z18.string(),
|
|
3231
|
+
filename: z18.string().nullish(),
|
|
3232
|
+
index: z18.number().nullish(),
|
|
3233
|
+
start_index: z18.number().nullish(),
|
|
3234
|
+
end_index: z18.number().nullish(),
|
|
3235
|
+
quote: z18.string().nullish()
|
|
3078
3236
|
})
|
|
3079
3237
|
])
|
|
3080
3238
|
}),
|
|
3081
|
-
|
|
3082
|
-
type:
|
|
3083
|
-
item_id:
|
|
3084
|
-
summary_index:
|
|
3239
|
+
z18.object({
|
|
3240
|
+
type: z18.literal("response.reasoning_summary_part.added"),
|
|
3241
|
+
item_id: z18.string(),
|
|
3242
|
+
summary_index: z18.number()
|
|
3085
3243
|
}),
|
|
3086
|
-
|
|
3087
|
-
type:
|
|
3088
|
-
item_id:
|
|
3089
|
-
summary_index:
|
|
3090
|
-
delta:
|
|
3244
|
+
z18.object({
|
|
3245
|
+
type: z18.literal("response.reasoning_summary_text.delta"),
|
|
3246
|
+
item_id: z18.string(),
|
|
3247
|
+
summary_index: z18.number(),
|
|
3248
|
+
delta: z18.string()
|
|
3091
3249
|
}),
|
|
3092
|
-
|
|
3093
|
-
type:
|
|
3094
|
-
item_id:
|
|
3095
|
-
summary_index:
|
|
3250
|
+
z18.object({
|
|
3251
|
+
type: z18.literal("response.reasoning_summary_part.done"),
|
|
3252
|
+
item_id: z18.string(),
|
|
3253
|
+
summary_index: z18.number()
|
|
3096
3254
|
}),
|
|
3097
|
-
|
|
3098
|
-
type:
|
|
3099
|
-
sequence_number:
|
|
3100
|
-
error:
|
|
3101
|
-
type:
|
|
3102
|
-
code:
|
|
3103
|
-
message:
|
|
3104
|
-
param:
|
|
3255
|
+
z18.object({
|
|
3256
|
+
type: z18.literal("error"),
|
|
3257
|
+
sequence_number: z18.number(),
|
|
3258
|
+
error: z18.object({
|
|
3259
|
+
type: z18.string(),
|
|
3260
|
+
code: z18.string(),
|
|
3261
|
+
message: z18.string(),
|
|
3262
|
+
param: z18.string().nullish()
|
|
3105
3263
|
})
|
|
3106
3264
|
}),
|
|
3107
|
-
|
|
3265
|
+
z18.object({ type: z18.string() }).loose().transform((value) => ({
|
|
3108
3266
|
type: "unknown_chunk",
|
|
3109
3267
|
message: value.type
|
|
3110
3268
|
}))
|
|
@@ -3112,392 +3270,203 @@ var openaiResponsesChunkSchema = lazyValidator9(
|
|
|
3112
3270
|
])
|
|
3113
3271
|
)
|
|
3114
3272
|
);
|
|
3115
|
-
var openaiResponsesResponseSchema =
|
|
3116
|
-
() =>
|
|
3117
|
-
|
|
3118
|
-
id:
|
|
3119
|
-
created_at:
|
|
3120
|
-
error:
|
|
3121
|
-
message:
|
|
3122
|
-
type:
|
|
3123
|
-
param:
|
|
3124
|
-
code:
|
|
3273
|
+
var openaiResponsesResponseSchema = lazyValidator10(
|
|
3274
|
+
() => zodSchema16(
|
|
3275
|
+
z18.object({
|
|
3276
|
+
id: z18.string().optional(),
|
|
3277
|
+
created_at: z18.number().optional(),
|
|
3278
|
+
error: z18.object({
|
|
3279
|
+
message: z18.string(),
|
|
3280
|
+
type: z18.string(),
|
|
3281
|
+
param: z18.string().nullish(),
|
|
3282
|
+
code: z18.string()
|
|
3125
3283
|
}).nullish(),
|
|
3126
|
-
model:
|
|
3127
|
-
output:
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
type:
|
|
3131
|
-
role:
|
|
3132
|
-
id:
|
|
3133
|
-
phase:
|
|
3134
|
-
content:
|
|
3135
|
-
|
|
3136
|
-
type:
|
|
3137
|
-
text:
|
|
3138
|
-
logprobs:
|
|
3139
|
-
|
|
3140
|
-
token:
|
|
3141
|
-
logprob:
|
|
3142
|
-
top_logprobs:
|
|
3143
|
-
|
|
3144
|
-
token:
|
|
3145
|
-
logprob:
|
|
3284
|
+
model: z18.string().optional(),
|
|
3285
|
+
output: z18.array(
|
|
3286
|
+
z18.discriminatedUnion("type", [
|
|
3287
|
+
z18.object({
|
|
3288
|
+
type: z18.literal("message"),
|
|
3289
|
+
role: z18.literal("assistant"),
|
|
3290
|
+
id: z18.string(),
|
|
3291
|
+
phase: z18.enum(["commentary", "final_answer"]).nullish(),
|
|
3292
|
+
content: z18.array(
|
|
3293
|
+
z18.object({
|
|
3294
|
+
type: z18.literal("output_text"),
|
|
3295
|
+
text: z18.string(),
|
|
3296
|
+
logprobs: z18.array(
|
|
3297
|
+
z18.object({
|
|
3298
|
+
token: z18.string(),
|
|
3299
|
+
logprob: z18.number(),
|
|
3300
|
+
top_logprobs: z18.array(
|
|
3301
|
+
z18.object({
|
|
3302
|
+
token: z18.string(),
|
|
3303
|
+
logprob: z18.number()
|
|
3146
3304
|
})
|
|
3147
3305
|
)
|
|
3148
3306
|
})
|
|
3149
3307
|
).nullish(),
|
|
3150
|
-
annotations:
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
type:
|
|
3154
|
-
start_index:
|
|
3155
|
-
end_index:
|
|
3156
|
-
url:
|
|
3157
|
-
title:
|
|
3308
|
+
annotations: z18.array(
|
|
3309
|
+
z18.discriminatedUnion("type", [
|
|
3310
|
+
z18.object({
|
|
3311
|
+
type: z18.literal("url_citation"),
|
|
3312
|
+
start_index: z18.number(),
|
|
3313
|
+
end_index: z18.number(),
|
|
3314
|
+
url: z18.string(),
|
|
3315
|
+
title: z18.string()
|
|
3158
3316
|
}),
|
|
3159
|
-
|
|
3160
|
-
type:
|
|
3161
|
-
file_id:
|
|
3162
|
-
filename:
|
|
3163
|
-
index:
|
|
3164
|
-
start_index:
|
|
3165
|
-
end_index:
|
|
3166
|
-
quote:
|
|
3317
|
+
z18.object({
|
|
3318
|
+
type: z18.literal("file_citation"),
|
|
3319
|
+
file_id: z18.string(),
|
|
3320
|
+
filename: z18.string().nullish(),
|
|
3321
|
+
index: z18.number().nullish(),
|
|
3322
|
+
start_index: z18.number().nullish(),
|
|
3323
|
+
end_index: z18.number().nullish(),
|
|
3324
|
+
quote: z18.string().nullish()
|
|
3167
3325
|
}),
|
|
3168
|
-
|
|
3169
|
-
type:
|
|
3170
|
-
container_id:
|
|
3171
|
-
file_id:
|
|
3172
|
-
filename:
|
|
3173
|
-
start_index:
|
|
3174
|
-
end_index:
|
|
3175
|
-
index:
|
|
3326
|
+
z18.object({
|
|
3327
|
+
type: z18.literal("container_file_citation"),
|
|
3328
|
+
container_id: z18.string(),
|
|
3329
|
+
file_id: z18.string(),
|
|
3330
|
+
filename: z18.string().nullish(),
|
|
3331
|
+
start_index: z18.number().nullish(),
|
|
3332
|
+
end_index: z18.number().nullish(),
|
|
3333
|
+
index: z18.number().nullish()
|
|
3176
3334
|
}),
|
|
3177
|
-
|
|
3178
|
-
type:
|
|
3179
|
-
file_id:
|
|
3180
|
-
index:
|
|
3335
|
+
z18.object({
|
|
3336
|
+
type: z18.literal("file_path"),
|
|
3337
|
+
file_id: z18.string(),
|
|
3338
|
+
index: z18.number().nullish()
|
|
3181
3339
|
})
|
|
3182
3340
|
])
|
|
3183
3341
|
)
|
|
3184
3342
|
})
|
|
3185
3343
|
)
|
|
3186
3344
|
}),
|
|
3187
|
-
|
|
3188
|
-
type:
|
|
3189
|
-
id:
|
|
3190
|
-
status:
|
|
3191
|
-
action:
|
|
3192
|
-
|
|
3193
|
-
type:
|
|
3194
|
-
query:
|
|
3195
|
-
sources:
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
type:
|
|
3200
|
-
name:
|
|
3345
|
+
z18.object({
|
|
3346
|
+
type: z18.literal("web_search_call"),
|
|
3347
|
+
id: z18.string(),
|
|
3348
|
+
status: z18.string(),
|
|
3349
|
+
action: z18.discriminatedUnion("type", [
|
|
3350
|
+
z18.object({
|
|
3351
|
+
type: z18.literal("search"),
|
|
3352
|
+
query: z18.string().nullish(),
|
|
3353
|
+
sources: z18.array(
|
|
3354
|
+
z18.discriminatedUnion("type", [
|
|
3355
|
+
z18.object({ type: z18.literal("url"), url: z18.string() }),
|
|
3356
|
+
z18.object({
|
|
3357
|
+
type: z18.literal("api"),
|
|
3358
|
+
name: z18.string()
|
|
3201
3359
|
})
|
|
3202
3360
|
])
|
|
3203
3361
|
).nullish()
|
|
3204
3362
|
}),
|
|
3205
|
-
|
|
3206
|
-
type:
|
|
3207
|
-
url:
|
|
3363
|
+
z18.object({
|
|
3364
|
+
type: z18.literal("open_page"),
|
|
3365
|
+
url: z18.string().nullish()
|
|
3208
3366
|
}),
|
|
3209
|
-
|
|
3210
|
-
type:
|
|
3211
|
-
url:
|
|
3212
|
-
pattern:
|
|
3367
|
+
z18.object({
|
|
3368
|
+
type: z18.literal("find_in_page"),
|
|
3369
|
+
url: z18.string().nullish(),
|
|
3370
|
+
pattern: z18.string().nullish()
|
|
3213
3371
|
})
|
|
3214
3372
|
]).nullish()
|
|
3215
3373
|
}),
|
|
3216
|
-
|
|
3217
|
-
type:
|
|
3218
|
-
id:
|
|
3219
|
-
queries:
|
|
3220
|
-
results:
|
|
3221
|
-
|
|
3222
|
-
attributes:
|
|
3223
|
-
|
|
3224
|
-
|
|
3374
|
+
z18.object({
|
|
3375
|
+
type: z18.literal("file_search_call"),
|
|
3376
|
+
id: z18.string(),
|
|
3377
|
+
queries: z18.array(z18.string()),
|
|
3378
|
+
results: z18.array(
|
|
3379
|
+
z18.object({
|
|
3380
|
+
attributes: z18.record(
|
|
3381
|
+
z18.string(),
|
|
3382
|
+
z18.union([z18.string(), z18.number(), z18.boolean()])
|
|
3225
3383
|
),
|
|
3226
|
-
file_id:
|
|
3227
|
-
filename:
|
|
3228
|
-
score:
|
|
3229
|
-
text:
|
|
3384
|
+
file_id: z18.string(),
|
|
3385
|
+
filename: z18.string(),
|
|
3386
|
+
score: z18.number(),
|
|
3387
|
+
text: z18.string()
|
|
3230
3388
|
})
|
|
3231
3389
|
).nullish()
|
|
3232
3390
|
}),
|
|
3233
|
-
|
|
3234
|
-
type:
|
|
3235
|
-
id:
|
|
3236
|
-
code:
|
|
3237
|
-
container_id:
|
|
3238
|
-
outputs:
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3391
|
+
z18.object({
|
|
3392
|
+
type: z18.literal("code_interpreter_call"),
|
|
3393
|
+
id: z18.string(),
|
|
3394
|
+
code: z18.string().nullable(),
|
|
3395
|
+
container_id: z18.string(),
|
|
3396
|
+
outputs: z18.array(
|
|
3397
|
+
z18.discriminatedUnion("type", [
|
|
3398
|
+
z18.object({ type: z18.literal("logs"), logs: z18.string() }),
|
|
3399
|
+
z18.object({ type: z18.literal("image"), url: z18.string() })
|
|
3242
3400
|
])
|
|
3243
3401
|
).nullable()
|
|
3244
3402
|
}),
|
|
3245
|
-
|
|
3246
|
-
type:
|
|
3247
|
-
id:
|
|
3248
|
-
result:
|
|
3403
|
+
z18.object({
|
|
3404
|
+
type: z18.literal("image_generation_call"),
|
|
3405
|
+
id: z18.string(),
|
|
3406
|
+
result: z18.string()
|
|
3249
3407
|
}),
|
|
3250
|
-
|
|
3251
|
-
type:
|
|
3252
|
-
id:
|
|
3253
|
-
call_id:
|
|
3254
|
-
action:
|
|
3255
|
-
type:
|
|
3256
|
-
command:
|
|
3257
|
-
timeout_ms:
|
|
3258
|
-
user:
|
|
3259
|
-
working_directory:
|
|
3260
|
-
env:
|
|
3408
|
+
z18.object({
|
|
3409
|
+
type: z18.literal("local_shell_call"),
|
|
3410
|
+
id: z18.string(),
|
|
3411
|
+
call_id: z18.string(),
|
|
3412
|
+
action: z18.object({
|
|
3413
|
+
type: z18.literal("exec"),
|
|
3414
|
+
command: z18.array(z18.string()),
|
|
3415
|
+
timeout_ms: z18.number().optional(),
|
|
3416
|
+
user: z18.string().optional(),
|
|
3417
|
+
working_directory: z18.string().optional(),
|
|
3418
|
+
env: z18.record(z18.string(), z18.string()).optional()
|
|
3261
3419
|
})
|
|
3262
3420
|
}),
|
|
3263
|
-
|
|
3264
|
-
type:
|
|
3265
|
-
call_id:
|
|
3266
|
-
name:
|
|
3267
|
-
arguments:
|
|
3268
|
-
id:
|
|
3269
|
-
async:
|
|
3421
|
+
z18.object({
|
|
3422
|
+
type: z18.literal("function_call"),
|
|
3423
|
+
call_id: z18.string(),
|
|
3424
|
+
name: z18.string(),
|
|
3425
|
+
arguments: z18.string(),
|
|
3426
|
+
id: z18.string(),
|
|
3427
|
+
async: z18.boolean().nullish()
|
|
3270
3428
|
}),
|
|
3271
|
-
|
|
3272
|
-
type:
|
|
3273
|
-
id:
|
|
3274
|
-
status:
|
|
3429
|
+
z18.object({
|
|
3430
|
+
type: z18.literal("computer_call"),
|
|
3431
|
+
id: z18.string(),
|
|
3432
|
+
status: z18.string().optional()
|
|
3275
3433
|
}),
|
|
3276
|
-
|
|
3277
|
-
type:
|
|
3278
|
-
id:
|
|
3279
|
-
encrypted_content:
|
|
3280
|
-
summary:
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
text:
|
|
3434
|
+
z18.object({
|
|
3435
|
+
type: z18.literal("reasoning"),
|
|
3436
|
+
id: z18.string(),
|
|
3437
|
+
encrypted_content: z18.string().nullish(),
|
|
3438
|
+
summary: z18.array(
|
|
3439
|
+
z18.object({
|
|
3440
|
+
type: z18.literal("summary_text"),
|
|
3441
|
+
text: z18.string()
|
|
3284
3442
|
})
|
|
3285
3443
|
)
|
|
3286
3444
|
})
|
|
3287
3445
|
])
|
|
3288
3446
|
).optional(),
|
|
3289
|
-
service_tier:
|
|
3290
|
-
reasoning:
|
|
3291
|
-
context:
|
|
3447
|
+
service_tier: z18.string().nullish(),
|
|
3448
|
+
reasoning: z18.object({
|
|
3449
|
+
context: z18.string().nullish()
|
|
3292
3450
|
}).nullish(),
|
|
3293
|
-
incomplete_details:
|
|
3294
|
-
usage:
|
|
3295
|
-
input_tokens:
|
|
3296
|
-
input_tokens_details:
|
|
3297
|
-
cached_tokens:
|
|
3298
|
-
cache_write_tokens:
|
|
3299
|
-
orchestration_input_tokens:
|
|
3300
|
-
orchestration_input_cached_tokens:
|
|
3451
|
+
incomplete_details: z18.object({ reason: z18.string() }).nullish(),
|
|
3452
|
+
usage: z18.object({
|
|
3453
|
+
input_tokens: z18.number(),
|
|
3454
|
+
input_tokens_details: z18.object({
|
|
3455
|
+
cached_tokens: z18.number().nullish(),
|
|
3456
|
+
cache_write_tokens: z18.number().nullish(),
|
|
3457
|
+
orchestration_input_tokens: z18.number().nullish(),
|
|
3458
|
+
orchestration_input_cached_tokens: z18.number().nullish()
|
|
3301
3459
|
}).nullish(),
|
|
3302
|
-
output_tokens:
|
|
3303
|
-
output_tokens_details:
|
|
3304
|
-
reasoning_tokens:
|
|
3305
|
-
orchestration_output_tokens:
|
|
3460
|
+
output_tokens: z18.number(),
|
|
3461
|
+
output_tokens_details: z18.object({
|
|
3462
|
+
reasoning_tokens: z18.number().nullish(),
|
|
3463
|
+
orchestration_output_tokens: z18.number().nullish()
|
|
3306
3464
|
}).nullish()
|
|
3307
3465
|
}).optional()
|
|
3308
3466
|
})
|
|
3309
3467
|
)
|
|
3310
3468
|
);
|
|
3311
3469
|
|
|
3312
|
-
// src/responses/openai-responses-options.ts
|
|
3313
|
-
import {
|
|
3314
|
-
lazyValidator as lazyValidator10,
|
|
3315
|
-
zodSchema as zodSchema16
|
|
3316
|
-
} from "@ai-sdk/provider-utils";
|
|
3317
|
-
import { z as z18 } from "zod/v4";
|
|
3318
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
3319
|
-
var openaiResponsesReasoningModelIds = [
|
|
3320
|
-
"o1",
|
|
3321
|
-
"o1-2024-12-17",
|
|
3322
|
-
"o3",
|
|
3323
|
-
"o3-2025-04-16",
|
|
3324
|
-
"o3-deep-research",
|
|
3325
|
-
"o3-deep-research-2025-06-26",
|
|
3326
|
-
"o3-mini",
|
|
3327
|
-
"o3-mini-2025-01-31",
|
|
3328
|
-
"o4-mini",
|
|
3329
|
-
"o4-mini-2025-04-16",
|
|
3330
|
-
"o4-mini-deep-research",
|
|
3331
|
-
"o4-mini-deep-research-2025-06-26",
|
|
3332
|
-
"codex-mini-latest",
|
|
3333
|
-
"computer-use-preview",
|
|
3334
|
-
"gpt-5",
|
|
3335
|
-
"gpt-5-2025-08-07",
|
|
3336
|
-
"gpt-5-codex",
|
|
3337
|
-
"gpt-5-mini",
|
|
3338
|
-
"gpt-5-mini-2025-08-07",
|
|
3339
|
-
"gpt-5-nano",
|
|
3340
|
-
"gpt-5-nano-2025-08-07",
|
|
3341
|
-
"gpt-5-pro",
|
|
3342
|
-
"gpt-5-pro-2025-10-06",
|
|
3343
|
-
"gpt-5.1",
|
|
3344
|
-
"gpt-5.1-chat-latest",
|
|
3345
|
-
"gpt-5.1-codex-mini",
|
|
3346
|
-
"gpt-5.1-codex",
|
|
3347
|
-
"gpt-5.1-codex-max",
|
|
3348
|
-
"gpt-5.2",
|
|
3349
|
-
"gpt-5.2-chat-latest",
|
|
3350
|
-
"gpt-5.2-pro",
|
|
3351
|
-
"gpt-5.2-codex",
|
|
3352
|
-
"gpt-5.3-chat-latest",
|
|
3353
|
-
"gpt-5.3-codex",
|
|
3354
|
-
"gpt-5.4",
|
|
3355
|
-
"gpt-5.4-2026-03-05",
|
|
3356
|
-
"gpt-5.4-mini",
|
|
3357
|
-
"gpt-5.4-mini-2026-03-17",
|
|
3358
|
-
"gpt-5.4-nano",
|
|
3359
|
-
"gpt-5.4-nano-2026-03-17",
|
|
3360
|
-
"gpt-5.4-pro",
|
|
3361
|
-
"gpt-5.4-pro-2026-03-05",
|
|
3362
|
-
"gpt-5.6",
|
|
3363
|
-
"gpt-5.6-luna",
|
|
3364
|
-
"gpt-5.6-sol",
|
|
3365
|
-
"gpt-5.6-terra",
|
|
3366
|
-
"gpt-6-astra",
|
|
3367
|
-
"gpt-6-luna",
|
|
3368
|
-
"gpt-6-sol"
|
|
3369
|
-
];
|
|
3370
|
-
var openaiResponsesModelIds = [
|
|
3371
|
-
"gpt-4.1",
|
|
3372
|
-
"gpt-4.1-2025-04-14",
|
|
3373
|
-
"gpt-4.1-mini",
|
|
3374
|
-
"gpt-4.1-mini-2025-04-14",
|
|
3375
|
-
"gpt-4.1-nano",
|
|
3376
|
-
"gpt-4.1-nano-2025-04-14",
|
|
3377
|
-
"gpt-4o",
|
|
3378
|
-
"gpt-4o-2024-05-13",
|
|
3379
|
-
"gpt-4o-2024-08-06",
|
|
3380
|
-
"gpt-4o-2024-11-20",
|
|
3381
|
-
"gpt-4o-audio-preview",
|
|
3382
|
-
"gpt-4o-audio-preview-2024-10-01",
|
|
3383
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
3384
|
-
"gpt-4o-search-preview",
|
|
3385
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
3386
|
-
"gpt-4o-mini-search-preview",
|
|
3387
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3388
|
-
"gpt-4o-mini",
|
|
3389
|
-
"gpt-4o-mini-2024-07-18",
|
|
3390
|
-
"gpt-4-turbo",
|
|
3391
|
-
"gpt-4-turbo-2024-04-09",
|
|
3392
|
-
"gpt-4-turbo-preview",
|
|
3393
|
-
"gpt-4-0125-preview",
|
|
3394
|
-
"gpt-4-1106-preview",
|
|
3395
|
-
"gpt-4",
|
|
3396
|
-
"gpt-4-0613",
|
|
3397
|
-
"gpt-4.5-preview",
|
|
3398
|
-
"gpt-4.5-preview-2025-02-27",
|
|
3399
|
-
"gpt-3.5-turbo-0125",
|
|
3400
|
-
"gpt-3.5-turbo",
|
|
3401
|
-
"gpt-3.5-turbo-1106",
|
|
3402
|
-
"chatgpt-4o-latest",
|
|
3403
|
-
"gpt-5-chat-latest",
|
|
3404
|
-
...openaiResponsesReasoningModelIds
|
|
3405
|
-
];
|
|
3406
|
-
var openaiResponsesProviderOptionsSchema = lazyValidator10(
|
|
3407
|
-
() => zodSchema16(
|
|
3408
|
-
z18.object({
|
|
3409
|
-
conversation: z18.string().nullish(),
|
|
3410
|
-
include: z18.array(
|
|
3411
|
-
z18.enum([
|
|
3412
|
-
"reasoning.encrypted_content",
|
|
3413
|
-
// handled internally by default, only needed for unknown reasoning models
|
|
3414
|
-
"file_search_call.results",
|
|
3415
|
-
"message.output_text.logprobs"
|
|
3416
|
-
])
|
|
3417
|
-
).nullish(),
|
|
3418
|
-
instructions: z18.string().nullish(),
|
|
3419
|
-
/**
|
|
3420
|
-
* Return the log probabilities of the tokens.
|
|
3421
|
-
*
|
|
3422
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
3423
|
-
* were generated.
|
|
3424
|
-
*
|
|
3425
|
-
* Setting to a number will return the log probabilities of the top n
|
|
3426
|
-
* tokens that were generated.
|
|
3427
|
-
*
|
|
3428
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3429
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3430
|
-
*/
|
|
3431
|
-
logprobs: z18.union([z18.boolean(), z18.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3432
|
-
/**
|
|
3433
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3434
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3435
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
3436
|
-
*/
|
|
3437
|
-
maxToolCalls: z18.number().nullish(),
|
|
3438
|
-
metadata: z18.any().nullish(),
|
|
3439
|
-
parallelToolCalls: z18.boolean().nullish(),
|
|
3440
|
-
previousResponseId: z18.string().nullish(),
|
|
3441
|
-
promptCacheKey: z18.string().nullish(),
|
|
3442
|
-
/**
|
|
3443
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3444
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3445
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3446
|
-
*/
|
|
3447
|
-
promptCacheOptions: z18.object({
|
|
3448
|
-
mode: z18.enum(["implicit", "explicit"]).optional(),
|
|
3449
|
-
ttl: z18.literal("30m").optional()
|
|
3450
|
-
}).optional(),
|
|
3451
|
-
/**
|
|
3452
|
-
* The retention policy for the prompt cache.
|
|
3453
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3454
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3455
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
3456
|
-
*
|
|
3457
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3458
|
-
*
|
|
3459
|
-
* @default 'in_memory'
|
|
3460
|
-
*/
|
|
3461
|
-
promptCacheRetention: z18.enum(["in_memory", "24h"]).nullish(),
|
|
3462
|
-
/**
|
|
3463
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3464
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3465
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3466
|
-
* Supported values vary by model.
|
|
3467
|
-
*/
|
|
3468
|
-
reasoningEffort: z18.string().nullish(),
|
|
3469
|
-
/**
|
|
3470
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3471
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
3472
|
-
* request prefix for prompt caching.
|
|
3473
|
-
*
|
|
3474
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3475
|
-
* combined with automatic truncation.
|
|
3476
|
-
*/
|
|
3477
|
-
reasoningEffortUpdate: z18.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3478
|
-
/**
|
|
3479
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3480
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3481
|
-
*/
|
|
3482
|
-
reasoningMode: z18.enum(["standard", "pro"]).optional(),
|
|
3483
|
-
/**
|
|
3484
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
3485
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3486
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3487
|
-
*/
|
|
3488
|
-
reasoningContext: z18.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3489
|
-
reasoningSummary: z18.string().nullish(),
|
|
3490
|
-
safetyIdentifier: z18.string().nullish(),
|
|
3491
|
-
serviceTier: z18.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3492
|
-
store: z18.boolean().nullish(),
|
|
3493
|
-
strictJsonSchema: z18.boolean().nullish(),
|
|
3494
|
-
textVerbosity: z18.enum(["low", "medium", "high"]).nullish(),
|
|
3495
|
-
truncation: z18.enum(["auto", "disabled"]).nullish(),
|
|
3496
|
-
user: z18.string().nullish()
|
|
3497
|
-
})
|
|
3498
|
-
)
|
|
3499
|
-
);
|
|
3500
|
-
|
|
3501
3470
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3502
3471
|
import {
|
|
3503
3472
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError5
|
|
@@ -3672,6 +3641,18 @@ function resolveAsyncToolOption({
|
|
|
3672
3641
|
}
|
|
3673
3642
|
|
|
3674
3643
|
// src/responses/openai-responses-language-model.ts
|
|
3644
|
+
function getConfigurationUpdateUnsupportedReason({
|
|
3645
|
+
modelCapabilities,
|
|
3646
|
+
options
|
|
3647
|
+
}) {
|
|
3648
|
+
if (!modelCapabilities.supportsConfigurationUpdate) {
|
|
3649
|
+
return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
3650
|
+
}
|
|
3651
|
+
if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
|
|
3652
|
+
return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
|
|
3653
|
+
}
|
|
3654
|
+
return void 0;
|
|
3655
|
+
}
|
|
3675
3656
|
var OpenAIResponsesLanguageModel = class {
|
|
3676
3657
|
constructor(modelId, config) {
|
|
3677
3658
|
this.specificationVersion = "v2";
|
|
@@ -3736,8 +3717,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3736
3717
|
details: "conversation and previousResponseId cannot be used together"
|
|
3737
3718
|
});
|
|
3738
3719
|
}
|
|
3720
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
3721
|
+
modelCapabilities,
|
|
3722
|
+
options: openaiOptions
|
|
3723
|
+
});
|
|
3739
3724
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3740
3725
|
prompt,
|
|
3726
|
+
configurationUpdateUnsupportedReason,
|
|
3727
|
+
providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
|
|
3741
3728
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
3742
3729
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
3743
3730
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
@@ -3757,18 +3744,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3757
3744
|
resolvedReasoningEffort = void 0;
|
|
3758
3745
|
}
|
|
3759
3746
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
3760
|
-
|
|
3761
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
3747
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
3762
3748
|
warnings.push({
|
|
3763
3749
|
type: "unsupported-setting",
|
|
3764
3750
|
setting: "reasoningEffortUpdate",
|
|
3765
|
-
details:
|
|
3751
|
+
details: configurationUpdateUnsupportedReason
|
|
3766
3752
|
});
|
|
3767
3753
|
} else if (reasoningEffortUpdate != null) {
|
|
3768
|
-
input
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3754
|
+
const firstItem = input[0];
|
|
3755
|
+
if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
|
|
3756
|
+
input.unshift({
|
|
3757
|
+
type: "configuration_update",
|
|
3758
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
3759
|
+
});
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
for (let i = 1; i < input.length; i++) {
|
|
3763
|
+
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
3764
|
+
throw new UnsupportedFunctionalityError6({
|
|
3765
|
+
functionality: "Adjacent reasoning effort configuration updates"
|
|
3766
|
+
});
|
|
3767
|
+
}
|
|
3772
3768
|
}
|
|
3773
3769
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
3774
3770
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
@@ -5239,7 +5235,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5239
5235
|
};
|
|
5240
5236
|
|
|
5241
5237
|
// src/version.ts
|
|
5242
|
-
var VERSION = true ? "2.0.
|
|
5238
|
+
var VERSION = true ? "2.0.131" : "0.0.0-test";
|
|
5243
5239
|
|
|
5244
5240
|
// src/openai-provider.ts
|
|
5245
5241
|
function createOpenAI(options = {}) {
|