@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/internal/index.js
CHANGED
|
@@ -1066,7 +1066,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1066
1066
|
abortSignal: options.abortSignal,
|
|
1067
1067
|
fetch: this.config.fetch
|
|
1068
1068
|
});
|
|
1069
|
-
|
|
1069
|
+
let toolCallTracker;
|
|
1070
1070
|
let finishReason = "unknown";
|
|
1071
1071
|
const usage = {
|
|
1072
1072
|
inputTokens: void 0,
|
|
@@ -1080,10 +1080,14 @@ var OpenAIChatLanguageModel = class {
|
|
|
1080
1080
|
stream: response.pipeThrough(
|
|
1081
1081
|
new TransformStream({
|
|
1082
1082
|
start(controller) {
|
|
1083
|
+
toolCallTracker = new import_provider_utils5.StreamingToolCallTracker(controller, {
|
|
1084
|
+
generateId: import_provider_utils5.generateId,
|
|
1085
|
+
typeValidation: "if-present"
|
|
1086
|
+
});
|
|
1083
1087
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1084
1088
|
},
|
|
1085
1089
|
transform(chunk, controller) {
|
|
1086
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m
|
|
1090
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1087
1091
|
if (options.includeRawChunks) {
|
|
1088
1092
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
1089
1093
|
}
|
|
@@ -1150,90 +1154,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1150
1154
|
}
|
|
1151
1155
|
if (delta.tool_calls != null) {
|
|
1152
1156
|
for (const toolCallDelta of delta.tool_calls) {
|
|
1153
|
-
|
|
1154
|
-
if (toolCalls[index] == null) {
|
|
1155
|
-
if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
|
|
1156
|
-
throw new import_provider3.InvalidResponseDataError({
|
|
1157
|
-
data: toolCallDelta,
|
|
1158
|
-
message: `Expected 'function' type.`
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
if (toolCallDelta.id == null) {
|
|
1162
|
-
throw new import_provider3.InvalidResponseDataError({
|
|
1163
|
-
data: toolCallDelta,
|
|
1164
|
-
message: `Expected 'id' to be a string.`
|
|
1165
|
-
});
|
|
1166
|
-
}
|
|
1167
|
-
if (((_n = toolCallDelta.function) == null ? void 0 : _n.name) == null) {
|
|
1168
|
-
throw new import_provider3.InvalidResponseDataError({
|
|
1169
|
-
data: toolCallDelta,
|
|
1170
|
-
message: `Expected 'function.name' to be a string.`
|
|
1171
|
-
});
|
|
1172
|
-
}
|
|
1173
|
-
controller.enqueue({
|
|
1174
|
-
type: "tool-input-start",
|
|
1175
|
-
id: toolCallDelta.id,
|
|
1176
|
-
toolName: toolCallDelta.function.name
|
|
1177
|
-
});
|
|
1178
|
-
toolCalls[index] = {
|
|
1179
|
-
id: toolCallDelta.id,
|
|
1180
|
-
type: "function",
|
|
1181
|
-
function: {
|
|
1182
|
-
name: toolCallDelta.function.name,
|
|
1183
|
-
arguments: (_o = toolCallDelta.function.arguments) != null ? _o : ""
|
|
1184
|
-
},
|
|
1185
|
-
hasFinished: false
|
|
1186
|
-
};
|
|
1187
|
-
const toolCall2 = toolCalls[index];
|
|
1188
|
-
if (((_p = toolCall2.function) == null ? void 0 : _p.name) != null && ((_q = toolCall2.function) == null ? void 0 : _q.arguments) != null) {
|
|
1189
|
-
if (toolCall2.function.arguments.length > 0) {
|
|
1190
|
-
controller.enqueue({
|
|
1191
|
-
type: "tool-input-delta",
|
|
1192
|
-
id: toolCall2.id,
|
|
1193
|
-
delta: toolCall2.function.arguments
|
|
1194
|
-
});
|
|
1195
|
-
}
|
|
1196
|
-
if ((0, import_provider_utils5.isParsableJson)(toolCall2.function.arguments)) {
|
|
1197
|
-
controller.enqueue({
|
|
1198
|
-
type: "tool-input-end",
|
|
1199
|
-
id: toolCall2.id
|
|
1200
|
-
});
|
|
1201
|
-
controller.enqueue({
|
|
1202
|
-
type: "tool-call",
|
|
1203
|
-
toolCallId: (_r = toolCall2.id) != null ? _r : (0, import_provider_utils5.generateId)(),
|
|
1204
|
-
toolName: toolCall2.function.name,
|
|
1205
|
-
input: toolCall2.function.arguments
|
|
1206
|
-
});
|
|
1207
|
-
toolCall2.hasFinished = true;
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
continue;
|
|
1211
|
-
}
|
|
1212
|
-
const toolCall = toolCalls[index];
|
|
1213
|
-
if (toolCall.hasFinished) {
|
|
1214
|
-
continue;
|
|
1215
|
-
}
|
|
1216
|
-
if (((_s = toolCallDelta.function) == null ? void 0 : _s.arguments) != null) {
|
|
1217
|
-
toolCall.function.arguments += (_u = (_t = toolCallDelta.function) == null ? void 0 : _t.arguments) != null ? _u : "";
|
|
1218
|
-
}
|
|
1219
|
-
controller.enqueue({
|
|
1220
|
-
type: "tool-input-delta",
|
|
1221
|
-
id: toolCall.id,
|
|
1222
|
-
delta: (_v = toolCallDelta.function.arguments) != null ? _v : ""
|
|
1223
|
-
});
|
|
1224
|
-
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)) {
|
|
1225
|
-
controller.enqueue({
|
|
1226
|
-
type: "tool-input-end",
|
|
1227
|
-
id: toolCall.id
|
|
1228
|
-
});
|
|
1229
|
-
controller.enqueue({
|
|
1230
|
-
type: "tool-call",
|
|
1231
|
-
toolCallId: (_y = toolCall.id) != null ? _y : (0, import_provider_utils5.generateId)(),
|
|
1232
|
-
toolName: toolCall.function.name,
|
|
1233
|
-
input: toolCall.function.arguments
|
|
1234
|
-
});
|
|
1235
|
-
toolCall.hasFinished = true;
|
|
1236
|
-
}
|
|
1157
|
+
toolCallTracker.processDelta(toolCallDelta);
|
|
1237
1158
|
}
|
|
1238
1159
|
}
|
|
1239
1160
|
if (delta.annotations != null) {
|
|
@@ -1252,6 +1173,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
1252
1173
|
if (isActiveText) {
|
|
1253
1174
|
controller.enqueue({ type: "text-end", id: "0" });
|
|
1254
1175
|
}
|
|
1176
|
+
toolCallTracker.flush();
|
|
1255
1177
|
controller.enqueue({
|
|
1256
1178
|
type: "finish",
|
|
1257
1179
|
finishReason,
|
|
@@ -2401,30 +2323,231 @@ var import_provider_utils30 = require("@ai-sdk/provider-utils");
|
|
|
2401
2323
|
|
|
2402
2324
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2403
2325
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2404
|
-
var
|
|
2405
|
-
var
|
|
2326
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2327
|
+
var import_v415 = require("zod/v4");
|
|
2406
2328
|
|
|
2407
|
-
// src/
|
|
2329
|
+
// src/responses/openai-responses-options.ts
|
|
2408
2330
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
2409
2331
|
var import_v413 = require("zod/v4");
|
|
2410
|
-
var
|
|
2332
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
2333
|
+
var openaiResponsesReasoningModelIds = [
|
|
2334
|
+
"o1",
|
|
2335
|
+
"o1-2024-12-17",
|
|
2336
|
+
"o3",
|
|
2337
|
+
"o3-2025-04-16",
|
|
2338
|
+
"o3-deep-research",
|
|
2339
|
+
"o3-deep-research-2025-06-26",
|
|
2340
|
+
"o3-mini",
|
|
2341
|
+
"o3-mini-2025-01-31",
|
|
2342
|
+
"o4-mini",
|
|
2343
|
+
"o4-mini-2025-04-16",
|
|
2344
|
+
"o4-mini-deep-research",
|
|
2345
|
+
"o4-mini-deep-research-2025-06-26",
|
|
2346
|
+
"codex-mini-latest",
|
|
2347
|
+
"computer-use-preview",
|
|
2348
|
+
"gpt-5",
|
|
2349
|
+
"gpt-5-2025-08-07",
|
|
2350
|
+
"gpt-5-codex",
|
|
2351
|
+
"gpt-5-mini",
|
|
2352
|
+
"gpt-5-mini-2025-08-07",
|
|
2353
|
+
"gpt-5-nano",
|
|
2354
|
+
"gpt-5-nano-2025-08-07",
|
|
2355
|
+
"gpt-5-pro",
|
|
2356
|
+
"gpt-5-pro-2025-10-06",
|
|
2357
|
+
"gpt-5.1",
|
|
2358
|
+
"gpt-5.1-chat-latest",
|
|
2359
|
+
"gpt-5.1-codex-mini",
|
|
2360
|
+
"gpt-5.1-codex",
|
|
2361
|
+
"gpt-5.1-codex-max",
|
|
2362
|
+
"gpt-5.2",
|
|
2363
|
+
"gpt-5.2-chat-latest",
|
|
2364
|
+
"gpt-5.2-pro",
|
|
2365
|
+
"gpt-5.2-codex",
|
|
2366
|
+
"gpt-5.3-chat-latest",
|
|
2367
|
+
"gpt-5.3-codex",
|
|
2368
|
+
"gpt-5.4",
|
|
2369
|
+
"gpt-5.4-2026-03-05",
|
|
2370
|
+
"gpt-5.4-mini",
|
|
2371
|
+
"gpt-5.4-mini-2026-03-17",
|
|
2372
|
+
"gpt-5.4-nano",
|
|
2373
|
+
"gpt-5.4-nano-2026-03-17",
|
|
2374
|
+
"gpt-5.4-pro",
|
|
2375
|
+
"gpt-5.4-pro-2026-03-05",
|
|
2376
|
+
"gpt-5.6",
|
|
2377
|
+
"gpt-5.6-luna",
|
|
2378
|
+
"gpt-5.6-sol",
|
|
2379
|
+
"gpt-5.6-terra",
|
|
2380
|
+
"gpt-6-astra",
|
|
2381
|
+
"gpt-6-luna",
|
|
2382
|
+
"gpt-6-sol"
|
|
2383
|
+
];
|
|
2384
|
+
var openaiResponsesModelIds = [
|
|
2385
|
+
"gpt-4.1",
|
|
2386
|
+
"gpt-4.1-2025-04-14",
|
|
2387
|
+
"gpt-4.1-mini",
|
|
2388
|
+
"gpt-4.1-mini-2025-04-14",
|
|
2389
|
+
"gpt-4.1-nano",
|
|
2390
|
+
"gpt-4.1-nano-2025-04-14",
|
|
2391
|
+
"gpt-4o",
|
|
2392
|
+
"gpt-4o-2024-05-13",
|
|
2393
|
+
"gpt-4o-2024-08-06",
|
|
2394
|
+
"gpt-4o-2024-11-20",
|
|
2395
|
+
"gpt-4o-audio-preview",
|
|
2396
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
2397
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
2398
|
+
"gpt-4o-search-preview",
|
|
2399
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
2400
|
+
"gpt-4o-mini-search-preview",
|
|
2401
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
2402
|
+
"gpt-4o-mini",
|
|
2403
|
+
"gpt-4o-mini-2024-07-18",
|
|
2404
|
+
"gpt-4-turbo",
|
|
2405
|
+
"gpt-4-turbo-2024-04-09",
|
|
2406
|
+
"gpt-4-turbo-preview",
|
|
2407
|
+
"gpt-4-0125-preview",
|
|
2408
|
+
"gpt-4-1106-preview",
|
|
2409
|
+
"gpt-4",
|
|
2410
|
+
"gpt-4-0613",
|
|
2411
|
+
"gpt-4.5-preview",
|
|
2412
|
+
"gpt-4.5-preview-2025-02-27",
|
|
2413
|
+
"gpt-3.5-turbo-0125",
|
|
2414
|
+
"gpt-3.5-turbo",
|
|
2415
|
+
"gpt-3.5-turbo-1106",
|
|
2416
|
+
"chatgpt-4o-latest",
|
|
2417
|
+
"gpt-5-chat-latest",
|
|
2418
|
+
...openaiResponsesReasoningModelIds
|
|
2419
|
+
];
|
|
2420
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils20.lazyValidator)(
|
|
2411
2421
|
() => (0, import_provider_utils20.zodSchema)(
|
|
2412
2422
|
import_v413.z.object({
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2423
|
+
conversation: import_v413.z.string().nullish(),
|
|
2424
|
+
include: import_v413.z.array(
|
|
2425
|
+
import_v413.z.enum([
|
|
2426
|
+
"reasoning.encrypted_content",
|
|
2427
|
+
// handled internally by default, only needed for unknown reasoning models
|
|
2428
|
+
"file_search_call.results",
|
|
2429
|
+
"message.output_text.logprobs"
|
|
2430
|
+
])
|
|
2431
|
+
).nullish(),
|
|
2432
|
+
instructions: import_v413.z.string().nullish(),
|
|
2433
|
+
/**
|
|
2434
|
+
* Return the log probabilities of the tokens.
|
|
2435
|
+
*
|
|
2436
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
2437
|
+
* were generated.
|
|
2438
|
+
*
|
|
2439
|
+
* Setting to a number will return the log probabilities of the top n
|
|
2440
|
+
* tokens that were generated.
|
|
2441
|
+
*
|
|
2442
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2443
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2444
|
+
*/
|
|
2445
|
+
logprobs: import_v413.z.union([import_v413.z.boolean(), import_v413.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2446
|
+
/**
|
|
2447
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2448
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2449
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
2450
|
+
*/
|
|
2451
|
+
maxToolCalls: import_v413.z.number().nullish(),
|
|
2452
|
+
metadata: import_v413.z.any().nullish(),
|
|
2453
|
+
parallelToolCalls: import_v413.z.boolean().nullish(),
|
|
2454
|
+
previousResponseId: import_v413.z.string().nullish(),
|
|
2455
|
+
promptCacheKey: import_v413.z.string().nullish(),
|
|
2456
|
+
/**
|
|
2457
|
+
* Prompt cache behavior for GPT-5.6 and later models.
|
|
2458
|
+
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
2459
|
+
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
2460
|
+
*/
|
|
2461
|
+
promptCacheOptions: import_v413.z.object({
|
|
2462
|
+
mode: import_v413.z.enum(["implicit", "explicit"]).optional(),
|
|
2463
|
+
ttl: import_v413.z.literal("30m").optional()
|
|
2464
|
+
}).optional(),
|
|
2465
|
+
/**
|
|
2466
|
+
* The retention policy for the prompt cache.
|
|
2467
|
+
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
2468
|
+
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
2469
|
+
* Available for models before GPT-5.6 that support extended caching.
|
|
2470
|
+
*
|
|
2471
|
+
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
2472
|
+
*
|
|
2473
|
+
* @default 'in_memory'
|
|
2474
|
+
*/
|
|
2475
|
+
promptCacheRetention: import_v413.z.enum(["in_memory", "24h"]).nullish(),
|
|
2476
|
+
/**
|
|
2477
|
+
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
2478
|
+
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
2479
|
+
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
2480
|
+
* Supported values vary by model.
|
|
2481
|
+
*/
|
|
2482
|
+
reasoningEffort: import_v413.z.string().nullish(),
|
|
2483
|
+
/**
|
|
2484
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
2485
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
2486
|
+
* request prefix for prompt caching.
|
|
2487
|
+
*
|
|
2488
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
2489
|
+
* combined with automatic truncation.
|
|
2490
|
+
*/
|
|
2491
|
+
reasoningEffortUpdate: import_v413.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
2492
|
+
/**
|
|
2493
|
+
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
2494
|
+
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
2495
|
+
*/
|
|
2496
|
+
reasoningMode: import_v413.z.enum(["standard", "pro"]).optional(),
|
|
2497
|
+
/**
|
|
2498
|
+
* Controls which available reasoning items GPT-5.6 can use.
|
|
2499
|
+
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
2500
|
+
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
2501
|
+
*/
|
|
2502
|
+
reasoningContext: import_v413.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
2503
|
+
reasoningSummary: import_v413.z.string().nullish(),
|
|
2504
|
+
safetyIdentifier: import_v413.z.string().nullish(),
|
|
2505
|
+
serviceTier: import_v413.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
2506
|
+
store: import_v413.z.boolean().nullish(),
|
|
2507
|
+
strictJsonSchema: import_v413.z.boolean().nullish(),
|
|
2508
|
+
textVerbosity: import_v413.z.enum(["low", "medium", "high"]).nullish(),
|
|
2509
|
+
truncation: import_v413.z.enum(["auto", "disabled"]).nullish(),
|
|
2510
|
+
user: import_v413.z.string().nullish()
|
|
2511
|
+
})
|
|
2512
|
+
)
|
|
2513
|
+
);
|
|
2514
|
+
var openaiResponsesSystemMessageOptionsSchema = (0, import_provider_utils20.lazyValidator)(
|
|
2515
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
2516
|
+
import_v413.z.object({
|
|
2517
|
+
/**
|
|
2518
|
+
* Emit a configuration update at this position in Responses history.
|
|
2519
|
+
* Requires empty system message content and the same supported
|
|
2520
|
+
* configuration as the request-level reasoningEffortUpdate option.
|
|
2521
|
+
* Unsupported historical updates throw instead of being omitted.
|
|
2522
|
+
*
|
|
2523
|
+
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
2524
|
+
*/
|
|
2525
|
+
reasoningEffortUpdate: import_v413.z.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
2526
|
+
})
|
|
2527
|
+
)
|
|
2528
|
+
);
|
|
2529
|
+
|
|
2530
|
+
// src/tool/local-shell.ts
|
|
2531
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2532
|
+
var import_v414 = require("zod/v4");
|
|
2533
|
+
var localShellInputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2534
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2535
|
+
import_v414.z.object({
|
|
2536
|
+
action: import_v414.z.object({
|
|
2537
|
+
type: import_v414.z.literal("exec"),
|
|
2538
|
+
command: import_v414.z.array(import_v414.z.string()),
|
|
2539
|
+
timeoutMs: import_v414.z.number().optional(),
|
|
2540
|
+
user: import_v414.z.string().optional(),
|
|
2541
|
+
workingDirectory: import_v414.z.string().optional(),
|
|
2542
|
+
env: import_v414.z.record(import_v414.z.string(), import_v414.z.string()).optional()
|
|
2420
2543
|
})
|
|
2421
2544
|
})
|
|
2422
2545
|
)
|
|
2423
2546
|
);
|
|
2424
|
-
var localShellOutputSchema = (0,
|
|
2425
|
-
() => (0,
|
|
2547
|
+
var localShellOutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
2548
|
+
() => (0, import_provider_utils21.zodSchema)(import_v414.z.object({ output: import_v414.z.string() }))
|
|
2426
2549
|
);
|
|
2427
|
-
var localShell = (0,
|
|
2550
|
+
var localShell = (0, import_provider_utils21.createProviderDefinedToolFactoryWithOutputSchema)({
|
|
2428
2551
|
id: "openai.local_shell",
|
|
2429
2552
|
name: "local_shell",
|
|
2430
2553
|
inputSchema: localShellInputSchema,
|
|
@@ -2443,9 +2566,11 @@ function isFileId(data, prefixes) {
|
|
|
2443
2566
|
async function convertToOpenAIResponsesInput({
|
|
2444
2567
|
prompt,
|
|
2445
2568
|
systemMessageMode,
|
|
2569
|
+
providerOptionsName = "openai",
|
|
2446
2570
|
explicitMessageItemType = false,
|
|
2447
2571
|
fileIdPrefixes,
|
|
2448
2572
|
store,
|
|
2573
|
+
configurationUpdateUnsupportedReason,
|
|
2449
2574
|
hasLocalShellTool = false
|
|
2450
2575
|
}) {
|
|
2451
2576
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -2454,6 +2579,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
2454
2579
|
for (const { role, content, providerOptions } of prompt) {
|
|
2455
2580
|
switch (role) {
|
|
2456
2581
|
case "system": {
|
|
2582
|
+
let options = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2583
|
+
provider: providerOptionsName,
|
|
2584
|
+
providerOptions,
|
|
2585
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2586
|
+
});
|
|
2587
|
+
if (options == null && providerOptionsName !== "openai") {
|
|
2588
|
+
options = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2589
|
+
provider: "openai",
|
|
2590
|
+
providerOptions,
|
|
2591
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
const effort = options == null ? void 0 : options.reasoningEffortUpdate;
|
|
2595
|
+
if (effort != null) {
|
|
2596
|
+
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
2597
|
+
if (unsupportedReason != null) {
|
|
2598
|
+
throw new import_provider6.UnsupportedFunctionalityError({
|
|
2599
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
2600
|
+
message: unsupportedReason
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
input.push({
|
|
2604
|
+
type: "configuration_update",
|
|
2605
|
+
reasoning: { effort }
|
|
2606
|
+
});
|
|
2607
|
+
break;
|
|
2608
|
+
}
|
|
2457
2609
|
switch (systemMessageMode) {
|
|
2458
2610
|
case "system": {
|
|
2459
2611
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
|
|
@@ -2529,7 +2681,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2529
2681
|
return {
|
|
2530
2682
|
type: "input_image",
|
|
2531
2683
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2532
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2684
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2533
2685
|
},
|
|
2534
2686
|
detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3.openai) == null ? void 0 : _b2.imageDetail,
|
|
2535
2687
|
...promptCacheBreakpoint != null && {
|
|
@@ -2550,7 +2702,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2550
2702
|
type: "input_file",
|
|
2551
2703
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2552
2704
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2553
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2705
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2554
2706
|
},
|
|
2555
2707
|
...promptCacheBreakpoint != null && {
|
|
2556
2708
|
prompt_cache_breakpoint: promptCacheBreakpoint
|
|
@@ -2600,7 +2752,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2600
2752
|
break;
|
|
2601
2753
|
}
|
|
2602
2754
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2603
|
-
const parsedInput = await (0,
|
|
2755
|
+
const parsedInput = await (0, import_provider_utils22.validateTypes)({
|
|
2604
2756
|
value: part.input,
|
|
2605
2757
|
schema: localShellInputSchema
|
|
2606
2758
|
});
|
|
@@ -2642,7 +2794,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2642
2794
|
break;
|
|
2643
2795
|
}
|
|
2644
2796
|
case "reasoning": {
|
|
2645
|
-
const providerOptions2 = await (0,
|
|
2797
|
+
const providerOptions2 = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2646
2798
|
provider: "openai",
|
|
2647
2799
|
providerOptions: part.providerOptions,
|
|
2648
2800
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2706,7 +2858,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2706
2858
|
part.providerOptions
|
|
2707
2859
|
);
|
|
2708
2860
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2709
|
-
const parsedOutput = await (0,
|
|
2861
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2710
2862
|
value: output.value,
|
|
2711
2863
|
schema: localShellOutputSchema
|
|
2712
2864
|
});
|
|
@@ -2799,9 +2951,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2799
2951
|
}
|
|
2800
2952
|
return { input, warnings };
|
|
2801
2953
|
}
|
|
2802
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2803
|
-
itemId:
|
|
2804
|
-
reasoningEncryptedContent:
|
|
2954
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v415.z.object({
|
|
2955
|
+
itemId: import_v415.z.string().nullish(),
|
|
2956
|
+
reasoningEncryptedContent: import_v415.z.string().nullish()
|
|
2805
2957
|
});
|
|
2806
2958
|
|
|
2807
2959
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2823,288 +2975,288 @@ function mapOpenAIResponseFinishReason({
|
|
|
2823
2975
|
}
|
|
2824
2976
|
|
|
2825
2977
|
// src/responses/openai-responses-api.ts
|
|
2826
|
-
var
|
|
2827
|
-
var
|
|
2828
|
-
var openaiResponsesChunkSchema = (0,
|
|
2829
|
-
() => (0,
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
type:
|
|
2833
|
-
item_id:
|
|
2834
|
-
delta:
|
|
2835
|
-
logprobs:
|
|
2836
|
-
|
|
2837
|
-
token:
|
|
2838
|
-
logprob:
|
|
2839
|
-
top_logprobs:
|
|
2840
|
-
|
|
2841
|
-
token:
|
|
2842
|
-
logprob:
|
|
2978
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2979
|
+
var import_v416 = require("zod/v4");
|
|
2980
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils23.lazyValidator)(
|
|
2981
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2982
|
+
import_v416.z.union([
|
|
2983
|
+
import_v416.z.object({
|
|
2984
|
+
type: import_v416.z.literal("response.output_text.delta"),
|
|
2985
|
+
item_id: import_v416.z.string(),
|
|
2986
|
+
delta: import_v416.z.string(),
|
|
2987
|
+
logprobs: import_v416.z.array(
|
|
2988
|
+
import_v416.z.object({
|
|
2989
|
+
token: import_v416.z.string(),
|
|
2990
|
+
logprob: import_v416.z.number(),
|
|
2991
|
+
top_logprobs: import_v416.z.array(
|
|
2992
|
+
import_v416.z.object({
|
|
2993
|
+
token: import_v416.z.string(),
|
|
2994
|
+
logprob: import_v416.z.number()
|
|
2843
2995
|
})
|
|
2844
2996
|
)
|
|
2845
2997
|
})
|
|
2846
2998
|
).nullish()
|
|
2847
2999
|
}),
|
|
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:
|
|
3000
|
+
import_v416.z.object({
|
|
3001
|
+
type: import_v416.z.enum(["response.completed", "response.incomplete"]),
|
|
3002
|
+
response: import_v416.z.object({
|
|
3003
|
+
incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
|
|
3004
|
+
usage: import_v416.z.object({
|
|
3005
|
+
input_tokens: import_v416.z.number(),
|
|
3006
|
+
input_tokens_details: import_v416.z.object({
|
|
3007
|
+
cached_tokens: import_v416.z.number().nullish(),
|
|
3008
|
+
cache_write_tokens: import_v416.z.number().nullish(),
|
|
3009
|
+
orchestration_input_tokens: import_v416.z.number().nullish(),
|
|
3010
|
+
orchestration_input_cached_tokens: import_v416.z.number().nullish()
|
|
2859
3011
|
}).nullish(),
|
|
2860
|
-
output_tokens:
|
|
2861
|
-
output_tokens_details:
|
|
2862
|
-
reasoning_tokens:
|
|
2863
|
-
orchestration_output_tokens:
|
|
3012
|
+
output_tokens: import_v416.z.number(),
|
|
3013
|
+
output_tokens_details: import_v416.z.object({
|
|
3014
|
+
reasoning_tokens: import_v416.z.number().nullish(),
|
|
3015
|
+
orchestration_output_tokens: import_v416.z.number().nullish()
|
|
2864
3016
|
}).nullish()
|
|
2865
3017
|
}),
|
|
2866
|
-
reasoning:
|
|
2867
|
-
context:
|
|
3018
|
+
reasoning: import_v416.z.object({
|
|
3019
|
+
context: import_v416.z.string().nullish()
|
|
2868
3020
|
}).nullish(),
|
|
2869
|
-
service_tier:
|
|
3021
|
+
service_tier: import_v416.z.string().nullish()
|
|
2870
3022
|
})
|
|
2871
3023
|
}),
|
|
2872
|
-
|
|
2873
|
-
type:
|
|
2874
|
-
response:
|
|
2875
|
-
id:
|
|
2876
|
-
created_at:
|
|
2877
|
-
model:
|
|
2878
|
-
service_tier:
|
|
3024
|
+
import_v416.z.object({
|
|
3025
|
+
type: import_v416.z.literal("response.created"),
|
|
3026
|
+
response: import_v416.z.object({
|
|
3027
|
+
id: import_v416.z.string(),
|
|
3028
|
+
created_at: import_v416.z.number(),
|
|
3029
|
+
model: import_v416.z.string(),
|
|
3030
|
+
service_tier: import_v416.z.string().nullish()
|
|
2879
3031
|
})
|
|
2880
3032
|
}),
|
|
2881
|
-
|
|
2882
|
-
type:
|
|
2883
|
-
output_index:
|
|
2884
|
-
item:
|
|
2885
|
-
|
|
2886
|
-
type:
|
|
2887
|
-
id:
|
|
2888
|
-
phase:
|
|
3033
|
+
import_v416.z.object({
|
|
3034
|
+
type: import_v416.z.literal("response.output_item.added"),
|
|
3035
|
+
output_index: import_v416.z.number(),
|
|
3036
|
+
item: import_v416.z.discriminatedUnion("type", [
|
|
3037
|
+
import_v416.z.object({
|
|
3038
|
+
type: import_v416.z.literal("message"),
|
|
3039
|
+
id: import_v416.z.string(),
|
|
3040
|
+
phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
|
|
2889
3041
|
}),
|
|
2890
|
-
|
|
2891
|
-
type:
|
|
2892
|
-
id:
|
|
2893
|
-
encrypted_content:
|
|
3042
|
+
import_v416.z.object({
|
|
3043
|
+
type: import_v416.z.literal("reasoning"),
|
|
3044
|
+
id: import_v416.z.string(),
|
|
3045
|
+
encrypted_content: import_v416.z.string().nullish()
|
|
2894
3046
|
}),
|
|
2895
|
-
|
|
2896
|
-
type:
|
|
2897
|
-
id:
|
|
2898
|
-
call_id:
|
|
2899
|
-
name:
|
|
2900
|
-
arguments:
|
|
2901
|
-
async:
|
|
3047
|
+
import_v416.z.object({
|
|
3048
|
+
type: import_v416.z.literal("function_call"),
|
|
3049
|
+
id: import_v416.z.string(),
|
|
3050
|
+
call_id: import_v416.z.string(),
|
|
3051
|
+
name: import_v416.z.string(),
|
|
3052
|
+
arguments: import_v416.z.string(),
|
|
3053
|
+
async: import_v416.z.boolean().nullish()
|
|
2902
3054
|
}),
|
|
2903
|
-
|
|
2904
|
-
type:
|
|
2905
|
-
id:
|
|
2906
|
-
status:
|
|
3055
|
+
import_v416.z.object({
|
|
3056
|
+
type: import_v416.z.literal("web_search_call"),
|
|
3057
|
+
id: import_v416.z.string(),
|
|
3058
|
+
status: import_v416.z.string()
|
|
2907
3059
|
}),
|
|
2908
|
-
|
|
2909
|
-
type:
|
|
2910
|
-
id:
|
|
2911
|
-
status:
|
|
3060
|
+
import_v416.z.object({
|
|
3061
|
+
type: import_v416.z.literal("computer_call"),
|
|
3062
|
+
id: import_v416.z.string(),
|
|
3063
|
+
status: import_v416.z.string()
|
|
2912
3064
|
}),
|
|
2913
|
-
|
|
2914
|
-
type:
|
|
2915
|
-
id:
|
|
3065
|
+
import_v416.z.object({
|
|
3066
|
+
type: import_v416.z.literal("file_search_call"),
|
|
3067
|
+
id: import_v416.z.string()
|
|
2916
3068
|
}),
|
|
2917
|
-
|
|
2918
|
-
type:
|
|
2919
|
-
id:
|
|
3069
|
+
import_v416.z.object({
|
|
3070
|
+
type: import_v416.z.literal("image_generation_call"),
|
|
3071
|
+
id: import_v416.z.string()
|
|
2920
3072
|
}),
|
|
2921
|
-
|
|
2922
|
-
type:
|
|
2923
|
-
id:
|
|
2924
|
-
container_id:
|
|
2925
|
-
code:
|
|
2926
|
-
outputs:
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
3073
|
+
import_v416.z.object({
|
|
3074
|
+
type: import_v416.z.literal("code_interpreter_call"),
|
|
3075
|
+
id: import_v416.z.string(),
|
|
3076
|
+
container_id: import_v416.z.string(),
|
|
3077
|
+
code: import_v416.z.string().nullable(),
|
|
3078
|
+
outputs: import_v416.z.array(
|
|
3079
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3080
|
+
import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
|
|
3081
|
+
import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
|
|
2930
3082
|
])
|
|
2931
3083
|
).nullable(),
|
|
2932
|
-
status:
|
|
3084
|
+
status: import_v416.z.string()
|
|
2933
3085
|
})
|
|
2934
3086
|
])
|
|
2935
3087
|
}),
|
|
2936
|
-
|
|
2937
|
-
type:
|
|
2938
|
-
output_index:
|
|
2939
|
-
item:
|
|
2940
|
-
|
|
2941
|
-
type:
|
|
2942
|
-
id:
|
|
2943
|
-
phase:
|
|
3088
|
+
import_v416.z.object({
|
|
3089
|
+
type: import_v416.z.literal("response.output_item.done"),
|
|
3090
|
+
output_index: import_v416.z.number(),
|
|
3091
|
+
item: import_v416.z.discriminatedUnion("type", [
|
|
3092
|
+
import_v416.z.object({
|
|
3093
|
+
type: import_v416.z.literal("message"),
|
|
3094
|
+
id: import_v416.z.string(),
|
|
3095
|
+
phase: import_v416.z.enum(["commentary", "final_answer"]).nullish()
|
|
2944
3096
|
}),
|
|
2945
|
-
|
|
2946
|
-
type:
|
|
2947
|
-
id:
|
|
2948
|
-
encrypted_content:
|
|
3097
|
+
import_v416.z.object({
|
|
3098
|
+
type: import_v416.z.literal("reasoning"),
|
|
3099
|
+
id: import_v416.z.string(),
|
|
3100
|
+
encrypted_content: import_v416.z.string().nullish()
|
|
2949
3101
|
}),
|
|
2950
|
-
|
|
2951
|
-
type:
|
|
2952
|
-
id:
|
|
2953
|
-
call_id:
|
|
2954
|
-
name:
|
|
2955
|
-
arguments:
|
|
2956
|
-
async:
|
|
2957
|
-
status:
|
|
3102
|
+
import_v416.z.object({
|
|
3103
|
+
type: import_v416.z.literal("function_call"),
|
|
3104
|
+
id: import_v416.z.string(),
|
|
3105
|
+
call_id: import_v416.z.string(),
|
|
3106
|
+
name: import_v416.z.string(),
|
|
3107
|
+
arguments: import_v416.z.string(),
|
|
3108
|
+
async: import_v416.z.boolean().nullish(),
|
|
3109
|
+
status: import_v416.z.enum(["in_progress", "completed", "incomplete"])
|
|
2958
3110
|
}),
|
|
2959
|
-
|
|
2960
|
-
type:
|
|
2961
|
-
id:
|
|
2962
|
-
code:
|
|
2963
|
-
container_id:
|
|
2964
|
-
outputs:
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
3111
|
+
import_v416.z.object({
|
|
3112
|
+
type: import_v416.z.literal("code_interpreter_call"),
|
|
3113
|
+
id: import_v416.z.string(),
|
|
3114
|
+
code: import_v416.z.string().nullable(),
|
|
3115
|
+
container_id: import_v416.z.string(),
|
|
3116
|
+
outputs: import_v416.z.array(
|
|
3117
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3118
|
+
import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
|
|
3119
|
+
import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
|
|
2968
3120
|
])
|
|
2969
3121
|
).nullable()
|
|
2970
3122
|
}),
|
|
2971
|
-
|
|
2972
|
-
type:
|
|
2973
|
-
id:
|
|
2974
|
-
result:
|
|
3123
|
+
import_v416.z.object({
|
|
3124
|
+
type: import_v416.z.literal("image_generation_call"),
|
|
3125
|
+
id: import_v416.z.string(),
|
|
3126
|
+
result: import_v416.z.string()
|
|
2975
3127
|
}),
|
|
2976
|
-
|
|
2977
|
-
type:
|
|
2978
|
-
id:
|
|
2979
|
-
status:
|
|
2980
|
-
action:
|
|
2981
|
-
|
|
2982
|
-
type:
|
|
2983
|
-
query:
|
|
2984
|
-
sources:
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
3128
|
+
import_v416.z.object({
|
|
3129
|
+
type: import_v416.z.literal("web_search_call"),
|
|
3130
|
+
id: import_v416.z.string(),
|
|
3131
|
+
status: import_v416.z.string(),
|
|
3132
|
+
action: import_v416.z.discriminatedUnion("type", [
|
|
3133
|
+
import_v416.z.object({
|
|
3134
|
+
type: import_v416.z.literal("search"),
|
|
3135
|
+
query: import_v416.z.string().nullish(),
|
|
3136
|
+
sources: import_v416.z.array(
|
|
3137
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3138
|
+
import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
|
|
3139
|
+
import_v416.z.object({ type: import_v416.z.literal("api"), name: import_v416.z.string() })
|
|
2988
3140
|
])
|
|
2989
3141
|
).nullish()
|
|
2990
3142
|
}),
|
|
2991
|
-
|
|
2992
|
-
type:
|
|
2993
|
-
url:
|
|
3143
|
+
import_v416.z.object({
|
|
3144
|
+
type: import_v416.z.literal("open_page"),
|
|
3145
|
+
url: import_v416.z.string().nullish()
|
|
2994
3146
|
}),
|
|
2995
|
-
|
|
2996
|
-
type:
|
|
2997
|
-
url:
|
|
2998
|
-
pattern:
|
|
3147
|
+
import_v416.z.object({
|
|
3148
|
+
type: import_v416.z.literal("find_in_page"),
|
|
3149
|
+
url: import_v416.z.string().nullish(),
|
|
3150
|
+
pattern: import_v416.z.string().nullish()
|
|
2999
3151
|
})
|
|
3000
3152
|
]).nullish()
|
|
3001
3153
|
}),
|
|
3002
|
-
|
|
3003
|
-
type:
|
|
3004
|
-
id:
|
|
3005
|
-
queries:
|
|
3006
|
-
results:
|
|
3007
|
-
|
|
3008
|
-
attributes:
|
|
3009
|
-
file_id:
|
|
3010
|
-
filename:
|
|
3011
|
-
score:
|
|
3012
|
-
text:
|
|
3154
|
+
import_v416.z.object({
|
|
3155
|
+
type: import_v416.z.literal("file_search_call"),
|
|
3156
|
+
id: import_v416.z.string(),
|
|
3157
|
+
queries: import_v416.z.array(import_v416.z.string()),
|
|
3158
|
+
results: import_v416.z.array(
|
|
3159
|
+
import_v416.z.object({
|
|
3160
|
+
attributes: import_v416.z.record(import_v416.z.string(), import_v416.z.unknown()),
|
|
3161
|
+
file_id: import_v416.z.string(),
|
|
3162
|
+
filename: import_v416.z.string(),
|
|
3163
|
+
score: import_v416.z.number(),
|
|
3164
|
+
text: import_v416.z.string()
|
|
3013
3165
|
})
|
|
3014
3166
|
).nullish()
|
|
3015
3167
|
}),
|
|
3016
|
-
|
|
3017
|
-
type:
|
|
3018
|
-
id:
|
|
3019
|
-
call_id:
|
|
3020
|
-
action:
|
|
3021
|
-
type:
|
|
3022
|
-
command:
|
|
3023
|
-
timeout_ms:
|
|
3024
|
-
user:
|
|
3025
|
-
working_directory:
|
|
3026
|
-
env:
|
|
3168
|
+
import_v416.z.object({
|
|
3169
|
+
type: import_v416.z.literal("local_shell_call"),
|
|
3170
|
+
id: import_v416.z.string(),
|
|
3171
|
+
call_id: import_v416.z.string(),
|
|
3172
|
+
action: import_v416.z.object({
|
|
3173
|
+
type: import_v416.z.literal("exec"),
|
|
3174
|
+
command: import_v416.z.array(import_v416.z.string()),
|
|
3175
|
+
timeout_ms: import_v416.z.number().optional(),
|
|
3176
|
+
user: import_v416.z.string().optional(),
|
|
3177
|
+
working_directory: import_v416.z.string().optional(),
|
|
3178
|
+
env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
|
|
3027
3179
|
})
|
|
3028
3180
|
}),
|
|
3029
|
-
|
|
3030
|
-
type:
|
|
3031
|
-
id:
|
|
3032
|
-
status:
|
|
3181
|
+
import_v416.z.object({
|
|
3182
|
+
type: import_v416.z.literal("computer_call"),
|
|
3183
|
+
id: import_v416.z.string(),
|
|
3184
|
+
status: import_v416.z.literal("completed")
|
|
3033
3185
|
})
|
|
3034
3186
|
])
|
|
3035
3187
|
}),
|
|
3036
|
-
|
|
3037
|
-
type:
|
|
3038
|
-
item_id:
|
|
3039
|
-
output_index:
|
|
3040
|
-
delta:
|
|
3188
|
+
import_v416.z.object({
|
|
3189
|
+
type: import_v416.z.literal("response.function_call_arguments.delta"),
|
|
3190
|
+
item_id: import_v416.z.string(),
|
|
3191
|
+
output_index: import_v416.z.number(),
|
|
3192
|
+
delta: import_v416.z.string()
|
|
3041
3193
|
}),
|
|
3042
|
-
|
|
3043
|
-
type:
|
|
3044
|
-
item_id:
|
|
3045
|
-
output_index:
|
|
3046
|
-
partial_image_b64:
|
|
3194
|
+
import_v416.z.object({
|
|
3195
|
+
type: import_v416.z.literal("response.image_generation_call.partial_image"),
|
|
3196
|
+
item_id: import_v416.z.string(),
|
|
3197
|
+
output_index: import_v416.z.number(),
|
|
3198
|
+
partial_image_b64: import_v416.z.string()
|
|
3047
3199
|
}),
|
|
3048
|
-
|
|
3049
|
-
type:
|
|
3050
|
-
item_id:
|
|
3051
|
-
output_index:
|
|
3052
|
-
delta:
|
|
3200
|
+
import_v416.z.object({
|
|
3201
|
+
type: import_v416.z.literal("response.code_interpreter_call_code.delta"),
|
|
3202
|
+
item_id: import_v416.z.string(),
|
|
3203
|
+
output_index: import_v416.z.number(),
|
|
3204
|
+
delta: import_v416.z.string()
|
|
3053
3205
|
}),
|
|
3054
|
-
|
|
3055
|
-
type:
|
|
3056
|
-
item_id:
|
|
3057
|
-
output_index:
|
|
3058
|
-
code:
|
|
3206
|
+
import_v416.z.object({
|
|
3207
|
+
type: import_v416.z.literal("response.code_interpreter_call_code.done"),
|
|
3208
|
+
item_id: import_v416.z.string(),
|
|
3209
|
+
output_index: import_v416.z.number(),
|
|
3210
|
+
code: import_v416.z.string()
|
|
3059
3211
|
}),
|
|
3060
|
-
|
|
3061
|
-
type:
|
|
3062
|
-
annotation:
|
|
3063
|
-
|
|
3064
|
-
type:
|
|
3065
|
-
start_index:
|
|
3066
|
-
end_index:
|
|
3067
|
-
url:
|
|
3068
|
-
title:
|
|
3212
|
+
import_v416.z.object({
|
|
3213
|
+
type: import_v416.z.literal("response.output_text.annotation.added"),
|
|
3214
|
+
annotation: import_v416.z.discriminatedUnion("type", [
|
|
3215
|
+
import_v416.z.object({
|
|
3216
|
+
type: import_v416.z.literal("url_citation"),
|
|
3217
|
+
start_index: import_v416.z.number(),
|
|
3218
|
+
end_index: import_v416.z.number(),
|
|
3219
|
+
url: import_v416.z.string(),
|
|
3220
|
+
title: import_v416.z.string()
|
|
3069
3221
|
}),
|
|
3070
|
-
|
|
3071
|
-
type:
|
|
3072
|
-
file_id:
|
|
3073
|
-
filename:
|
|
3074
|
-
index:
|
|
3075
|
-
start_index:
|
|
3076
|
-
end_index:
|
|
3077
|
-
quote:
|
|
3222
|
+
import_v416.z.object({
|
|
3223
|
+
type: import_v416.z.literal("file_citation"),
|
|
3224
|
+
file_id: import_v416.z.string(),
|
|
3225
|
+
filename: import_v416.z.string().nullish(),
|
|
3226
|
+
index: import_v416.z.number().nullish(),
|
|
3227
|
+
start_index: import_v416.z.number().nullish(),
|
|
3228
|
+
end_index: import_v416.z.number().nullish(),
|
|
3229
|
+
quote: import_v416.z.string().nullish()
|
|
3078
3230
|
})
|
|
3079
3231
|
])
|
|
3080
3232
|
}),
|
|
3081
|
-
|
|
3082
|
-
type:
|
|
3083
|
-
item_id:
|
|
3084
|
-
summary_index:
|
|
3233
|
+
import_v416.z.object({
|
|
3234
|
+
type: import_v416.z.literal("response.reasoning_summary_part.added"),
|
|
3235
|
+
item_id: import_v416.z.string(),
|
|
3236
|
+
summary_index: import_v416.z.number()
|
|
3085
3237
|
}),
|
|
3086
|
-
|
|
3087
|
-
type:
|
|
3088
|
-
item_id:
|
|
3089
|
-
summary_index:
|
|
3090
|
-
delta:
|
|
3238
|
+
import_v416.z.object({
|
|
3239
|
+
type: import_v416.z.literal("response.reasoning_summary_text.delta"),
|
|
3240
|
+
item_id: import_v416.z.string(),
|
|
3241
|
+
summary_index: import_v416.z.number(),
|
|
3242
|
+
delta: import_v416.z.string()
|
|
3091
3243
|
}),
|
|
3092
|
-
|
|
3093
|
-
type:
|
|
3094
|
-
item_id:
|
|
3095
|
-
summary_index:
|
|
3244
|
+
import_v416.z.object({
|
|
3245
|
+
type: import_v416.z.literal("response.reasoning_summary_part.done"),
|
|
3246
|
+
item_id: import_v416.z.string(),
|
|
3247
|
+
summary_index: import_v416.z.number()
|
|
3096
3248
|
}),
|
|
3097
|
-
|
|
3098
|
-
type:
|
|
3099
|
-
sequence_number:
|
|
3100
|
-
error:
|
|
3101
|
-
type:
|
|
3102
|
-
code:
|
|
3103
|
-
message:
|
|
3104
|
-
param:
|
|
3249
|
+
import_v416.z.object({
|
|
3250
|
+
type: import_v416.z.literal("error"),
|
|
3251
|
+
sequence_number: import_v416.z.number(),
|
|
3252
|
+
error: import_v416.z.object({
|
|
3253
|
+
type: import_v416.z.string(),
|
|
3254
|
+
code: import_v416.z.string(),
|
|
3255
|
+
message: import_v416.z.string(),
|
|
3256
|
+
param: import_v416.z.string().nullish()
|
|
3105
3257
|
})
|
|
3106
3258
|
}),
|
|
3107
|
-
|
|
3259
|
+
import_v416.z.object({ type: import_v416.z.string() }).loose().transform((value) => ({
|
|
3108
3260
|
type: "unknown_chunk",
|
|
3109
3261
|
message: value.type
|
|
3110
3262
|
}))
|
|
@@ -3112,389 +3264,203 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
|
|
|
3112
3264
|
])
|
|
3113
3265
|
)
|
|
3114
3266
|
);
|
|
3115
|
-
var openaiResponsesResponseSchema = (0,
|
|
3116
|
-
() => (0,
|
|
3117
|
-
|
|
3118
|
-
id:
|
|
3119
|
-
created_at:
|
|
3120
|
-
error:
|
|
3121
|
-
message:
|
|
3122
|
-
type:
|
|
3123
|
-
param:
|
|
3124
|
-
code:
|
|
3267
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3268
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3269
|
+
import_v416.z.object({
|
|
3270
|
+
id: import_v416.z.string().optional(),
|
|
3271
|
+
created_at: import_v416.z.number().optional(),
|
|
3272
|
+
error: import_v416.z.object({
|
|
3273
|
+
message: import_v416.z.string(),
|
|
3274
|
+
type: import_v416.z.string(),
|
|
3275
|
+
param: import_v416.z.string().nullish(),
|
|
3276
|
+
code: import_v416.z.string()
|
|
3125
3277
|
}).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:
|
|
3278
|
+
model: import_v416.z.string().optional(),
|
|
3279
|
+
output: import_v416.z.array(
|
|
3280
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3281
|
+
import_v416.z.object({
|
|
3282
|
+
type: import_v416.z.literal("message"),
|
|
3283
|
+
role: import_v416.z.literal("assistant"),
|
|
3284
|
+
id: import_v416.z.string(),
|
|
3285
|
+
phase: import_v416.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3286
|
+
content: import_v416.z.array(
|
|
3287
|
+
import_v416.z.object({
|
|
3288
|
+
type: import_v416.z.literal("output_text"),
|
|
3289
|
+
text: import_v416.z.string(),
|
|
3290
|
+
logprobs: import_v416.z.array(
|
|
3291
|
+
import_v416.z.object({
|
|
3292
|
+
token: import_v416.z.string(),
|
|
3293
|
+
logprob: import_v416.z.number(),
|
|
3294
|
+
top_logprobs: import_v416.z.array(
|
|
3295
|
+
import_v416.z.object({
|
|
3296
|
+
token: import_v416.z.string(),
|
|
3297
|
+
logprob: import_v416.z.number()
|
|
3146
3298
|
})
|
|
3147
3299
|
)
|
|
3148
3300
|
})
|
|
3149
3301
|
).nullish(),
|
|
3150
|
-
annotations:
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
type:
|
|
3154
|
-
start_index:
|
|
3155
|
-
end_index:
|
|
3156
|
-
url:
|
|
3157
|
-
title:
|
|
3302
|
+
annotations: import_v416.z.array(
|
|
3303
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3304
|
+
import_v416.z.object({
|
|
3305
|
+
type: import_v416.z.literal("url_citation"),
|
|
3306
|
+
start_index: import_v416.z.number(),
|
|
3307
|
+
end_index: import_v416.z.number(),
|
|
3308
|
+
url: import_v416.z.string(),
|
|
3309
|
+
title: import_v416.z.string()
|
|
3158
3310
|
}),
|
|
3159
|
-
|
|
3160
|
-
type:
|
|
3161
|
-
file_id:
|
|
3162
|
-
filename:
|
|
3163
|
-
index:
|
|
3164
|
-
start_index:
|
|
3165
|
-
end_index:
|
|
3166
|
-
quote:
|
|
3311
|
+
import_v416.z.object({
|
|
3312
|
+
type: import_v416.z.literal("file_citation"),
|
|
3313
|
+
file_id: import_v416.z.string(),
|
|
3314
|
+
filename: import_v416.z.string().nullish(),
|
|
3315
|
+
index: import_v416.z.number().nullish(),
|
|
3316
|
+
start_index: import_v416.z.number().nullish(),
|
|
3317
|
+
end_index: import_v416.z.number().nullish(),
|
|
3318
|
+
quote: import_v416.z.string().nullish()
|
|
3167
3319
|
}),
|
|
3168
|
-
|
|
3169
|
-
type:
|
|
3170
|
-
container_id:
|
|
3171
|
-
file_id:
|
|
3172
|
-
filename:
|
|
3173
|
-
start_index:
|
|
3174
|
-
end_index:
|
|
3175
|
-
index:
|
|
3320
|
+
import_v416.z.object({
|
|
3321
|
+
type: import_v416.z.literal("container_file_citation"),
|
|
3322
|
+
container_id: import_v416.z.string(),
|
|
3323
|
+
file_id: import_v416.z.string(),
|
|
3324
|
+
filename: import_v416.z.string().nullish(),
|
|
3325
|
+
start_index: import_v416.z.number().nullish(),
|
|
3326
|
+
end_index: import_v416.z.number().nullish(),
|
|
3327
|
+
index: import_v416.z.number().nullish()
|
|
3176
3328
|
}),
|
|
3177
|
-
|
|
3178
|
-
type:
|
|
3179
|
-
file_id:
|
|
3180
|
-
index:
|
|
3329
|
+
import_v416.z.object({
|
|
3330
|
+
type: import_v416.z.literal("file_path"),
|
|
3331
|
+
file_id: import_v416.z.string(),
|
|
3332
|
+
index: import_v416.z.number().nullish()
|
|
3181
3333
|
})
|
|
3182
3334
|
])
|
|
3183
3335
|
)
|
|
3184
3336
|
})
|
|
3185
3337
|
)
|
|
3186
3338
|
}),
|
|
3187
|
-
|
|
3188
|
-
type:
|
|
3189
|
-
id:
|
|
3190
|
-
status:
|
|
3191
|
-
action:
|
|
3192
|
-
|
|
3193
|
-
type:
|
|
3194
|
-
query:
|
|
3195
|
-
sources:
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
type:
|
|
3200
|
-
name:
|
|
3339
|
+
import_v416.z.object({
|
|
3340
|
+
type: import_v416.z.literal("web_search_call"),
|
|
3341
|
+
id: import_v416.z.string(),
|
|
3342
|
+
status: import_v416.z.string(),
|
|
3343
|
+
action: import_v416.z.discriminatedUnion("type", [
|
|
3344
|
+
import_v416.z.object({
|
|
3345
|
+
type: import_v416.z.literal("search"),
|
|
3346
|
+
query: import_v416.z.string().nullish(),
|
|
3347
|
+
sources: import_v416.z.array(
|
|
3348
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3349
|
+
import_v416.z.object({ type: import_v416.z.literal("url"), url: import_v416.z.string() }),
|
|
3350
|
+
import_v416.z.object({
|
|
3351
|
+
type: import_v416.z.literal("api"),
|
|
3352
|
+
name: import_v416.z.string()
|
|
3201
3353
|
})
|
|
3202
3354
|
])
|
|
3203
3355
|
).nullish()
|
|
3204
3356
|
}),
|
|
3205
|
-
|
|
3206
|
-
type:
|
|
3207
|
-
url:
|
|
3357
|
+
import_v416.z.object({
|
|
3358
|
+
type: import_v416.z.literal("open_page"),
|
|
3359
|
+
url: import_v416.z.string().nullish()
|
|
3208
3360
|
}),
|
|
3209
|
-
|
|
3210
|
-
type:
|
|
3211
|
-
url:
|
|
3212
|
-
pattern:
|
|
3361
|
+
import_v416.z.object({
|
|
3362
|
+
type: import_v416.z.literal("find_in_page"),
|
|
3363
|
+
url: import_v416.z.string().nullish(),
|
|
3364
|
+
pattern: import_v416.z.string().nullish()
|
|
3213
3365
|
})
|
|
3214
3366
|
]).nullish()
|
|
3215
3367
|
}),
|
|
3216
|
-
|
|
3217
|
-
type:
|
|
3218
|
-
id:
|
|
3219
|
-
queries:
|
|
3220
|
-
results:
|
|
3221
|
-
|
|
3222
|
-
attributes:
|
|
3223
|
-
|
|
3224
|
-
|
|
3368
|
+
import_v416.z.object({
|
|
3369
|
+
type: import_v416.z.literal("file_search_call"),
|
|
3370
|
+
id: import_v416.z.string(),
|
|
3371
|
+
queries: import_v416.z.array(import_v416.z.string()),
|
|
3372
|
+
results: import_v416.z.array(
|
|
3373
|
+
import_v416.z.object({
|
|
3374
|
+
attributes: import_v416.z.record(
|
|
3375
|
+
import_v416.z.string(),
|
|
3376
|
+
import_v416.z.union([import_v416.z.string(), import_v416.z.number(), import_v416.z.boolean()])
|
|
3225
3377
|
),
|
|
3226
|
-
file_id:
|
|
3227
|
-
filename:
|
|
3228
|
-
score:
|
|
3229
|
-
text:
|
|
3378
|
+
file_id: import_v416.z.string(),
|
|
3379
|
+
filename: import_v416.z.string(),
|
|
3380
|
+
score: import_v416.z.number(),
|
|
3381
|
+
text: import_v416.z.string()
|
|
3230
3382
|
})
|
|
3231
3383
|
).nullish()
|
|
3232
3384
|
}),
|
|
3233
|
-
|
|
3234
|
-
type:
|
|
3235
|
-
id:
|
|
3236
|
-
code:
|
|
3237
|
-
container_id:
|
|
3238
|
-
outputs:
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3385
|
+
import_v416.z.object({
|
|
3386
|
+
type: import_v416.z.literal("code_interpreter_call"),
|
|
3387
|
+
id: import_v416.z.string(),
|
|
3388
|
+
code: import_v416.z.string().nullable(),
|
|
3389
|
+
container_id: import_v416.z.string(),
|
|
3390
|
+
outputs: import_v416.z.array(
|
|
3391
|
+
import_v416.z.discriminatedUnion("type", [
|
|
3392
|
+
import_v416.z.object({ type: import_v416.z.literal("logs"), logs: import_v416.z.string() }),
|
|
3393
|
+
import_v416.z.object({ type: import_v416.z.literal("image"), url: import_v416.z.string() })
|
|
3242
3394
|
])
|
|
3243
3395
|
).nullable()
|
|
3244
3396
|
}),
|
|
3245
|
-
|
|
3246
|
-
type:
|
|
3247
|
-
id:
|
|
3248
|
-
result:
|
|
3397
|
+
import_v416.z.object({
|
|
3398
|
+
type: import_v416.z.literal("image_generation_call"),
|
|
3399
|
+
id: import_v416.z.string(),
|
|
3400
|
+
result: import_v416.z.string()
|
|
3249
3401
|
}),
|
|
3250
|
-
|
|
3251
|
-
type:
|
|
3252
|
-
id:
|
|
3253
|
-
call_id:
|
|
3254
|
-
action:
|
|
3255
|
-
type:
|
|
3256
|
-
command:
|
|
3257
|
-
timeout_ms:
|
|
3258
|
-
user:
|
|
3259
|
-
working_directory:
|
|
3260
|
-
env:
|
|
3402
|
+
import_v416.z.object({
|
|
3403
|
+
type: import_v416.z.literal("local_shell_call"),
|
|
3404
|
+
id: import_v416.z.string(),
|
|
3405
|
+
call_id: import_v416.z.string(),
|
|
3406
|
+
action: import_v416.z.object({
|
|
3407
|
+
type: import_v416.z.literal("exec"),
|
|
3408
|
+
command: import_v416.z.array(import_v416.z.string()),
|
|
3409
|
+
timeout_ms: import_v416.z.number().optional(),
|
|
3410
|
+
user: import_v416.z.string().optional(),
|
|
3411
|
+
working_directory: import_v416.z.string().optional(),
|
|
3412
|
+
env: import_v416.z.record(import_v416.z.string(), import_v416.z.string()).optional()
|
|
3261
3413
|
})
|
|
3262
3414
|
}),
|
|
3263
|
-
|
|
3264
|
-
type:
|
|
3265
|
-
call_id:
|
|
3266
|
-
name:
|
|
3267
|
-
arguments:
|
|
3268
|
-
id:
|
|
3269
|
-
async:
|
|
3415
|
+
import_v416.z.object({
|
|
3416
|
+
type: import_v416.z.literal("function_call"),
|
|
3417
|
+
call_id: import_v416.z.string(),
|
|
3418
|
+
name: import_v416.z.string(),
|
|
3419
|
+
arguments: import_v416.z.string(),
|
|
3420
|
+
id: import_v416.z.string(),
|
|
3421
|
+
async: import_v416.z.boolean().nullish()
|
|
3270
3422
|
}),
|
|
3271
|
-
|
|
3272
|
-
type:
|
|
3273
|
-
id:
|
|
3274
|
-
status:
|
|
3423
|
+
import_v416.z.object({
|
|
3424
|
+
type: import_v416.z.literal("computer_call"),
|
|
3425
|
+
id: import_v416.z.string(),
|
|
3426
|
+
status: import_v416.z.string().optional()
|
|
3275
3427
|
}),
|
|
3276
|
-
|
|
3277
|
-
type:
|
|
3278
|
-
id:
|
|
3279
|
-
encrypted_content:
|
|
3280
|
-
summary:
|
|
3281
|
-
|
|
3282
|
-
type:
|
|
3283
|
-
text:
|
|
3428
|
+
import_v416.z.object({
|
|
3429
|
+
type: import_v416.z.literal("reasoning"),
|
|
3430
|
+
id: import_v416.z.string(),
|
|
3431
|
+
encrypted_content: import_v416.z.string().nullish(),
|
|
3432
|
+
summary: import_v416.z.array(
|
|
3433
|
+
import_v416.z.object({
|
|
3434
|
+
type: import_v416.z.literal("summary_text"),
|
|
3435
|
+
text: import_v416.z.string()
|
|
3284
3436
|
})
|
|
3285
3437
|
)
|
|
3286
3438
|
})
|
|
3287
3439
|
])
|
|
3288
3440
|
).optional(),
|
|
3289
|
-
service_tier:
|
|
3290
|
-
reasoning:
|
|
3291
|
-
context:
|
|
3441
|
+
service_tier: import_v416.z.string().nullish(),
|
|
3442
|
+
reasoning: import_v416.z.object({
|
|
3443
|
+
context: import_v416.z.string().nullish()
|
|
3292
3444
|
}).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:
|
|
3445
|
+
incomplete_details: import_v416.z.object({ reason: import_v416.z.string() }).nullish(),
|
|
3446
|
+
usage: import_v416.z.object({
|
|
3447
|
+
input_tokens: import_v416.z.number(),
|
|
3448
|
+
input_tokens_details: import_v416.z.object({
|
|
3449
|
+
cached_tokens: import_v416.z.number().nullish(),
|
|
3450
|
+
cache_write_tokens: import_v416.z.number().nullish(),
|
|
3451
|
+
orchestration_input_tokens: import_v416.z.number().nullish(),
|
|
3452
|
+
orchestration_input_cached_tokens: import_v416.z.number().nullish()
|
|
3301
3453
|
}).nullish(),
|
|
3302
|
-
output_tokens:
|
|
3303
|
-
output_tokens_details:
|
|
3304
|
-
reasoning_tokens:
|
|
3305
|
-
orchestration_output_tokens:
|
|
3454
|
+
output_tokens: import_v416.z.number(),
|
|
3455
|
+
output_tokens_details: import_v416.z.object({
|
|
3456
|
+
reasoning_tokens: import_v416.z.number().nullish(),
|
|
3457
|
+
orchestration_output_tokens: import_v416.z.number().nullish()
|
|
3306
3458
|
}).nullish()
|
|
3307
3459
|
}).optional()
|
|
3308
3460
|
})
|
|
3309
3461
|
)
|
|
3310
3462
|
);
|
|
3311
3463
|
|
|
3312
|
-
// src/responses/openai-responses-options.ts
|
|
3313
|
-
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3314
|
-
var import_v416 = require("zod/v4");
|
|
3315
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
3316
|
-
var openaiResponsesReasoningModelIds = [
|
|
3317
|
-
"o1",
|
|
3318
|
-
"o1-2024-12-17",
|
|
3319
|
-
"o3",
|
|
3320
|
-
"o3-2025-04-16",
|
|
3321
|
-
"o3-deep-research",
|
|
3322
|
-
"o3-deep-research-2025-06-26",
|
|
3323
|
-
"o3-mini",
|
|
3324
|
-
"o3-mini-2025-01-31",
|
|
3325
|
-
"o4-mini",
|
|
3326
|
-
"o4-mini-2025-04-16",
|
|
3327
|
-
"o4-mini-deep-research",
|
|
3328
|
-
"o4-mini-deep-research-2025-06-26",
|
|
3329
|
-
"codex-mini-latest",
|
|
3330
|
-
"computer-use-preview",
|
|
3331
|
-
"gpt-5",
|
|
3332
|
-
"gpt-5-2025-08-07",
|
|
3333
|
-
"gpt-5-codex",
|
|
3334
|
-
"gpt-5-mini",
|
|
3335
|
-
"gpt-5-mini-2025-08-07",
|
|
3336
|
-
"gpt-5-nano",
|
|
3337
|
-
"gpt-5-nano-2025-08-07",
|
|
3338
|
-
"gpt-5-pro",
|
|
3339
|
-
"gpt-5-pro-2025-10-06",
|
|
3340
|
-
"gpt-5.1",
|
|
3341
|
-
"gpt-5.1-chat-latest",
|
|
3342
|
-
"gpt-5.1-codex-mini",
|
|
3343
|
-
"gpt-5.1-codex",
|
|
3344
|
-
"gpt-5.1-codex-max",
|
|
3345
|
-
"gpt-5.2",
|
|
3346
|
-
"gpt-5.2-chat-latest",
|
|
3347
|
-
"gpt-5.2-pro",
|
|
3348
|
-
"gpt-5.2-codex",
|
|
3349
|
-
"gpt-5.3-chat-latest",
|
|
3350
|
-
"gpt-5.3-codex",
|
|
3351
|
-
"gpt-5.4",
|
|
3352
|
-
"gpt-5.4-2026-03-05",
|
|
3353
|
-
"gpt-5.4-mini",
|
|
3354
|
-
"gpt-5.4-mini-2026-03-17",
|
|
3355
|
-
"gpt-5.4-nano",
|
|
3356
|
-
"gpt-5.4-nano-2026-03-17",
|
|
3357
|
-
"gpt-5.4-pro",
|
|
3358
|
-
"gpt-5.4-pro-2026-03-05",
|
|
3359
|
-
"gpt-5.6",
|
|
3360
|
-
"gpt-5.6-luna",
|
|
3361
|
-
"gpt-5.6-sol",
|
|
3362
|
-
"gpt-5.6-terra",
|
|
3363
|
-
"gpt-6-astra",
|
|
3364
|
-
"gpt-6-luna",
|
|
3365
|
-
"gpt-6-sol"
|
|
3366
|
-
];
|
|
3367
|
-
var openaiResponsesModelIds = [
|
|
3368
|
-
"gpt-4.1",
|
|
3369
|
-
"gpt-4.1-2025-04-14",
|
|
3370
|
-
"gpt-4.1-mini",
|
|
3371
|
-
"gpt-4.1-mini-2025-04-14",
|
|
3372
|
-
"gpt-4.1-nano",
|
|
3373
|
-
"gpt-4.1-nano-2025-04-14",
|
|
3374
|
-
"gpt-4o",
|
|
3375
|
-
"gpt-4o-2024-05-13",
|
|
3376
|
-
"gpt-4o-2024-08-06",
|
|
3377
|
-
"gpt-4o-2024-11-20",
|
|
3378
|
-
"gpt-4o-audio-preview",
|
|
3379
|
-
"gpt-4o-audio-preview-2024-10-01",
|
|
3380
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
3381
|
-
"gpt-4o-search-preview",
|
|
3382
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
3383
|
-
"gpt-4o-mini-search-preview",
|
|
3384
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3385
|
-
"gpt-4o-mini",
|
|
3386
|
-
"gpt-4o-mini-2024-07-18",
|
|
3387
|
-
"gpt-4-turbo",
|
|
3388
|
-
"gpt-4-turbo-2024-04-09",
|
|
3389
|
-
"gpt-4-turbo-preview",
|
|
3390
|
-
"gpt-4-0125-preview",
|
|
3391
|
-
"gpt-4-1106-preview",
|
|
3392
|
-
"gpt-4",
|
|
3393
|
-
"gpt-4-0613",
|
|
3394
|
-
"gpt-4.5-preview",
|
|
3395
|
-
"gpt-4.5-preview-2025-02-27",
|
|
3396
|
-
"gpt-3.5-turbo-0125",
|
|
3397
|
-
"gpt-3.5-turbo",
|
|
3398
|
-
"gpt-3.5-turbo-1106",
|
|
3399
|
-
"chatgpt-4o-latest",
|
|
3400
|
-
"gpt-5-chat-latest",
|
|
3401
|
-
...openaiResponsesReasoningModelIds
|
|
3402
|
-
];
|
|
3403
|
-
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3404
|
-
() => (0, import_provider_utils23.zodSchema)(
|
|
3405
|
-
import_v416.z.object({
|
|
3406
|
-
conversation: import_v416.z.string().nullish(),
|
|
3407
|
-
include: import_v416.z.array(
|
|
3408
|
-
import_v416.z.enum([
|
|
3409
|
-
"reasoning.encrypted_content",
|
|
3410
|
-
// handled internally by default, only needed for unknown reasoning models
|
|
3411
|
-
"file_search_call.results",
|
|
3412
|
-
"message.output_text.logprobs"
|
|
3413
|
-
])
|
|
3414
|
-
).nullish(),
|
|
3415
|
-
instructions: import_v416.z.string().nullish(),
|
|
3416
|
-
/**
|
|
3417
|
-
* Return the log probabilities of the tokens.
|
|
3418
|
-
*
|
|
3419
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
3420
|
-
* were generated.
|
|
3421
|
-
*
|
|
3422
|
-
* Setting to a number will return the log probabilities of the top n
|
|
3423
|
-
* tokens that were generated.
|
|
3424
|
-
*
|
|
3425
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3426
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3427
|
-
*/
|
|
3428
|
-
logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3429
|
-
/**
|
|
3430
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3431
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3432
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
3433
|
-
*/
|
|
3434
|
-
maxToolCalls: import_v416.z.number().nullish(),
|
|
3435
|
-
metadata: import_v416.z.any().nullish(),
|
|
3436
|
-
parallelToolCalls: import_v416.z.boolean().nullish(),
|
|
3437
|
-
previousResponseId: import_v416.z.string().nullish(),
|
|
3438
|
-
promptCacheKey: import_v416.z.string().nullish(),
|
|
3439
|
-
/**
|
|
3440
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3441
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3442
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3443
|
-
*/
|
|
3444
|
-
promptCacheOptions: import_v416.z.object({
|
|
3445
|
-
mode: import_v416.z.enum(["implicit", "explicit"]).optional(),
|
|
3446
|
-
ttl: import_v416.z.literal("30m").optional()
|
|
3447
|
-
}).optional(),
|
|
3448
|
-
/**
|
|
3449
|
-
* The retention policy for the prompt cache.
|
|
3450
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3451
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3452
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
3453
|
-
*
|
|
3454
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3455
|
-
*
|
|
3456
|
-
* @default 'in_memory'
|
|
3457
|
-
*/
|
|
3458
|
-
promptCacheRetention: import_v416.z.enum(["in_memory", "24h"]).nullish(),
|
|
3459
|
-
/**
|
|
3460
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3461
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3462
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3463
|
-
* Supported values vary by model.
|
|
3464
|
-
*/
|
|
3465
|
-
reasoningEffort: import_v416.z.string().nullish(),
|
|
3466
|
-
/**
|
|
3467
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3468
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
3469
|
-
* request prefix for prompt caching.
|
|
3470
|
-
*
|
|
3471
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3472
|
-
* combined with automatic truncation.
|
|
3473
|
-
*/
|
|
3474
|
-
reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3475
|
-
/**
|
|
3476
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3477
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3478
|
-
*/
|
|
3479
|
-
reasoningMode: import_v416.z.enum(["standard", "pro"]).optional(),
|
|
3480
|
-
/**
|
|
3481
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
3482
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3483
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3484
|
-
*/
|
|
3485
|
-
reasoningContext: import_v416.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3486
|
-
reasoningSummary: import_v416.z.string().nullish(),
|
|
3487
|
-
safetyIdentifier: import_v416.z.string().nullish(),
|
|
3488
|
-
serviceTier: import_v416.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3489
|
-
store: import_v416.z.boolean().nullish(),
|
|
3490
|
-
strictJsonSchema: import_v416.z.boolean().nullish(),
|
|
3491
|
-
textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
|
|
3492
|
-
truncation: import_v416.z.enum(["auto", "disabled"]).nullish(),
|
|
3493
|
-
user: import_v416.z.string().nullish()
|
|
3494
|
-
})
|
|
3495
|
-
)
|
|
3496
|
-
);
|
|
3497
|
-
|
|
3498
3464
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3499
3465
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3500
3466
|
|
|
@@ -3906,6 +3872,18 @@ function resolveAsyncToolOption({
|
|
|
3906
3872
|
}
|
|
3907
3873
|
|
|
3908
3874
|
// src/responses/openai-responses-language-model.ts
|
|
3875
|
+
function getConfigurationUpdateUnsupportedReason({
|
|
3876
|
+
modelCapabilities,
|
|
3877
|
+
options
|
|
3878
|
+
}) {
|
|
3879
|
+
if (!modelCapabilities.supportsConfigurationUpdate) {
|
|
3880
|
+
return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
3881
|
+
}
|
|
3882
|
+
if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
|
|
3883
|
+
return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
|
|
3884
|
+
}
|
|
3885
|
+
return void 0;
|
|
3886
|
+
}
|
|
3909
3887
|
var OpenAIResponsesLanguageModel = class {
|
|
3910
3888
|
constructor(modelId, config) {
|
|
3911
3889
|
this.specificationVersion = "v2";
|
|
@@ -3970,8 +3948,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3970
3948
|
details: "conversation and previousResponseId cannot be used together"
|
|
3971
3949
|
});
|
|
3972
3950
|
}
|
|
3951
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
3952
|
+
modelCapabilities,
|
|
3953
|
+
options: openaiOptions
|
|
3954
|
+
});
|
|
3973
3955
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3974
3956
|
prompt,
|
|
3957
|
+
configurationUpdateUnsupportedReason,
|
|
3958
|
+
providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
|
|
3975
3959
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
3976
3960
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
3977
3961
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
@@ -3991,18 +3975,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3991
3975
|
resolvedReasoningEffort = void 0;
|
|
3992
3976
|
}
|
|
3993
3977
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
3994
|
-
|
|
3995
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
3978
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
3996
3979
|
warnings.push({
|
|
3997
3980
|
type: "unsupported-setting",
|
|
3998
3981
|
setting: "reasoningEffortUpdate",
|
|
3999
|
-
details:
|
|
3982
|
+
details: configurationUpdateUnsupportedReason
|
|
4000
3983
|
});
|
|
4001
3984
|
} else if (reasoningEffortUpdate != null) {
|
|
4002
|
-
input
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
3985
|
+
const firstItem = input[0];
|
|
3986
|
+
if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
|
|
3987
|
+
input.unshift({
|
|
3988
|
+
type: "configuration_update",
|
|
3989
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
3990
|
+
});
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3993
|
+
for (let i = 1; i < input.length; i++) {
|
|
3994
|
+
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
3995
|
+
throw new import_provider8.UnsupportedFunctionalityError({
|
|
3996
|
+
functionality: "Adjacent reasoning effort configuration updates"
|
|
3997
|
+
});
|
|
3998
|
+
}
|
|
4006
3999
|
}
|
|
4007
4000
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
4008
4001
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|