@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.js
CHANGED
|
@@ -1037,7 +1037,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1037
1037
|
abortSignal: options.abortSignal,
|
|
1038
1038
|
fetch: this.config.fetch
|
|
1039
1039
|
});
|
|
1040
|
-
|
|
1040
|
+
let toolCallTracker;
|
|
1041
1041
|
let finishReason = "unknown";
|
|
1042
1042
|
const usage = {
|
|
1043
1043
|
inputTokens: void 0,
|
|
@@ -1051,10 +1051,14 @@ var OpenAIChatLanguageModel = class {
|
|
|
1051
1051
|
stream: response.pipeThrough(
|
|
1052
1052
|
new TransformStream({
|
|
1053
1053
|
start(controller) {
|
|
1054
|
+
toolCallTracker = new import_provider_utils5.StreamingToolCallTracker(controller, {
|
|
1055
|
+
generateId: import_provider_utils5.generateId,
|
|
1056
|
+
typeValidation: "if-present"
|
|
1057
|
+
});
|
|
1054
1058
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1055
1059
|
},
|
|
1056
1060
|
transform(chunk, controller) {
|
|
1057
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m
|
|
1061
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1058
1062
|
if (options.includeRawChunks) {
|
|
1059
1063
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
1060
1064
|
}
|
|
@@ -1121,90 +1125,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1121
1125
|
}
|
|
1122
1126
|
if (delta.tool_calls != null) {
|
|
1123
1127
|
for (const toolCallDelta of delta.tool_calls) {
|
|
1124
|
-
|
|
1125
|
-
if (toolCalls[index] == null) {
|
|
1126
|
-
if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
|
|
1127
|
-
throw new import_provider3.InvalidResponseDataError({
|
|
1128
|
-
data: toolCallDelta,
|
|
1129
|
-
message: `Expected 'function' type.`
|
|
1130
|
-
});
|
|
1131
|
-
}
|
|
1132
|
-
if (toolCallDelta.id == null) {
|
|
1133
|
-
throw new import_provider3.InvalidResponseDataError({
|
|
1134
|
-
data: toolCallDelta,
|
|
1135
|
-
message: `Expected 'id' to be a string.`
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
|
-
if (((_n = toolCallDelta.function) == null ? void 0 : _n.name) == null) {
|
|
1139
|
-
throw new import_provider3.InvalidResponseDataError({
|
|
1140
|
-
data: toolCallDelta,
|
|
1141
|
-
message: `Expected 'function.name' to be a string.`
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
1144
|
-
controller.enqueue({
|
|
1145
|
-
type: "tool-input-start",
|
|
1146
|
-
id: toolCallDelta.id,
|
|
1147
|
-
toolName: toolCallDelta.function.name
|
|
1148
|
-
});
|
|
1149
|
-
toolCalls[index] = {
|
|
1150
|
-
id: toolCallDelta.id,
|
|
1151
|
-
type: "function",
|
|
1152
|
-
function: {
|
|
1153
|
-
name: toolCallDelta.function.name,
|
|
1154
|
-
arguments: (_o = toolCallDelta.function.arguments) != null ? _o : ""
|
|
1155
|
-
},
|
|
1156
|
-
hasFinished: false
|
|
1157
|
-
};
|
|
1158
|
-
const toolCall2 = toolCalls[index];
|
|
1159
|
-
if (((_p = toolCall2.function) == null ? void 0 : _p.name) != null && ((_q = toolCall2.function) == null ? void 0 : _q.arguments) != null) {
|
|
1160
|
-
if (toolCall2.function.arguments.length > 0) {
|
|
1161
|
-
controller.enqueue({
|
|
1162
|
-
type: "tool-input-delta",
|
|
1163
|
-
id: toolCall2.id,
|
|
1164
|
-
delta: toolCall2.function.arguments
|
|
1165
|
-
});
|
|
1166
|
-
}
|
|
1167
|
-
if ((0, import_provider_utils5.isParsableJson)(toolCall2.function.arguments)) {
|
|
1168
|
-
controller.enqueue({
|
|
1169
|
-
type: "tool-input-end",
|
|
1170
|
-
id: toolCall2.id
|
|
1171
|
-
});
|
|
1172
|
-
controller.enqueue({
|
|
1173
|
-
type: "tool-call",
|
|
1174
|
-
toolCallId: (_r = toolCall2.id) != null ? _r : (0, import_provider_utils5.generateId)(),
|
|
1175
|
-
toolName: toolCall2.function.name,
|
|
1176
|
-
input: toolCall2.function.arguments
|
|
1177
|
-
});
|
|
1178
|
-
toolCall2.hasFinished = true;
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
continue;
|
|
1182
|
-
}
|
|
1183
|
-
const toolCall = toolCalls[index];
|
|
1184
|
-
if (toolCall.hasFinished) {
|
|
1185
|
-
continue;
|
|
1186
|
-
}
|
|
1187
|
-
if (((_s = toolCallDelta.function) == null ? void 0 : _s.arguments) != null) {
|
|
1188
|
-
toolCall.function.arguments += (_u = (_t = toolCallDelta.function) == null ? void 0 : _t.arguments) != null ? _u : "";
|
|
1189
|
-
}
|
|
1190
|
-
controller.enqueue({
|
|
1191
|
-
type: "tool-input-delta",
|
|
1192
|
-
id: toolCall.id,
|
|
1193
|
-
delta: (_v = toolCallDelta.function.arguments) != null ? _v : ""
|
|
1194
|
-
});
|
|
1195
|
-
if (((_w = toolCall.function) == null ? void 0 : _w.name) != null && ((_x = toolCall.function) == null ? void 0 : _x.arguments) != null && (0, import_provider_utils5.isParsableJson)(toolCall.function.arguments)) {
|
|
1196
|
-
controller.enqueue({
|
|
1197
|
-
type: "tool-input-end",
|
|
1198
|
-
id: toolCall.id
|
|
1199
|
-
});
|
|
1200
|
-
controller.enqueue({
|
|
1201
|
-
type: "tool-call",
|
|
1202
|
-
toolCallId: (_y = toolCall.id) != null ? _y : (0, import_provider_utils5.generateId)(),
|
|
1203
|
-
toolName: toolCall.function.name,
|
|
1204
|
-
input: toolCall.function.arguments
|
|
1205
|
-
});
|
|
1206
|
-
toolCall.hasFinished = true;
|
|
1207
|
-
}
|
|
1128
|
+
toolCallTracker.processDelta(toolCallDelta);
|
|
1208
1129
|
}
|
|
1209
1130
|
}
|
|
1210
1131
|
if (delta.annotations != null) {
|
|
@@ -1223,6 +1144,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1223
1144
|
if (isActiveText) {
|
|
1224
1145
|
controller.enqueue({ type: "text-end", id: "0" });
|
|
1225
1146
|
}
|
|
1147
|
+
toolCallTracker.flush();
|
|
1226
1148
|
controller.enqueue({
|
|
1227
1149
|
type: "finish",
|
|
1228
1150
|
finishReason,
|
|
@@ -2357,8 +2279,211 @@ var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
|
2357
2279
|
|
|
2358
2280
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2359
2281
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2282
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2283
|
+
var import_v417 = require("zod/v4");
|
|
2284
|
+
|
|
2285
|
+
// src/responses/openai-responses-options.ts
|
|
2360
2286
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2361
2287
|
var import_v416 = require("zod/v4");
|
|
2288
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
2289
|
+
var openaiResponsesReasoningModelIds = [
|
|
2290
|
+
"o1",
|
|
2291
|
+
"o1-2024-12-17",
|
|
2292
|
+
"o3",
|
|
2293
|
+
"o3-2025-04-16",
|
|
2294
|
+
"o3-deep-research",
|
|
2295
|
+
"o3-deep-research-2025-06-26",
|
|
2296
|
+
"o3-mini",
|
|
2297
|
+
"o3-mini-2025-01-31",
|
|
2298
|
+
"o4-mini",
|
|
2299
|
+
"o4-mini-2025-04-16",
|
|
2300
|
+
"o4-mini-deep-research",
|
|
2301
|
+
"o4-mini-deep-research-2025-06-26",
|
|
2302
|
+
"codex-mini-latest",
|
|
2303
|
+
"computer-use-preview",
|
|
2304
|
+
"gpt-5",
|
|
2305
|
+
"gpt-5-2025-08-07",
|
|
2306
|
+
"gpt-5-codex",
|
|
2307
|
+
"gpt-5-mini",
|
|
2308
|
+
"gpt-5-mini-2025-08-07",
|
|
2309
|
+
"gpt-5-nano",
|
|
2310
|
+
"gpt-5-nano-2025-08-07",
|
|
2311
|
+
"gpt-5-pro",
|
|
2312
|
+
"gpt-5-pro-2025-10-06",
|
|
2313
|
+
"gpt-5.1",
|
|
2314
|
+
"gpt-5.1-chat-latest",
|
|
2315
|
+
"gpt-5.1-codex-mini",
|
|
2316
|
+
"gpt-5.1-codex",
|
|
2317
|
+
"gpt-5.1-codex-max",
|
|
2318
|
+
"gpt-5.2",
|
|
2319
|
+
"gpt-5.2-chat-latest",
|
|
2320
|
+
"gpt-5.2-pro",
|
|
2321
|
+
"gpt-5.2-codex",
|
|
2322
|
+
"gpt-5.3-chat-latest",
|
|
2323
|
+
"gpt-5.3-codex",
|
|
2324
|
+
"gpt-5.4",
|
|
2325
|
+
"gpt-5.4-2026-03-05",
|
|
2326
|
+
"gpt-5.4-mini",
|
|
2327
|
+
"gpt-5.4-mini-2026-03-17",
|
|
2328
|
+
"gpt-5.4-nano",
|
|
2329
|
+
"gpt-5.4-nano-2026-03-17",
|
|
2330
|
+
"gpt-5.4-pro",
|
|
2331
|
+
"gpt-5.4-pro-2026-03-05",
|
|
2332
|
+
"gpt-5.6",
|
|
2333
|
+
"gpt-5.6-luna",
|
|
2334
|
+
"gpt-5.6-sol",
|
|
2335
|
+
"gpt-5.6-terra",
|
|
2336
|
+
"gpt-6-astra",
|
|
2337
|
+
"gpt-6-luna",
|
|
2338
|
+
"gpt-6-sol"
|
|
2339
|
+
];
|
|
2340
|
+
var openaiResponsesModelIds = [
|
|
2341
|
+
"gpt-4.1",
|
|
2342
|
+
"gpt-4.1-2025-04-14",
|
|
2343
|
+
"gpt-4.1-mini",
|
|
2344
|
+
"gpt-4.1-mini-2025-04-14",
|
|
2345
|
+
"gpt-4.1-nano",
|
|
2346
|
+
"gpt-4.1-nano-2025-04-14",
|
|
2347
|
+
"gpt-4o",
|
|
2348
|
+
"gpt-4o-2024-05-13",
|
|
2349
|
+
"gpt-4o-2024-08-06",
|
|
2350
|
+
"gpt-4o-2024-11-20",
|
|
2351
|
+
"gpt-4o-audio-preview",
|
|
2352
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
2353
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
2354
|
+
"gpt-4o-search-preview",
|
|
2355
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
2356
|
+
"gpt-4o-mini-search-preview",
|
|
2357
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
2358
|
+
"gpt-4o-mini",
|
|
2359
|
+
"gpt-4o-mini-2024-07-18",
|
|
2360
|
+
"gpt-4-turbo",
|
|
2361
|
+
"gpt-4-turbo-2024-04-09",
|
|
2362
|
+
"gpt-4-turbo-preview",
|
|
2363
|
+
"gpt-4-0125-preview",
|
|
2364
|
+
"gpt-4-1106-preview",
|
|
2365
|
+
"gpt-4",
|
|
2366
|
+
"gpt-4-0613",
|
|
2367
|
+
"gpt-4.5-preview",
|
|
2368
|
+
"gpt-4.5-preview-2025-02-27",
|
|
2369
|
+
"gpt-3.5-turbo-0125",
|
|
2370
|
+
"gpt-3.5-turbo",
|
|
2371
|
+
"gpt-3.5-turbo-1106",
|
|
2372
|
+
"chatgpt-4o-latest",
|
|
2373
|
+
"gpt-5-chat-latest",
|
|
2374
|
+
...openaiResponsesReasoningModelIds
|
|
2375
|
+
];
|
|
2376
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils21.lazyValidator)(
|
|
2377
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2378
|
+
import_v416.z.object({
|
|
2379
|
+
conversation: import_v416.z.string().nullish(),
|
|
2380
|
+
include: import_v416.z.array(
|
|
2381
|
+
import_v416.z.enum([
|
|
2382
|
+
"reasoning.encrypted_content",
|
|
2383
|
+
// handled internally by default, only needed for unknown reasoning models
|
|
2384
|
+
"file_search_call.results",
|
|
2385
|
+
"message.output_text.logprobs"
|
|
2386
|
+
])
|
|
2387
|
+
).nullish(),
|
|
2388
|
+
instructions: import_v416.z.string().nullish(),
|
|
2389
|
+
/**
|
|
2390
|
+
* Return the log probabilities of the tokens.
|
|
2391
|
+
*
|
|
2392
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
2393
|
+
* were generated.
|
|
2394
|
+
*
|
|
2395
|
+
* Setting to a number will return the log probabilities of the top n
|
|
2396
|
+
* tokens that were generated.
|
|
2397
|
+
*
|
|
2398
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2399
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2400
|
+
*/
|
|
2401
|
+
logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2402
|
+
/**
|
|
2403
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2404
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2405
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
2406
|
+
*/
|
|
2407
|
+
maxToolCalls: import_v416.z.number().nullish(),
|
|
2408
|
+
metadata: import_v416.z.any().nullish(),
|
|
2409
|
+
parallelToolCalls: import_v416.z.boolean().nullish(),
|
|
2410
|
+
previousResponseId: import_v416.z.string().nullish(),
|
|
2411
|
+
promptCacheKey: import_v416.z.string().nullish(),
|
|
2412
|
+
/**
|
|
2413
|
+
* Prompt cache behavior for GPT-5.6 and later models.
|
|
2414
|
+
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
2415
|
+
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
2416
|
+
*/
|
|
2417
|
+
promptCacheOptions: import_v416.z.object({
|
|
2418
|
+
mode: import_v416.z.enum(["implicit", "explicit"]).optional(),
|
|
2419
|
+
ttl: import_v416.z.literal("30m").optional()
|
|
2420
|
+
}).optional(),
|
|
2421
|
+
/**
|
|
2422
|
+
* The retention policy for the prompt cache.
|
|
2423
|
+
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
2424
|
+
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
2425
|
+
* Available for models before GPT-5.6 that support extended caching.
|
|
2426
|
+
*
|
|
2427
|
+
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
2428
|
+
*
|
|
2429
|
+
* @default 'in_memory'
|
|
2430
|
+
*/
|
|
2431
|
+
promptCacheRetention: import_v416.z.enum(["in_memory", "24h"]).nullish(),
|
|
2432
|
+
/**
|
|
2433
|
+
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
2434
|
+
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
2435
|
+
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
2436
|
+
* Supported values vary by model.
|
|
2437
|
+
*/
|
|
2438
|
+
reasoningEffort: import_v416.z.string().nullish(),
|
|
2439
|
+
/**
|
|
2440
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
2441
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
2442
|
+
* request prefix for prompt caching.
|
|
2443
|
+
*
|
|
2444
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
2445
|
+
* combined with automatic truncation.
|
|
2446
|
+
*/
|
|
2447
|
+
reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
2448
|
+
/**
|
|
2449
|
+
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
2450
|
+
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
2451
|
+
*/
|
|
2452
|
+
reasoningMode: import_v416.z.enum(["standard", "pro"]).optional(),
|
|
2453
|
+
/**
|
|
2454
|
+
* Controls which available reasoning items GPT-5.6 can use.
|
|
2455
|
+
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
2456
|
+
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
2457
|
+
*/
|
|
2458
|
+
reasoningContext: import_v416.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
2459
|
+
reasoningSummary: import_v416.z.string().nullish(),
|
|
2460
|
+
safetyIdentifier: import_v416.z.string().nullish(),
|
|
2461
|
+
serviceTier: import_v416.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
2462
|
+
store: import_v416.z.boolean().nullish(),
|
|
2463
|
+
strictJsonSchema: import_v416.z.boolean().nullish(),
|
|
2464
|
+
textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
|
|
2465
|
+
truncation: import_v416.z.enum(["auto", "disabled"]).nullish(),
|
|
2466
|
+
user: import_v416.z.string().nullish()
|
|
2467
|
+
})
|
|
2468
|
+
)
|
|
2469
|
+
);
|
|
2470
|
+
var openaiResponsesSystemMessageOptionsSchema = (0, import_provider_utils21.lazyValidator)(
|
|
2471
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2472
|
+
import_v416.z.object({
|
|
2473
|
+
/**
|
|
2474
|
+
* Emit a configuration update at this position in Responses history.
|
|
2475
|
+
* Requires empty system message content and the same supported
|
|
2476
|
+
* configuration as the request-level reasoningEffortUpdate option.
|
|
2477
|
+
* Unsupported historical updates throw instead of being omitted.
|
|
2478
|
+
*
|
|
2479
|
+
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
2480
|
+
*/
|
|
2481
|
+
reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
2482
|
+
})
|
|
2483
|
+
)
|
|
2484
|
+
);
|
|
2485
|
+
|
|
2486
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
2362
2487
|
function getPromptCacheBreakpoint2(providerOptions) {
|
|
2363
2488
|
var _a2;
|
|
2364
2489
|
return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
|
|
@@ -2370,9 +2495,11 @@ function isFileId(data, prefixes) {
|
|
|
2370
2495
|
async function convertToOpenAIResponsesInput({
|
|
2371
2496
|
prompt,
|
|
2372
2497
|
systemMessageMode,
|
|
2498
|
+
providerOptionsName = "openai",
|
|
2373
2499
|
explicitMessageItemType = false,
|
|
2374
2500
|
fileIdPrefixes,
|
|
2375
2501
|
store,
|
|
2502
|
+
configurationUpdateUnsupportedReason,
|
|
2376
2503
|
hasLocalShellTool = false
|
|
2377
2504
|
}) {
|
|
2378
2505
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -2381,6 +2508,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
2381
2508
|
for (const { role, content, providerOptions } of prompt) {
|
|
2382
2509
|
switch (role) {
|
|
2383
2510
|
case "system": {
|
|
2511
|
+
let options = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2512
|
+
provider: providerOptionsName,
|
|
2513
|
+
providerOptions,
|
|
2514
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2515
|
+
});
|
|
2516
|
+
if (options == null && providerOptionsName !== "openai") {
|
|
2517
|
+
options = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2518
|
+
provider: "openai",
|
|
2519
|
+
providerOptions,
|
|
2520
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
const effort = options == null ? void 0 : options.reasoningEffortUpdate;
|
|
2524
|
+
if (effort != null) {
|
|
2525
|
+
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
2526
|
+
if (unsupportedReason != null) {
|
|
2527
|
+
throw new import_provider6.UnsupportedFunctionalityError({
|
|
2528
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
2529
|
+
message: unsupportedReason
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2532
|
+
input.push({
|
|
2533
|
+
type: "configuration_update",
|
|
2534
|
+
reasoning: { effort }
|
|
2535
|
+
});
|
|
2536
|
+
break;
|
|
2537
|
+
}
|
|
2384
2538
|
switch (systemMessageMode) {
|
|
2385
2539
|
case "system": {
|
|
2386
2540
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
|
|
@@ -2456,7 +2610,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2456
2610
|
return {
|
|
2457
2611
|
type: "input_image",
|
|
2458
2612
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2459
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2613
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2460
2614
|
},
|
|
2461
2615
|
detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3.openai) == null ? void 0 : _b2.imageDetail,
|
|
2462
2616
|
...promptCacheBreakpoint != null && {
|
|
@@ -2477,7 +2631,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2477
2631
|
type: "input_file",
|
|
2478
2632
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2479
2633
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2480
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2634
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2481
2635
|
},
|
|
2482
2636
|
...promptCacheBreakpoint != null && {
|
|
2483
2637
|
prompt_cache_breakpoint: promptCacheBreakpoint
|
|
@@ -2527,7 +2681,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2527
2681
|
break;
|
|
2528
2682
|
}
|
|
2529
2683
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2530
|
-
const parsedInput = await (0,
|
|
2684
|
+
const parsedInput = await (0, import_provider_utils22.validateTypes)({
|
|
2531
2685
|
value: part.input,
|
|
2532
2686
|
schema: localShellInputSchema
|
|
2533
2687
|
});
|
|
@@ -2569,7 +2723,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2569
2723
|
break;
|
|
2570
2724
|
}
|
|
2571
2725
|
case "reasoning": {
|
|
2572
|
-
const providerOptions2 = await (0,
|
|
2726
|
+
const providerOptions2 = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2573
2727
|
provider: "openai",
|
|
2574
2728
|
providerOptions: part.providerOptions,
|
|
2575
2729
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2633,7 +2787,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2633
2787
|
part.providerOptions
|
|
2634
2788
|
);
|
|
2635
2789
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2636
|
-
const parsedOutput = await (0,
|
|
2790
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2637
2791
|
value: output.value,
|
|
2638
2792
|
schema: localShellOutputSchema
|
|
2639
2793
|
});
|
|
@@ -2726,9 +2880,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2726
2880
|
}
|
|
2727
2881
|
return { input, warnings };
|
|
2728
2882
|
}
|
|
2729
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2730
|
-
itemId:
|
|
2731
|
-
reasoningEncryptedContent:
|
|
2883
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v417.z.object({
|
|
2884
|
+
itemId: import_v417.z.string().nullish(),
|
|
2885
|
+
reasoningEncryptedContent: import_v417.z.string().nullish()
|
|
2732
2886
|
});
|
|
2733
2887
|
|
|
2734
2888
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2750,288 +2904,288 @@ function mapOpenAIResponseFinishReason({
|
|
|
2750
2904
|
}
|
|
2751
2905
|
|
|
2752
2906
|
// src/responses/openai-responses-api.ts
|
|
2753
|
-
var
|
|
2754
|
-
var
|
|
2755
|
-
var openaiResponsesChunkSchema = (0,
|
|
2756
|
-
() => (0,
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
type:
|
|
2760
|
-
item_id:
|
|
2761
|
-
delta:
|
|
2762
|
-
logprobs:
|
|
2763
|
-
|
|
2764
|
-
token:
|
|
2765
|
-
logprob:
|
|
2766
|
-
top_logprobs:
|
|
2767
|
-
|
|
2768
|
-
token:
|
|
2769
|
-
logprob:
|
|
2907
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2908
|
+
var import_v418 = require("zod/v4");
|
|
2909
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils23.lazyValidator)(
|
|
2910
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2911
|
+
import_v418.z.union([
|
|
2912
|
+
import_v418.z.object({
|
|
2913
|
+
type: import_v418.z.literal("response.output_text.delta"),
|
|
2914
|
+
item_id: import_v418.z.string(),
|
|
2915
|
+
delta: import_v418.z.string(),
|
|
2916
|
+
logprobs: import_v418.z.array(
|
|
2917
|
+
import_v418.z.object({
|
|
2918
|
+
token: import_v418.z.string(),
|
|
2919
|
+
logprob: import_v418.z.number(),
|
|
2920
|
+
top_logprobs: import_v418.z.array(
|
|
2921
|
+
import_v418.z.object({
|
|
2922
|
+
token: import_v418.z.string(),
|
|
2923
|
+
logprob: import_v418.z.number()
|
|
2770
2924
|
})
|
|
2771
2925
|
)
|
|
2772
2926
|
})
|
|
2773
2927
|
).nullish()
|
|
2774
2928
|
}),
|
|
2775
|
-
|
|
2776
|
-
type:
|
|
2777
|
-
response:
|
|
2778
|
-
incomplete_details:
|
|
2779
|
-
usage:
|
|
2780
|
-
input_tokens:
|
|
2781
|
-
input_tokens_details:
|
|
2782
|
-
cached_tokens:
|
|
2783
|
-
cache_write_tokens:
|
|
2784
|
-
orchestration_input_tokens:
|
|
2785
|
-
orchestration_input_cached_tokens:
|
|
2929
|
+
import_v418.z.object({
|
|
2930
|
+
type: import_v418.z.enum(["response.completed", "response.incomplete"]),
|
|
2931
|
+
response: import_v418.z.object({
|
|
2932
|
+
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
2933
|
+
usage: import_v418.z.object({
|
|
2934
|
+
input_tokens: import_v418.z.number(),
|
|
2935
|
+
input_tokens_details: import_v418.z.object({
|
|
2936
|
+
cached_tokens: import_v418.z.number().nullish(),
|
|
2937
|
+
cache_write_tokens: import_v418.z.number().nullish(),
|
|
2938
|
+
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
2939
|
+
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
2786
2940
|
}).nullish(),
|
|
2787
|
-
output_tokens:
|
|
2788
|
-
output_tokens_details:
|
|
2789
|
-
reasoning_tokens:
|
|
2790
|
-
orchestration_output_tokens:
|
|
2941
|
+
output_tokens: import_v418.z.number(),
|
|
2942
|
+
output_tokens_details: import_v418.z.object({
|
|
2943
|
+
reasoning_tokens: import_v418.z.number().nullish(),
|
|
2944
|
+
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
2791
2945
|
}).nullish()
|
|
2792
2946
|
}),
|
|
2793
|
-
reasoning:
|
|
2794
|
-
context:
|
|
2947
|
+
reasoning: import_v418.z.object({
|
|
2948
|
+
context: import_v418.z.string().nullish()
|
|
2795
2949
|
}).nullish(),
|
|
2796
|
-
service_tier:
|
|
2950
|
+
service_tier: import_v418.z.string().nullish()
|
|
2797
2951
|
})
|
|
2798
2952
|
}),
|
|
2799
|
-
|
|
2800
|
-
type:
|
|
2801
|
-
response:
|
|
2802
|
-
id:
|
|
2803
|
-
created_at:
|
|
2804
|
-
model:
|
|
2805
|
-
service_tier:
|
|
2953
|
+
import_v418.z.object({
|
|
2954
|
+
type: import_v418.z.literal("response.created"),
|
|
2955
|
+
response: import_v418.z.object({
|
|
2956
|
+
id: import_v418.z.string(),
|
|
2957
|
+
created_at: import_v418.z.number(),
|
|
2958
|
+
model: import_v418.z.string(),
|
|
2959
|
+
service_tier: import_v418.z.string().nullish()
|
|
2806
2960
|
})
|
|
2807
2961
|
}),
|
|
2808
|
-
|
|
2809
|
-
type:
|
|
2810
|
-
output_index:
|
|
2811
|
-
item:
|
|
2812
|
-
|
|
2813
|
-
type:
|
|
2814
|
-
id:
|
|
2815
|
-
phase:
|
|
2962
|
+
import_v418.z.object({
|
|
2963
|
+
type: import_v418.z.literal("response.output_item.added"),
|
|
2964
|
+
output_index: import_v418.z.number(),
|
|
2965
|
+
item: import_v418.z.discriminatedUnion("type", [
|
|
2966
|
+
import_v418.z.object({
|
|
2967
|
+
type: import_v418.z.literal("message"),
|
|
2968
|
+
id: import_v418.z.string(),
|
|
2969
|
+
phase: import_v418.z.enum(["commentary", "final_answer"]).nullish()
|
|
2816
2970
|
}),
|
|
2817
|
-
|
|
2818
|
-
type:
|
|
2819
|
-
id:
|
|
2820
|
-
encrypted_content:
|
|
2971
|
+
import_v418.z.object({
|
|
2972
|
+
type: import_v418.z.literal("reasoning"),
|
|
2973
|
+
id: import_v418.z.string(),
|
|
2974
|
+
encrypted_content: import_v418.z.string().nullish()
|
|
2821
2975
|
}),
|
|
2822
|
-
|
|
2823
|
-
type:
|
|
2824
|
-
id:
|
|
2825
|
-
call_id:
|
|
2826
|
-
name:
|
|
2827
|
-
arguments:
|
|
2828
|
-
async:
|
|
2976
|
+
import_v418.z.object({
|
|
2977
|
+
type: import_v418.z.literal("function_call"),
|
|
2978
|
+
id: import_v418.z.string(),
|
|
2979
|
+
call_id: import_v418.z.string(),
|
|
2980
|
+
name: import_v418.z.string(),
|
|
2981
|
+
arguments: import_v418.z.string(),
|
|
2982
|
+
async: import_v418.z.boolean().nullish()
|
|
2829
2983
|
}),
|
|
2830
|
-
|
|
2831
|
-
type:
|
|
2832
|
-
id:
|
|
2833
|
-
status:
|
|
2984
|
+
import_v418.z.object({
|
|
2985
|
+
type: import_v418.z.literal("web_search_call"),
|
|
2986
|
+
id: import_v418.z.string(),
|
|
2987
|
+
status: import_v418.z.string()
|
|
2834
2988
|
}),
|
|
2835
|
-
|
|
2836
|
-
type:
|
|
2837
|
-
id:
|
|
2838
|
-
status:
|
|
2989
|
+
import_v418.z.object({
|
|
2990
|
+
type: import_v418.z.literal("computer_call"),
|
|
2991
|
+
id: import_v418.z.string(),
|
|
2992
|
+
status: import_v418.z.string()
|
|
2839
2993
|
}),
|
|
2840
|
-
|
|
2841
|
-
type:
|
|
2842
|
-
id:
|
|
2994
|
+
import_v418.z.object({
|
|
2995
|
+
type: import_v418.z.literal("file_search_call"),
|
|
2996
|
+
id: import_v418.z.string()
|
|
2843
2997
|
}),
|
|
2844
|
-
|
|
2845
|
-
type:
|
|
2846
|
-
id:
|
|
2998
|
+
import_v418.z.object({
|
|
2999
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
3000
|
+
id: import_v418.z.string()
|
|
2847
3001
|
}),
|
|
2848
|
-
|
|
2849
|
-
type:
|
|
2850
|
-
id:
|
|
2851
|
-
container_id:
|
|
2852
|
-
code:
|
|
2853
|
-
outputs:
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
3002
|
+
import_v418.z.object({
|
|
3003
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
3004
|
+
id: import_v418.z.string(),
|
|
3005
|
+
container_id: import_v418.z.string(),
|
|
3006
|
+
code: import_v418.z.string().nullable(),
|
|
3007
|
+
outputs: import_v418.z.array(
|
|
3008
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3009
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
3010
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2857
3011
|
])
|
|
2858
3012
|
).nullable(),
|
|
2859
|
-
status:
|
|
3013
|
+
status: import_v418.z.string()
|
|
2860
3014
|
})
|
|
2861
3015
|
])
|
|
2862
3016
|
}),
|
|
2863
|
-
|
|
2864
|
-
type:
|
|
2865
|
-
output_index:
|
|
2866
|
-
item:
|
|
2867
|
-
|
|
2868
|
-
type:
|
|
2869
|
-
id:
|
|
2870
|
-
phase:
|
|
3017
|
+
import_v418.z.object({
|
|
3018
|
+
type: import_v418.z.literal("response.output_item.done"),
|
|
3019
|
+
output_index: import_v418.z.number(),
|
|
3020
|
+
item: import_v418.z.discriminatedUnion("type", [
|
|
3021
|
+
import_v418.z.object({
|
|
3022
|
+
type: import_v418.z.literal("message"),
|
|
3023
|
+
id: import_v418.z.string(),
|
|
3024
|
+
phase: import_v418.z.enum(["commentary", "final_answer"]).nullish()
|
|
2871
3025
|
}),
|
|
2872
|
-
|
|
2873
|
-
type:
|
|
2874
|
-
id:
|
|
2875
|
-
encrypted_content:
|
|
3026
|
+
import_v418.z.object({
|
|
3027
|
+
type: import_v418.z.literal("reasoning"),
|
|
3028
|
+
id: import_v418.z.string(),
|
|
3029
|
+
encrypted_content: import_v418.z.string().nullish()
|
|
2876
3030
|
}),
|
|
2877
|
-
|
|
2878
|
-
type:
|
|
2879
|
-
id:
|
|
2880
|
-
call_id:
|
|
2881
|
-
name:
|
|
2882
|
-
arguments:
|
|
2883
|
-
async:
|
|
2884
|
-
status:
|
|
3031
|
+
import_v418.z.object({
|
|
3032
|
+
type: import_v418.z.literal("function_call"),
|
|
3033
|
+
id: import_v418.z.string(),
|
|
3034
|
+
call_id: import_v418.z.string(),
|
|
3035
|
+
name: import_v418.z.string(),
|
|
3036
|
+
arguments: import_v418.z.string(),
|
|
3037
|
+
async: import_v418.z.boolean().nullish(),
|
|
3038
|
+
status: import_v418.z.enum(["in_progress", "completed", "incomplete"])
|
|
2885
3039
|
}),
|
|
2886
|
-
|
|
2887
|
-
type:
|
|
2888
|
-
id:
|
|
2889
|
-
code:
|
|
2890
|
-
container_id:
|
|
2891
|
-
outputs:
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
3040
|
+
import_v418.z.object({
|
|
3041
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
3042
|
+
id: import_v418.z.string(),
|
|
3043
|
+
code: import_v418.z.string().nullable(),
|
|
3044
|
+
container_id: import_v418.z.string(),
|
|
3045
|
+
outputs: import_v418.z.array(
|
|
3046
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3047
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
3048
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2895
3049
|
])
|
|
2896
3050
|
).nullable()
|
|
2897
3051
|
}),
|
|
2898
|
-
|
|
2899
|
-
type:
|
|
2900
|
-
id:
|
|
2901
|
-
result:
|
|
3052
|
+
import_v418.z.object({
|
|
3053
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
3054
|
+
id: import_v418.z.string(),
|
|
3055
|
+
result: import_v418.z.string()
|
|
2902
3056
|
}),
|
|
2903
|
-
|
|
2904
|
-
type:
|
|
2905
|
-
id:
|
|
2906
|
-
status:
|
|
2907
|
-
action:
|
|
2908
|
-
|
|
2909
|
-
type:
|
|
2910
|
-
query:
|
|
2911
|
-
sources:
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
3057
|
+
import_v418.z.object({
|
|
3058
|
+
type: import_v418.z.literal("web_search_call"),
|
|
3059
|
+
id: import_v418.z.string(),
|
|
3060
|
+
status: import_v418.z.string(),
|
|
3061
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
3062
|
+
import_v418.z.object({
|
|
3063
|
+
type: import_v418.z.literal("search"),
|
|
3064
|
+
query: import_v418.z.string().nullish(),
|
|
3065
|
+
sources: import_v418.z.array(
|
|
3066
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3067
|
+
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
3068
|
+
import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
|
|
2915
3069
|
])
|
|
2916
3070
|
).nullish()
|
|
2917
3071
|
}),
|
|
2918
|
-
|
|
2919
|
-
type:
|
|
2920
|
-
url:
|
|
3072
|
+
import_v418.z.object({
|
|
3073
|
+
type: import_v418.z.literal("open_page"),
|
|
3074
|
+
url: import_v418.z.string().nullish()
|
|
2921
3075
|
}),
|
|
2922
|
-
|
|
2923
|
-
type:
|
|
2924
|
-
url:
|
|
2925
|
-
pattern:
|
|
3076
|
+
import_v418.z.object({
|
|
3077
|
+
type: import_v418.z.literal("find_in_page"),
|
|
3078
|
+
url: import_v418.z.string().nullish(),
|
|
3079
|
+
pattern: import_v418.z.string().nullish()
|
|
2926
3080
|
})
|
|
2927
3081
|
]).nullish()
|
|
2928
3082
|
}),
|
|
2929
|
-
|
|
2930
|
-
type:
|
|
2931
|
-
id:
|
|
2932
|
-
queries:
|
|
2933
|
-
results:
|
|
2934
|
-
|
|
2935
|
-
attributes:
|
|
2936
|
-
file_id:
|
|
2937
|
-
filename:
|
|
2938
|
-
score:
|
|
2939
|
-
text:
|
|
3083
|
+
import_v418.z.object({
|
|
3084
|
+
type: import_v418.z.literal("file_search_call"),
|
|
3085
|
+
id: import_v418.z.string(),
|
|
3086
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
3087
|
+
results: import_v418.z.array(
|
|
3088
|
+
import_v418.z.object({
|
|
3089
|
+
attributes: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()),
|
|
3090
|
+
file_id: import_v418.z.string(),
|
|
3091
|
+
filename: import_v418.z.string(),
|
|
3092
|
+
score: import_v418.z.number(),
|
|
3093
|
+
text: import_v418.z.string()
|
|
2940
3094
|
})
|
|
2941
3095
|
).nullish()
|
|
2942
3096
|
}),
|
|
2943
|
-
|
|
2944
|
-
type:
|
|
2945
|
-
id:
|
|
2946
|
-
call_id:
|
|
2947
|
-
action:
|
|
2948
|
-
type:
|
|
2949
|
-
command:
|
|
2950
|
-
timeout_ms:
|
|
2951
|
-
user:
|
|
2952
|
-
working_directory:
|
|
2953
|
-
env:
|
|
3097
|
+
import_v418.z.object({
|
|
3098
|
+
type: import_v418.z.literal("local_shell_call"),
|
|
3099
|
+
id: import_v418.z.string(),
|
|
3100
|
+
call_id: import_v418.z.string(),
|
|
3101
|
+
action: import_v418.z.object({
|
|
3102
|
+
type: import_v418.z.literal("exec"),
|
|
3103
|
+
command: import_v418.z.array(import_v418.z.string()),
|
|
3104
|
+
timeout_ms: import_v418.z.number().optional(),
|
|
3105
|
+
user: import_v418.z.string().optional(),
|
|
3106
|
+
working_directory: import_v418.z.string().optional(),
|
|
3107
|
+
env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
|
|
2954
3108
|
})
|
|
2955
3109
|
}),
|
|
2956
|
-
|
|
2957
|
-
type:
|
|
2958
|
-
id:
|
|
2959
|
-
status:
|
|
3110
|
+
import_v418.z.object({
|
|
3111
|
+
type: import_v418.z.literal("computer_call"),
|
|
3112
|
+
id: import_v418.z.string(),
|
|
3113
|
+
status: import_v418.z.literal("completed")
|
|
2960
3114
|
})
|
|
2961
3115
|
])
|
|
2962
3116
|
}),
|
|
2963
|
-
|
|
2964
|
-
type:
|
|
2965
|
-
item_id:
|
|
2966
|
-
output_index:
|
|
2967
|
-
delta:
|
|
3117
|
+
import_v418.z.object({
|
|
3118
|
+
type: import_v418.z.literal("response.function_call_arguments.delta"),
|
|
3119
|
+
item_id: import_v418.z.string(),
|
|
3120
|
+
output_index: import_v418.z.number(),
|
|
3121
|
+
delta: import_v418.z.string()
|
|
2968
3122
|
}),
|
|
2969
|
-
|
|
2970
|
-
type:
|
|
2971
|
-
item_id:
|
|
2972
|
-
output_index:
|
|
2973
|
-
partial_image_b64:
|
|
3123
|
+
import_v418.z.object({
|
|
3124
|
+
type: import_v418.z.literal("response.image_generation_call.partial_image"),
|
|
3125
|
+
item_id: import_v418.z.string(),
|
|
3126
|
+
output_index: import_v418.z.number(),
|
|
3127
|
+
partial_image_b64: import_v418.z.string()
|
|
2974
3128
|
}),
|
|
2975
|
-
|
|
2976
|
-
type:
|
|
2977
|
-
item_id:
|
|
2978
|
-
output_index:
|
|
2979
|
-
delta:
|
|
3129
|
+
import_v418.z.object({
|
|
3130
|
+
type: import_v418.z.literal("response.code_interpreter_call_code.delta"),
|
|
3131
|
+
item_id: import_v418.z.string(),
|
|
3132
|
+
output_index: import_v418.z.number(),
|
|
3133
|
+
delta: import_v418.z.string()
|
|
2980
3134
|
}),
|
|
2981
|
-
|
|
2982
|
-
type:
|
|
2983
|
-
item_id:
|
|
2984
|
-
output_index:
|
|
2985
|
-
code:
|
|
3135
|
+
import_v418.z.object({
|
|
3136
|
+
type: import_v418.z.literal("response.code_interpreter_call_code.done"),
|
|
3137
|
+
item_id: import_v418.z.string(),
|
|
3138
|
+
output_index: import_v418.z.number(),
|
|
3139
|
+
code: import_v418.z.string()
|
|
2986
3140
|
}),
|
|
2987
|
-
|
|
2988
|
-
type:
|
|
2989
|
-
annotation:
|
|
2990
|
-
|
|
2991
|
-
type:
|
|
2992
|
-
start_index:
|
|
2993
|
-
end_index:
|
|
2994
|
-
url:
|
|
2995
|
-
title:
|
|
3141
|
+
import_v418.z.object({
|
|
3142
|
+
type: import_v418.z.literal("response.output_text.annotation.added"),
|
|
3143
|
+
annotation: import_v418.z.discriminatedUnion("type", [
|
|
3144
|
+
import_v418.z.object({
|
|
3145
|
+
type: import_v418.z.literal("url_citation"),
|
|
3146
|
+
start_index: import_v418.z.number(),
|
|
3147
|
+
end_index: import_v418.z.number(),
|
|
3148
|
+
url: import_v418.z.string(),
|
|
3149
|
+
title: import_v418.z.string()
|
|
2996
3150
|
}),
|
|
2997
|
-
|
|
2998
|
-
type:
|
|
2999
|
-
file_id:
|
|
3000
|
-
filename:
|
|
3001
|
-
index:
|
|
3002
|
-
start_index:
|
|
3003
|
-
end_index:
|
|
3004
|
-
quote:
|
|
3151
|
+
import_v418.z.object({
|
|
3152
|
+
type: import_v418.z.literal("file_citation"),
|
|
3153
|
+
file_id: import_v418.z.string(),
|
|
3154
|
+
filename: import_v418.z.string().nullish(),
|
|
3155
|
+
index: import_v418.z.number().nullish(),
|
|
3156
|
+
start_index: import_v418.z.number().nullish(),
|
|
3157
|
+
end_index: import_v418.z.number().nullish(),
|
|
3158
|
+
quote: import_v418.z.string().nullish()
|
|
3005
3159
|
})
|
|
3006
3160
|
])
|
|
3007
3161
|
}),
|
|
3008
|
-
|
|
3009
|
-
type:
|
|
3010
|
-
item_id:
|
|
3011
|
-
summary_index:
|
|
3162
|
+
import_v418.z.object({
|
|
3163
|
+
type: import_v418.z.literal("response.reasoning_summary_part.added"),
|
|
3164
|
+
item_id: import_v418.z.string(),
|
|
3165
|
+
summary_index: import_v418.z.number()
|
|
3012
3166
|
}),
|
|
3013
|
-
|
|
3014
|
-
type:
|
|
3015
|
-
item_id:
|
|
3016
|
-
summary_index:
|
|
3017
|
-
delta:
|
|
3167
|
+
import_v418.z.object({
|
|
3168
|
+
type: import_v418.z.literal("response.reasoning_summary_text.delta"),
|
|
3169
|
+
item_id: import_v418.z.string(),
|
|
3170
|
+
summary_index: import_v418.z.number(),
|
|
3171
|
+
delta: import_v418.z.string()
|
|
3018
3172
|
}),
|
|
3019
|
-
|
|
3020
|
-
type:
|
|
3021
|
-
item_id:
|
|
3022
|
-
summary_index:
|
|
3173
|
+
import_v418.z.object({
|
|
3174
|
+
type: import_v418.z.literal("response.reasoning_summary_part.done"),
|
|
3175
|
+
item_id: import_v418.z.string(),
|
|
3176
|
+
summary_index: import_v418.z.number()
|
|
3023
3177
|
}),
|
|
3024
|
-
|
|
3025
|
-
type:
|
|
3026
|
-
sequence_number:
|
|
3027
|
-
error:
|
|
3028
|
-
type:
|
|
3029
|
-
code:
|
|
3030
|
-
message:
|
|
3031
|
-
param:
|
|
3178
|
+
import_v418.z.object({
|
|
3179
|
+
type: import_v418.z.literal("error"),
|
|
3180
|
+
sequence_number: import_v418.z.number(),
|
|
3181
|
+
error: import_v418.z.object({
|
|
3182
|
+
type: import_v418.z.string(),
|
|
3183
|
+
code: import_v418.z.string(),
|
|
3184
|
+
message: import_v418.z.string(),
|
|
3185
|
+
param: import_v418.z.string().nullish()
|
|
3032
3186
|
})
|
|
3033
3187
|
}),
|
|
3034
|
-
|
|
3188
|
+
import_v418.z.object({ type: import_v418.z.string() }).loose().transform((value) => ({
|
|
3035
3189
|
type: "unknown_chunk",
|
|
3036
3190
|
message: value.type
|
|
3037
3191
|
}))
|
|
@@ -3039,389 +3193,203 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
|
|
|
3039
3193
|
])
|
|
3040
3194
|
)
|
|
3041
3195
|
);
|
|
3042
|
-
var openaiResponsesResponseSchema = (0,
|
|
3043
|
-
() => (0,
|
|
3044
|
-
|
|
3045
|
-
id:
|
|
3046
|
-
created_at:
|
|
3047
|
-
error:
|
|
3048
|
-
message:
|
|
3049
|
-
type:
|
|
3050
|
-
param:
|
|
3051
|
-
code:
|
|
3196
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3197
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3198
|
+
import_v418.z.object({
|
|
3199
|
+
id: import_v418.z.string().optional(),
|
|
3200
|
+
created_at: import_v418.z.number().optional(),
|
|
3201
|
+
error: import_v418.z.object({
|
|
3202
|
+
message: import_v418.z.string(),
|
|
3203
|
+
type: import_v418.z.string(),
|
|
3204
|
+
param: import_v418.z.string().nullish(),
|
|
3205
|
+
code: import_v418.z.string()
|
|
3052
3206
|
}).nullish(),
|
|
3053
|
-
model:
|
|
3054
|
-
output:
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
type:
|
|
3058
|
-
role:
|
|
3059
|
-
id:
|
|
3060
|
-
phase:
|
|
3061
|
-
content:
|
|
3062
|
-
|
|
3063
|
-
type:
|
|
3064
|
-
text:
|
|
3065
|
-
logprobs:
|
|
3066
|
-
|
|
3067
|
-
token:
|
|
3068
|
-
logprob:
|
|
3069
|
-
top_logprobs:
|
|
3070
|
-
|
|
3071
|
-
token:
|
|
3072
|
-
logprob:
|
|
3207
|
+
model: import_v418.z.string().optional(),
|
|
3208
|
+
output: import_v418.z.array(
|
|
3209
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3210
|
+
import_v418.z.object({
|
|
3211
|
+
type: import_v418.z.literal("message"),
|
|
3212
|
+
role: import_v418.z.literal("assistant"),
|
|
3213
|
+
id: import_v418.z.string(),
|
|
3214
|
+
phase: import_v418.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3215
|
+
content: import_v418.z.array(
|
|
3216
|
+
import_v418.z.object({
|
|
3217
|
+
type: import_v418.z.literal("output_text"),
|
|
3218
|
+
text: import_v418.z.string(),
|
|
3219
|
+
logprobs: import_v418.z.array(
|
|
3220
|
+
import_v418.z.object({
|
|
3221
|
+
token: import_v418.z.string(),
|
|
3222
|
+
logprob: import_v418.z.number(),
|
|
3223
|
+
top_logprobs: import_v418.z.array(
|
|
3224
|
+
import_v418.z.object({
|
|
3225
|
+
token: import_v418.z.string(),
|
|
3226
|
+
logprob: import_v418.z.number()
|
|
3073
3227
|
})
|
|
3074
3228
|
)
|
|
3075
3229
|
})
|
|
3076
3230
|
).nullish(),
|
|
3077
|
-
annotations:
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
type:
|
|
3081
|
-
start_index:
|
|
3082
|
-
end_index:
|
|
3083
|
-
url:
|
|
3084
|
-
title:
|
|
3231
|
+
annotations: import_v418.z.array(
|
|
3232
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3233
|
+
import_v418.z.object({
|
|
3234
|
+
type: import_v418.z.literal("url_citation"),
|
|
3235
|
+
start_index: import_v418.z.number(),
|
|
3236
|
+
end_index: import_v418.z.number(),
|
|
3237
|
+
url: import_v418.z.string(),
|
|
3238
|
+
title: import_v418.z.string()
|
|
3085
3239
|
}),
|
|
3086
|
-
|
|
3087
|
-
type:
|
|
3088
|
-
file_id:
|
|
3089
|
-
filename:
|
|
3090
|
-
index:
|
|
3091
|
-
start_index:
|
|
3092
|
-
end_index:
|
|
3093
|
-
quote:
|
|
3240
|
+
import_v418.z.object({
|
|
3241
|
+
type: import_v418.z.literal("file_citation"),
|
|
3242
|
+
file_id: import_v418.z.string(),
|
|
3243
|
+
filename: import_v418.z.string().nullish(),
|
|
3244
|
+
index: import_v418.z.number().nullish(),
|
|
3245
|
+
start_index: import_v418.z.number().nullish(),
|
|
3246
|
+
end_index: import_v418.z.number().nullish(),
|
|
3247
|
+
quote: import_v418.z.string().nullish()
|
|
3094
3248
|
}),
|
|
3095
|
-
|
|
3096
|
-
type:
|
|
3097
|
-
container_id:
|
|
3098
|
-
file_id:
|
|
3099
|
-
filename:
|
|
3100
|
-
start_index:
|
|
3101
|
-
end_index:
|
|
3102
|
-
index:
|
|
3249
|
+
import_v418.z.object({
|
|
3250
|
+
type: import_v418.z.literal("container_file_citation"),
|
|
3251
|
+
container_id: import_v418.z.string(),
|
|
3252
|
+
file_id: import_v418.z.string(),
|
|
3253
|
+
filename: import_v418.z.string().nullish(),
|
|
3254
|
+
start_index: import_v418.z.number().nullish(),
|
|
3255
|
+
end_index: import_v418.z.number().nullish(),
|
|
3256
|
+
index: import_v418.z.number().nullish()
|
|
3103
3257
|
}),
|
|
3104
|
-
|
|
3105
|
-
type:
|
|
3106
|
-
file_id:
|
|
3107
|
-
index:
|
|
3258
|
+
import_v418.z.object({
|
|
3259
|
+
type: import_v418.z.literal("file_path"),
|
|
3260
|
+
file_id: import_v418.z.string(),
|
|
3261
|
+
index: import_v418.z.number().nullish()
|
|
3108
3262
|
})
|
|
3109
3263
|
])
|
|
3110
3264
|
)
|
|
3111
3265
|
})
|
|
3112
3266
|
)
|
|
3113
3267
|
}),
|
|
3114
|
-
|
|
3115
|
-
type:
|
|
3116
|
-
id:
|
|
3117
|
-
status:
|
|
3118
|
-
action:
|
|
3119
|
-
|
|
3120
|
-
type:
|
|
3121
|
-
query:
|
|
3122
|
-
sources:
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
type:
|
|
3127
|
-
name:
|
|
3268
|
+
import_v418.z.object({
|
|
3269
|
+
type: import_v418.z.literal("web_search_call"),
|
|
3270
|
+
id: import_v418.z.string(),
|
|
3271
|
+
status: import_v418.z.string(),
|
|
3272
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
3273
|
+
import_v418.z.object({
|
|
3274
|
+
type: import_v418.z.literal("search"),
|
|
3275
|
+
query: import_v418.z.string().nullish(),
|
|
3276
|
+
sources: import_v418.z.array(
|
|
3277
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3278
|
+
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
3279
|
+
import_v418.z.object({
|
|
3280
|
+
type: import_v418.z.literal("api"),
|
|
3281
|
+
name: import_v418.z.string()
|
|
3128
3282
|
})
|
|
3129
3283
|
])
|
|
3130
3284
|
).nullish()
|
|
3131
3285
|
}),
|
|
3132
|
-
|
|
3133
|
-
type:
|
|
3134
|
-
url:
|
|
3286
|
+
import_v418.z.object({
|
|
3287
|
+
type: import_v418.z.literal("open_page"),
|
|
3288
|
+
url: import_v418.z.string().nullish()
|
|
3135
3289
|
}),
|
|
3136
|
-
|
|
3137
|
-
type:
|
|
3138
|
-
url:
|
|
3139
|
-
pattern:
|
|
3290
|
+
import_v418.z.object({
|
|
3291
|
+
type: import_v418.z.literal("find_in_page"),
|
|
3292
|
+
url: import_v418.z.string().nullish(),
|
|
3293
|
+
pattern: import_v418.z.string().nullish()
|
|
3140
3294
|
})
|
|
3141
3295
|
]).nullish()
|
|
3142
3296
|
}),
|
|
3143
|
-
|
|
3144
|
-
type:
|
|
3145
|
-
id:
|
|
3146
|
-
queries:
|
|
3147
|
-
results:
|
|
3148
|
-
|
|
3149
|
-
attributes:
|
|
3150
|
-
|
|
3151
|
-
|
|
3297
|
+
import_v418.z.object({
|
|
3298
|
+
type: import_v418.z.literal("file_search_call"),
|
|
3299
|
+
id: import_v418.z.string(),
|
|
3300
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
3301
|
+
results: import_v418.z.array(
|
|
3302
|
+
import_v418.z.object({
|
|
3303
|
+
attributes: import_v418.z.record(
|
|
3304
|
+
import_v418.z.string(),
|
|
3305
|
+
import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
|
|
3152
3306
|
),
|
|
3153
|
-
file_id:
|
|
3154
|
-
filename:
|
|
3155
|
-
score:
|
|
3156
|
-
text:
|
|
3307
|
+
file_id: import_v418.z.string(),
|
|
3308
|
+
filename: import_v418.z.string(),
|
|
3309
|
+
score: import_v418.z.number(),
|
|
3310
|
+
text: import_v418.z.string()
|
|
3157
3311
|
})
|
|
3158
3312
|
).nullish()
|
|
3159
3313
|
}),
|
|
3160
|
-
|
|
3161
|
-
type:
|
|
3162
|
-
id:
|
|
3163
|
-
code:
|
|
3164
|
-
container_id:
|
|
3165
|
-
outputs:
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3314
|
+
import_v418.z.object({
|
|
3315
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
3316
|
+
id: import_v418.z.string(),
|
|
3317
|
+
code: import_v418.z.string().nullable(),
|
|
3318
|
+
container_id: import_v418.z.string(),
|
|
3319
|
+
outputs: import_v418.z.array(
|
|
3320
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3321
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
3322
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
3169
3323
|
])
|
|
3170
3324
|
).nullable()
|
|
3171
3325
|
}),
|
|
3172
|
-
|
|
3173
|
-
type:
|
|
3174
|
-
id:
|
|
3175
|
-
result:
|
|
3326
|
+
import_v418.z.object({
|
|
3327
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
3328
|
+
id: import_v418.z.string(),
|
|
3329
|
+
result: import_v418.z.string()
|
|
3176
3330
|
}),
|
|
3177
|
-
|
|
3178
|
-
type:
|
|
3179
|
-
id:
|
|
3180
|
-
call_id:
|
|
3181
|
-
action:
|
|
3182
|
-
type:
|
|
3183
|
-
command:
|
|
3184
|
-
timeout_ms:
|
|
3185
|
-
user:
|
|
3186
|
-
working_directory:
|
|
3187
|
-
env:
|
|
3331
|
+
import_v418.z.object({
|
|
3332
|
+
type: import_v418.z.literal("local_shell_call"),
|
|
3333
|
+
id: import_v418.z.string(),
|
|
3334
|
+
call_id: import_v418.z.string(),
|
|
3335
|
+
action: import_v418.z.object({
|
|
3336
|
+
type: import_v418.z.literal("exec"),
|
|
3337
|
+
command: import_v418.z.array(import_v418.z.string()),
|
|
3338
|
+
timeout_ms: import_v418.z.number().optional(),
|
|
3339
|
+
user: import_v418.z.string().optional(),
|
|
3340
|
+
working_directory: import_v418.z.string().optional(),
|
|
3341
|
+
env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
|
|
3188
3342
|
})
|
|
3189
3343
|
}),
|
|
3190
|
-
|
|
3191
|
-
type:
|
|
3192
|
-
call_id:
|
|
3193
|
-
name:
|
|
3194
|
-
arguments:
|
|
3195
|
-
id:
|
|
3196
|
-
async:
|
|
3344
|
+
import_v418.z.object({
|
|
3345
|
+
type: import_v418.z.literal("function_call"),
|
|
3346
|
+
call_id: import_v418.z.string(),
|
|
3347
|
+
name: import_v418.z.string(),
|
|
3348
|
+
arguments: import_v418.z.string(),
|
|
3349
|
+
id: import_v418.z.string(),
|
|
3350
|
+
async: import_v418.z.boolean().nullish()
|
|
3197
3351
|
}),
|
|
3198
|
-
|
|
3199
|
-
type:
|
|
3200
|
-
id:
|
|
3201
|
-
status:
|
|
3352
|
+
import_v418.z.object({
|
|
3353
|
+
type: import_v418.z.literal("computer_call"),
|
|
3354
|
+
id: import_v418.z.string(),
|
|
3355
|
+
status: import_v418.z.string().optional()
|
|
3202
3356
|
}),
|
|
3203
|
-
|
|
3204
|
-
type:
|
|
3205
|
-
id:
|
|
3206
|
-
encrypted_content:
|
|
3207
|
-
summary:
|
|
3208
|
-
|
|
3209
|
-
type:
|
|
3210
|
-
text:
|
|
3357
|
+
import_v418.z.object({
|
|
3358
|
+
type: import_v418.z.literal("reasoning"),
|
|
3359
|
+
id: import_v418.z.string(),
|
|
3360
|
+
encrypted_content: import_v418.z.string().nullish(),
|
|
3361
|
+
summary: import_v418.z.array(
|
|
3362
|
+
import_v418.z.object({
|
|
3363
|
+
type: import_v418.z.literal("summary_text"),
|
|
3364
|
+
text: import_v418.z.string()
|
|
3211
3365
|
})
|
|
3212
3366
|
)
|
|
3213
3367
|
})
|
|
3214
3368
|
])
|
|
3215
3369
|
).optional(),
|
|
3216
|
-
service_tier:
|
|
3217
|
-
reasoning:
|
|
3218
|
-
context:
|
|
3370
|
+
service_tier: import_v418.z.string().nullish(),
|
|
3371
|
+
reasoning: import_v418.z.object({
|
|
3372
|
+
context: import_v418.z.string().nullish()
|
|
3219
3373
|
}).nullish(),
|
|
3220
|
-
incomplete_details:
|
|
3221
|
-
usage:
|
|
3222
|
-
input_tokens:
|
|
3223
|
-
input_tokens_details:
|
|
3224
|
-
cached_tokens:
|
|
3225
|
-
cache_write_tokens:
|
|
3226
|
-
orchestration_input_tokens:
|
|
3227
|
-
orchestration_input_cached_tokens:
|
|
3374
|
+
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
3375
|
+
usage: import_v418.z.object({
|
|
3376
|
+
input_tokens: import_v418.z.number(),
|
|
3377
|
+
input_tokens_details: import_v418.z.object({
|
|
3378
|
+
cached_tokens: import_v418.z.number().nullish(),
|
|
3379
|
+
cache_write_tokens: import_v418.z.number().nullish(),
|
|
3380
|
+
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
3381
|
+
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
3228
3382
|
}).nullish(),
|
|
3229
|
-
output_tokens:
|
|
3230
|
-
output_tokens_details:
|
|
3231
|
-
reasoning_tokens:
|
|
3232
|
-
orchestration_output_tokens:
|
|
3383
|
+
output_tokens: import_v418.z.number(),
|
|
3384
|
+
output_tokens_details: import_v418.z.object({
|
|
3385
|
+
reasoning_tokens: import_v418.z.number().nullish(),
|
|
3386
|
+
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
3233
3387
|
}).nullish()
|
|
3234
3388
|
}).optional()
|
|
3235
3389
|
})
|
|
3236
3390
|
)
|
|
3237
3391
|
);
|
|
3238
3392
|
|
|
3239
|
-
// src/responses/openai-responses-options.ts
|
|
3240
|
-
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3241
|
-
var import_v418 = require("zod/v4");
|
|
3242
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
3243
|
-
var openaiResponsesReasoningModelIds = [
|
|
3244
|
-
"o1",
|
|
3245
|
-
"o1-2024-12-17",
|
|
3246
|
-
"o3",
|
|
3247
|
-
"o3-2025-04-16",
|
|
3248
|
-
"o3-deep-research",
|
|
3249
|
-
"o3-deep-research-2025-06-26",
|
|
3250
|
-
"o3-mini",
|
|
3251
|
-
"o3-mini-2025-01-31",
|
|
3252
|
-
"o4-mini",
|
|
3253
|
-
"o4-mini-2025-04-16",
|
|
3254
|
-
"o4-mini-deep-research",
|
|
3255
|
-
"o4-mini-deep-research-2025-06-26",
|
|
3256
|
-
"codex-mini-latest",
|
|
3257
|
-
"computer-use-preview",
|
|
3258
|
-
"gpt-5",
|
|
3259
|
-
"gpt-5-2025-08-07",
|
|
3260
|
-
"gpt-5-codex",
|
|
3261
|
-
"gpt-5-mini",
|
|
3262
|
-
"gpt-5-mini-2025-08-07",
|
|
3263
|
-
"gpt-5-nano",
|
|
3264
|
-
"gpt-5-nano-2025-08-07",
|
|
3265
|
-
"gpt-5-pro",
|
|
3266
|
-
"gpt-5-pro-2025-10-06",
|
|
3267
|
-
"gpt-5.1",
|
|
3268
|
-
"gpt-5.1-chat-latest",
|
|
3269
|
-
"gpt-5.1-codex-mini",
|
|
3270
|
-
"gpt-5.1-codex",
|
|
3271
|
-
"gpt-5.1-codex-max",
|
|
3272
|
-
"gpt-5.2",
|
|
3273
|
-
"gpt-5.2-chat-latest",
|
|
3274
|
-
"gpt-5.2-pro",
|
|
3275
|
-
"gpt-5.2-codex",
|
|
3276
|
-
"gpt-5.3-chat-latest",
|
|
3277
|
-
"gpt-5.3-codex",
|
|
3278
|
-
"gpt-5.4",
|
|
3279
|
-
"gpt-5.4-2026-03-05",
|
|
3280
|
-
"gpt-5.4-mini",
|
|
3281
|
-
"gpt-5.4-mini-2026-03-17",
|
|
3282
|
-
"gpt-5.4-nano",
|
|
3283
|
-
"gpt-5.4-nano-2026-03-17",
|
|
3284
|
-
"gpt-5.4-pro",
|
|
3285
|
-
"gpt-5.4-pro-2026-03-05",
|
|
3286
|
-
"gpt-5.6",
|
|
3287
|
-
"gpt-5.6-luna",
|
|
3288
|
-
"gpt-5.6-sol",
|
|
3289
|
-
"gpt-5.6-terra",
|
|
3290
|
-
"gpt-6-astra",
|
|
3291
|
-
"gpt-6-luna",
|
|
3292
|
-
"gpt-6-sol"
|
|
3293
|
-
];
|
|
3294
|
-
var openaiResponsesModelIds = [
|
|
3295
|
-
"gpt-4.1",
|
|
3296
|
-
"gpt-4.1-2025-04-14",
|
|
3297
|
-
"gpt-4.1-mini",
|
|
3298
|
-
"gpt-4.1-mini-2025-04-14",
|
|
3299
|
-
"gpt-4.1-nano",
|
|
3300
|
-
"gpt-4.1-nano-2025-04-14",
|
|
3301
|
-
"gpt-4o",
|
|
3302
|
-
"gpt-4o-2024-05-13",
|
|
3303
|
-
"gpt-4o-2024-08-06",
|
|
3304
|
-
"gpt-4o-2024-11-20",
|
|
3305
|
-
"gpt-4o-audio-preview",
|
|
3306
|
-
"gpt-4o-audio-preview-2024-10-01",
|
|
3307
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
3308
|
-
"gpt-4o-search-preview",
|
|
3309
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
3310
|
-
"gpt-4o-mini-search-preview",
|
|
3311
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3312
|
-
"gpt-4o-mini",
|
|
3313
|
-
"gpt-4o-mini-2024-07-18",
|
|
3314
|
-
"gpt-4-turbo",
|
|
3315
|
-
"gpt-4-turbo-2024-04-09",
|
|
3316
|
-
"gpt-4-turbo-preview",
|
|
3317
|
-
"gpt-4-0125-preview",
|
|
3318
|
-
"gpt-4-1106-preview",
|
|
3319
|
-
"gpt-4",
|
|
3320
|
-
"gpt-4-0613",
|
|
3321
|
-
"gpt-4.5-preview",
|
|
3322
|
-
"gpt-4.5-preview-2025-02-27",
|
|
3323
|
-
"gpt-3.5-turbo-0125",
|
|
3324
|
-
"gpt-3.5-turbo",
|
|
3325
|
-
"gpt-3.5-turbo-1106",
|
|
3326
|
-
"chatgpt-4o-latest",
|
|
3327
|
-
"gpt-5-chat-latest",
|
|
3328
|
-
...openaiResponsesReasoningModelIds
|
|
3329
|
-
];
|
|
3330
|
-
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3331
|
-
() => (0, import_provider_utils23.zodSchema)(
|
|
3332
|
-
import_v418.z.object({
|
|
3333
|
-
conversation: import_v418.z.string().nullish(),
|
|
3334
|
-
include: import_v418.z.array(
|
|
3335
|
-
import_v418.z.enum([
|
|
3336
|
-
"reasoning.encrypted_content",
|
|
3337
|
-
// handled internally by default, only needed for unknown reasoning models
|
|
3338
|
-
"file_search_call.results",
|
|
3339
|
-
"message.output_text.logprobs"
|
|
3340
|
-
])
|
|
3341
|
-
).nullish(),
|
|
3342
|
-
instructions: import_v418.z.string().nullish(),
|
|
3343
|
-
/**
|
|
3344
|
-
* Return the log probabilities of the tokens.
|
|
3345
|
-
*
|
|
3346
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
3347
|
-
* were generated.
|
|
3348
|
-
*
|
|
3349
|
-
* Setting to a number will return the log probabilities of the top n
|
|
3350
|
-
* tokens that were generated.
|
|
3351
|
-
*
|
|
3352
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3353
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3354
|
-
*/
|
|
3355
|
-
logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3356
|
-
/**
|
|
3357
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3358
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3359
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
3360
|
-
*/
|
|
3361
|
-
maxToolCalls: import_v418.z.number().nullish(),
|
|
3362
|
-
metadata: import_v418.z.any().nullish(),
|
|
3363
|
-
parallelToolCalls: import_v418.z.boolean().nullish(),
|
|
3364
|
-
previousResponseId: import_v418.z.string().nullish(),
|
|
3365
|
-
promptCacheKey: import_v418.z.string().nullish(),
|
|
3366
|
-
/**
|
|
3367
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3368
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3369
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3370
|
-
*/
|
|
3371
|
-
promptCacheOptions: import_v418.z.object({
|
|
3372
|
-
mode: import_v418.z.enum(["implicit", "explicit"]).optional(),
|
|
3373
|
-
ttl: import_v418.z.literal("30m").optional()
|
|
3374
|
-
}).optional(),
|
|
3375
|
-
/**
|
|
3376
|
-
* The retention policy for the prompt cache.
|
|
3377
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3378
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3379
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
3380
|
-
*
|
|
3381
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3382
|
-
*
|
|
3383
|
-
* @default 'in_memory'
|
|
3384
|
-
*/
|
|
3385
|
-
promptCacheRetention: import_v418.z.enum(["in_memory", "24h"]).nullish(),
|
|
3386
|
-
/**
|
|
3387
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3388
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3389
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3390
|
-
* Supported values vary by model.
|
|
3391
|
-
*/
|
|
3392
|
-
reasoningEffort: import_v418.z.string().nullish(),
|
|
3393
|
-
/**
|
|
3394
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3395
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
3396
|
-
* request prefix for prompt caching.
|
|
3397
|
-
*
|
|
3398
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3399
|
-
* combined with automatic truncation.
|
|
3400
|
-
*/
|
|
3401
|
-
reasoningEffortUpdate: import_v418.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3402
|
-
/**
|
|
3403
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3404
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3405
|
-
*/
|
|
3406
|
-
reasoningMode: import_v418.z.enum(["standard", "pro"]).optional(),
|
|
3407
|
-
/**
|
|
3408
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
3409
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3410
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3411
|
-
*/
|
|
3412
|
-
reasoningContext: import_v418.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3413
|
-
reasoningSummary: import_v418.z.string().nullish(),
|
|
3414
|
-
safetyIdentifier: import_v418.z.string().nullish(),
|
|
3415
|
-
serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3416
|
-
store: import_v418.z.boolean().nullish(),
|
|
3417
|
-
strictJsonSchema: import_v418.z.boolean().nullish(),
|
|
3418
|
-
textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
|
|
3419
|
-
truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
|
|
3420
|
-
user: import_v418.z.string().nullish()
|
|
3421
|
-
})
|
|
3422
|
-
)
|
|
3423
|
-
);
|
|
3424
|
-
|
|
3425
3393
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3426
3394
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3427
3395
|
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
@@ -3594,6 +3562,18 @@ function resolveAsyncToolOption({
|
|
|
3594
3562
|
}
|
|
3595
3563
|
|
|
3596
3564
|
// src/responses/openai-responses-language-model.ts
|
|
3565
|
+
function getConfigurationUpdateUnsupportedReason({
|
|
3566
|
+
modelCapabilities,
|
|
3567
|
+
options
|
|
3568
|
+
}) {
|
|
3569
|
+
if (!modelCapabilities.supportsConfigurationUpdate) {
|
|
3570
|
+
return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
3571
|
+
}
|
|
3572
|
+
if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
|
|
3573
|
+
return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
|
|
3574
|
+
}
|
|
3575
|
+
return void 0;
|
|
3576
|
+
}
|
|
3597
3577
|
var OpenAIResponsesLanguageModel = class {
|
|
3598
3578
|
constructor(modelId, config) {
|
|
3599
3579
|
this.specificationVersion = "v2";
|
|
@@ -3658,8 +3638,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3658
3638
|
details: "conversation and previousResponseId cannot be used together"
|
|
3659
3639
|
});
|
|
3660
3640
|
}
|
|
3641
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
3642
|
+
modelCapabilities,
|
|
3643
|
+
options: openaiOptions
|
|
3644
|
+
});
|
|
3661
3645
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3662
3646
|
prompt,
|
|
3647
|
+
configurationUpdateUnsupportedReason,
|
|
3648
|
+
providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
|
|
3663
3649
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
3664
3650
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
3665
3651
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
@@ -3679,18 +3665,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3679
3665
|
resolvedReasoningEffort = void 0;
|
|
3680
3666
|
}
|
|
3681
3667
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
3682
|
-
|
|
3683
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
3668
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
3684
3669
|
warnings.push({
|
|
3685
3670
|
type: "unsupported-setting",
|
|
3686
3671
|
setting: "reasoningEffortUpdate",
|
|
3687
|
-
details:
|
|
3672
|
+
details: configurationUpdateUnsupportedReason
|
|
3688
3673
|
});
|
|
3689
3674
|
} else if (reasoningEffortUpdate != null) {
|
|
3690
|
-
input
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3675
|
+
const firstItem = input[0];
|
|
3676
|
+
if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
|
|
3677
|
+
input.unshift({
|
|
3678
|
+
type: "configuration_update",
|
|
3679
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
3680
|
+
});
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
for (let i = 1; i < input.length; i++) {
|
|
3684
|
+
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
3685
|
+
throw new import_provider8.UnsupportedFunctionalityError({
|
|
3686
|
+
functionality: "Adjacent reasoning effort configuration updates"
|
|
3687
|
+
});
|
|
3688
|
+
}
|
|
3694
3689
|
}
|
|
3695
3690
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
3696
3691
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
@@ -5143,7 +5138,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5143
5138
|
};
|
|
5144
5139
|
|
|
5145
5140
|
// src/version.ts
|
|
5146
|
-
var VERSION = true ? "2.0.
|
|
5141
|
+
var VERSION = true ? "2.0.131" : "0.0.0-test";
|
|
5147
5142
|
|
|
5148
5143
|
// src/openai-provider.ts
|
|
5149
5144
|
function createOpenAI(options = {}) {
|