@ai-sdk/openai 2.0.128 → 2.0.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +664 -588
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +664 -587
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +675 -601
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +674 -599
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -390,6 +390,9 @@ var openaiChatResponseSchema = (0, import_provider_utils3.lazyValidator)(
|
|
|
390
390
|
message: import_v42.z.object({
|
|
391
391
|
role: import_v42.z.literal("assistant").nullish(),
|
|
392
392
|
content: import_v42.z.string().nullish(),
|
|
393
|
+
audio: import_v42.z.object({
|
|
394
|
+
transcript: import_v42.z.string().nullish()
|
|
395
|
+
}).nullish(),
|
|
393
396
|
tool_calls: import_v42.z.array(
|
|
394
397
|
import_v42.z.object({
|
|
395
398
|
id: import_v42.z.string().nullish(),
|
|
@@ -925,7 +928,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
925
928
|
};
|
|
926
929
|
}
|
|
927
930
|
async doGenerate(options) {
|
|
928
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
931
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
929
932
|
const { args: body, warnings } = await this.getArgs(options);
|
|
930
933
|
const {
|
|
931
934
|
responseHeaders,
|
|
@@ -953,19 +956,19 @@ var OpenAIChatLanguageModel = class {
|
|
|
953
956
|
});
|
|
954
957
|
}
|
|
955
958
|
const content = [];
|
|
956
|
-
const text = choice.message.content;
|
|
959
|
+
const text = choice.message.content != null && choice.message.content.length > 0 ? choice.message.content : (_a2 = choice.message.audio) == null ? void 0 : _a2.transcript;
|
|
957
960
|
if (text != null && text.length > 0) {
|
|
958
961
|
content.push({ type: "text", text });
|
|
959
962
|
}
|
|
960
|
-
for (const toolCall of (
|
|
963
|
+
for (const toolCall of (_b = choice.message.tool_calls) != null ? _b : []) {
|
|
961
964
|
content.push({
|
|
962
965
|
type: "tool-call",
|
|
963
|
-
toolCallId: (
|
|
966
|
+
toolCallId: (_c = toolCall.id) != null ? _c : (0, import_provider_utils5.generateId)(),
|
|
964
967
|
toolName: toolCall.function.name,
|
|
965
968
|
input: toolCall.function.arguments
|
|
966
969
|
});
|
|
967
970
|
}
|
|
968
|
-
for (const annotation of (
|
|
971
|
+
for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
|
|
969
972
|
content.push({
|
|
970
973
|
type: "source",
|
|
971
974
|
sourceType: "url",
|
|
@@ -974,8 +977,8 @@ var OpenAIChatLanguageModel = class {
|
|
|
974
977
|
title: annotation.url_citation.title
|
|
975
978
|
});
|
|
976
979
|
}
|
|
977
|
-
const completionTokenDetails = (
|
|
978
|
-
const promptTokenDetails = (
|
|
980
|
+
const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
|
|
981
|
+
const promptTokenDetails = (_f = response.usage) == null ? void 0 : _f.prompt_tokens_details;
|
|
979
982
|
const providerMetadata = { openai: {} };
|
|
980
983
|
if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
|
|
981
984
|
providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
|
|
@@ -988,18 +991,18 @@ var OpenAIChatLanguageModel = class {
|
|
|
988
991
|
cacheWriteTokens: promptTokenDetails.cache_write_tokens
|
|
989
992
|
};
|
|
990
993
|
}
|
|
991
|
-
if (((
|
|
994
|
+
if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
|
|
992
995
|
providerMetadata.openai.logprobs = choice.logprobs.content;
|
|
993
996
|
}
|
|
994
997
|
return {
|
|
995
998
|
content,
|
|
996
999
|
finishReason: mapOpenAIFinishReason(choice.finish_reason),
|
|
997
1000
|
usage: {
|
|
998
|
-
inputTokens: (
|
|
999
|
-
outputTokens: (
|
|
1000
|
-
totalTokens: (
|
|
1001
|
-
reasoningTokens: (
|
|
1002
|
-
cachedInputTokens: (
|
|
1001
|
+
inputTokens: (_i = (_h = response.usage) == null ? void 0 : _h.prompt_tokens) != null ? _i : void 0,
|
|
1002
|
+
outputTokens: (_k = (_j = response.usage) == null ? void 0 : _j.completion_tokens) != null ? _k : void 0,
|
|
1003
|
+
totalTokens: (_m = (_l = response.usage) == null ? void 0 : _l.total_tokens) != null ? _m : void 0,
|
|
1004
|
+
reasoningTokens: (_n = completionTokenDetails == null ? void 0 : completionTokenDetails.reasoning_tokens) != null ? _n : void 0,
|
|
1005
|
+
cachedInputTokens: (_o = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens) != null ? _o : void 0
|
|
1003
1006
|
},
|
|
1004
1007
|
request: { body },
|
|
1005
1008
|
response: {
|
|
@@ -2354,8 +2357,211 @@ var import_provider_utils25 = require("@ai-sdk/provider-utils");
|
|
|
2354
2357
|
|
|
2355
2358
|
// src/responses/convert-to-openai-responses-input.ts
|
|
2356
2359
|
var import_provider6 = require("@ai-sdk/provider");
|
|
2360
|
+
var import_provider_utils22 = require("@ai-sdk/provider-utils");
|
|
2361
|
+
var import_v417 = require("zod/v4");
|
|
2362
|
+
|
|
2363
|
+
// src/responses/openai-responses-options.ts
|
|
2357
2364
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
2358
2365
|
var import_v416 = require("zod/v4");
|
|
2366
|
+
var TOP_LOGPROBS_MAX = 20;
|
|
2367
|
+
var openaiResponsesReasoningModelIds = [
|
|
2368
|
+
"o1",
|
|
2369
|
+
"o1-2024-12-17",
|
|
2370
|
+
"o3",
|
|
2371
|
+
"o3-2025-04-16",
|
|
2372
|
+
"o3-deep-research",
|
|
2373
|
+
"o3-deep-research-2025-06-26",
|
|
2374
|
+
"o3-mini",
|
|
2375
|
+
"o3-mini-2025-01-31",
|
|
2376
|
+
"o4-mini",
|
|
2377
|
+
"o4-mini-2025-04-16",
|
|
2378
|
+
"o4-mini-deep-research",
|
|
2379
|
+
"o4-mini-deep-research-2025-06-26",
|
|
2380
|
+
"codex-mini-latest",
|
|
2381
|
+
"computer-use-preview",
|
|
2382
|
+
"gpt-5",
|
|
2383
|
+
"gpt-5-2025-08-07",
|
|
2384
|
+
"gpt-5-codex",
|
|
2385
|
+
"gpt-5-mini",
|
|
2386
|
+
"gpt-5-mini-2025-08-07",
|
|
2387
|
+
"gpt-5-nano",
|
|
2388
|
+
"gpt-5-nano-2025-08-07",
|
|
2389
|
+
"gpt-5-pro",
|
|
2390
|
+
"gpt-5-pro-2025-10-06",
|
|
2391
|
+
"gpt-5.1",
|
|
2392
|
+
"gpt-5.1-chat-latest",
|
|
2393
|
+
"gpt-5.1-codex-mini",
|
|
2394
|
+
"gpt-5.1-codex",
|
|
2395
|
+
"gpt-5.1-codex-max",
|
|
2396
|
+
"gpt-5.2",
|
|
2397
|
+
"gpt-5.2-chat-latest",
|
|
2398
|
+
"gpt-5.2-pro",
|
|
2399
|
+
"gpt-5.2-codex",
|
|
2400
|
+
"gpt-5.3-chat-latest",
|
|
2401
|
+
"gpt-5.3-codex",
|
|
2402
|
+
"gpt-5.4",
|
|
2403
|
+
"gpt-5.4-2026-03-05",
|
|
2404
|
+
"gpt-5.4-mini",
|
|
2405
|
+
"gpt-5.4-mini-2026-03-17",
|
|
2406
|
+
"gpt-5.4-nano",
|
|
2407
|
+
"gpt-5.4-nano-2026-03-17",
|
|
2408
|
+
"gpt-5.4-pro",
|
|
2409
|
+
"gpt-5.4-pro-2026-03-05",
|
|
2410
|
+
"gpt-5.6",
|
|
2411
|
+
"gpt-5.6-luna",
|
|
2412
|
+
"gpt-5.6-sol",
|
|
2413
|
+
"gpt-5.6-terra",
|
|
2414
|
+
"gpt-6-astra",
|
|
2415
|
+
"gpt-6-luna",
|
|
2416
|
+
"gpt-6-sol"
|
|
2417
|
+
];
|
|
2418
|
+
var openaiResponsesModelIds = [
|
|
2419
|
+
"gpt-4.1",
|
|
2420
|
+
"gpt-4.1-2025-04-14",
|
|
2421
|
+
"gpt-4.1-mini",
|
|
2422
|
+
"gpt-4.1-mini-2025-04-14",
|
|
2423
|
+
"gpt-4.1-nano",
|
|
2424
|
+
"gpt-4.1-nano-2025-04-14",
|
|
2425
|
+
"gpt-4o",
|
|
2426
|
+
"gpt-4o-2024-05-13",
|
|
2427
|
+
"gpt-4o-2024-08-06",
|
|
2428
|
+
"gpt-4o-2024-11-20",
|
|
2429
|
+
"gpt-4o-audio-preview",
|
|
2430
|
+
"gpt-4o-audio-preview-2024-10-01",
|
|
2431
|
+
"gpt-4o-audio-preview-2024-12-17",
|
|
2432
|
+
"gpt-4o-search-preview",
|
|
2433
|
+
"gpt-4o-search-preview-2025-03-11",
|
|
2434
|
+
"gpt-4o-mini-search-preview",
|
|
2435
|
+
"gpt-4o-mini-search-preview-2025-03-11",
|
|
2436
|
+
"gpt-4o-mini",
|
|
2437
|
+
"gpt-4o-mini-2024-07-18",
|
|
2438
|
+
"gpt-4-turbo",
|
|
2439
|
+
"gpt-4-turbo-2024-04-09",
|
|
2440
|
+
"gpt-4-turbo-preview",
|
|
2441
|
+
"gpt-4-0125-preview",
|
|
2442
|
+
"gpt-4-1106-preview",
|
|
2443
|
+
"gpt-4",
|
|
2444
|
+
"gpt-4-0613",
|
|
2445
|
+
"gpt-4.5-preview",
|
|
2446
|
+
"gpt-4.5-preview-2025-02-27",
|
|
2447
|
+
"gpt-3.5-turbo-0125",
|
|
2448
|
+
"gpt-3.5-turbo",
|
|
2449
|
+
"gpt-3.5-turbo-1106",
|
|
2450
|
+
"chatgpt-4o-latest",
|
|
2451
|
+
"gpt-5-chat-latest",
|
|
2452
|
+
...openaiResponsesReasoningModelIds
|
|
2453
|
+
];
|
|
2454
|
+
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils21.lazyValidator)(
|
|
2455
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2456
|
+
import_v416.z.object({
|
|
2457
|
+
conversation: import_v416.z.string().nullish(),
|
|
2458
|
+
include: import_v416.z.array(
|
|
2459
|
+
import_v416.z.enum([
|
|
2460
|
+
"reasoning.encrypted_content",
|
|
2461
|
+
// handled internally by default, only needed for unknown reasoning models
|
|
2462
|
+
"file_search_call.results",
|
|
2463
|
+
"message.output_text.logprobs"
|
|
2464
|
+
])
|
|
2465
|
+
).nullish(),
|
|
2466
|
+
instructions: import_v416.z.string().nullish(),
|
|
2467
|
+
/**
|
|
2468
|
+
* Return the log probabilities of the tokens.
|
|
2469
|
+
*
|
|
2470
|
+
* Setting to true will return the log probabilities of the tokens that
|
|
2471
|
+
* were generated.
|
|
2472
|
+
*
|
|
2473
|
+
* Setting to a number will return the log probabilities of the top n
|
|
2474
|
+
* tokens that were generated.
|
|
2475
|
+
*
|
|
2476
|
+
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
2477
|
+
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
2478
|
+
*/
|
|
2479
|
+
logprobs: import_v416.z.union([import_v416.z.boolean(), import_v416.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
2480
|
+
/**
|
|
2481
|
+
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
2482
|
+
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
2483
|
+
* Any further attempts to call a tool by the model will be ignored.
|
|
2484
|
+
*/
|
|
2485
|
+
maxToolCalls: import_v416.z.number().nullish(),
|
|
2486
|
+
metadata: import_v416.z.any().nullish(),
|
|
2487
|
+
parallelToolCalls: import_v416.z.boolean().nullish(),
|
|
2488
|
+
previousResponseId: import_v416.z.string().nullish(),
|
|
2489
|
+
promptCacheKey: import_v416.z.string().nullish(),
|
|
2490
|
+
/**
|
|
2491
|
+
* Prompt cache behavior for GPT-5.6 and later models.
|
|
2492
|
+
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
2493
|
+
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
2494
|
+
*/
|
|
2495
|
+
promptCacheOptions: import_v416.z.object({
|
|
2496
|
+
mode: import_v416.z.enum(["implicit", "explicit"]).optional(),
|
|
2497
|
+
ttl: import_v416.z.literal("30m").optional()
|
|
2498
|
+
}).optional(),
|
|
2499
|
+
/**
|
|
2500
|
+
* The retention policy for the prompt cache.
|
|
2501
|
+
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
2502
|
+
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
2503
|
+
* Available for models before GPT-5.6 that support extended caching.
|
|
2504
|
+
*
|
|
2505
|
+
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
2506
|
+
*
|
|
2507
|
+
* @default 'in_memory'
|
|
2508
|
+
*/
|
|
2509
|
+
promptCacheRetention: import_v416.z.enum(["in_memory", "24h"]).nullish(),
|
|
2510
|
+
/**
|
|
2511
|
+
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
2512
|
+
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
2513
|
+
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
2514
|
+
* Supported values vary by model.
|
|
2515
|
+
*/
|
|
2516
|
+
reasoningEffort: import_v416.z.string().nullish(),
|
|
2517
|
+
/**
|
|
2518
|
+
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
2519
|
+
* without changing the request-level reasoning effort. This preserves the
|
|
2520
|
+
* request prefix for prompt caching.
|
|
2521
|
+
*
|
|
2522
|
+
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
2523
|
+
* combined with automatic truncation.
|
|
2524
|
+
*/
|
|
2525
|
+
reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
2526
|
+
/**
|
|
2527
|
+
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
2528
|
+
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
2529
|
+
*/
|
|
2530
|
+
reasoningMode: import_v416.z.enum(["standard", "pro"]).optional(),
|
|
2531
|
+
/**
|
|
2532
|
+
* Controls which available reasoning items GPT-5.6 can use.
|
|
2533
|
+
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
2534
|
+
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
2535
|
+
*/
|
|
2536
|
+
reasoningContext: import_v416.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
2537
|
+
reasoningSummary: import_v416.z.string().nullish(),
|
|
2538
|
+
safetyIdentifier: import_v416.z.string().nullish(),
|
|
2539
|
+
serviceTier: import_v416.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
2540
|
+
store: import_v416.z.boolean().nullish(),
|
|
2541
|
+
strictJsonSchema: import_v416.z.boolean().nullish(),
|
|
2542
|
+
textVerbosity: import_v416.z.enum(["low", "medium", "high"]).nullish(),
|
|
2543
|
+
truncation: import_v416.z.enum(["auto", "disabled"]).nullish(),
|
|
2544
|
+
user: import_v416.z.string().nullish()
|
|
2545
|
+
})
|
|
2546
|
+
)
|
|
2547
|
+
);
|
|
2548
|
+
var openaiResponsesSystemMessageOptionsSchema = (0, import_provider_utils21.lazyValidator)(
|
|
2549
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
2550
|
+
import_v416.z.object({
|
|
2551
|
+
/**
|
|
2552
|
+
* Emit a configuration update at this position in Responses history.
|
|
2553
|
+
* Requires empty system message content and the same supported
|
|
2554
|
+
* configuration as the request-level reasoningEffortUpdate option.
|
|
2555
|
+
* Unsupported historical updates throw instead of being omitted.
|
|
2556
|
+
*
|
|
2557
|
+
* @see https://developers.openai.com/api/docs/guides/reasoning#change-reasoning-mid-conversation
|
|
2558
|
+
*/
|
|
2559
|
+
reasoningEffortUpdate: import_v416.z.enum(["low", "medium", "high", "xhigh", "max"]).optional()
|
|
2560
|
+
})
|
|
2561
|
+
)
|
|
2562
|
+
);
|
|
2563
|
+
|
|
2564
|
+
// src/responses/convert-to-openai-responses-input.ts
|
|
2359
2565
|
function getPromptCacheBreakpoint2(providerOptions) {
|
|
2360
2566
|
var _a2;
|
|
2361
2567
|
return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
|
|
@@ -2367,9 +2573,11 @@ function isFileId(data, prefixes) {
|
|
|
2367
2573
|
async function convertToOpenAIResponsesInput({
|
|
2368
2574
|
prompt,
|
|
2369
2575
|
systemMessageMode,
|
|
2576
|
+
providerOptionsName = "openai",
|
|
2370
2577
|
explicitMessageItemType = false,
|
|
2371
2578
|
fileIdPrefixes,
|
|
2372
2579
|
store,
|
|
2580
|
+
configurationUpdateUnsupportedReason,
|
|
2373
2581
|
hasLocalShellTool = false
|
|
2374
2582
|
}) {
|
|
2375
2583
|
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -2378,6 +2586,33 @@ async function convertToOpenAIResponsesInput({
|
|
|
2378
2586
|
for (const { role, content, providerOptions } of prompt) {
|
|
2379
2587
|
switch (role) {
|
|
2380
2588
|
case "system": {
|
|
2589
|
+
let options = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2590
|
+
provider: providerOptionsName,
|
|
2591
|
+
providerOptions,
|
|
2592
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2593
|
+
});
|
|
2594
|
+
if (options == null && providerOptionsName !== "openai") {
|
|
2595
|
+
options = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2596
|
+
provider: "openai",
|
|
2597
|
+
providerOptions,
|
|
2598
|
+
schema: openaiResponsesSystemMessageOptionsSchema
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
const effort = options == null ? void 0 : options.reasoningEffortUpdate;
|
|
2602
|
+
if (effort != null) {
|
|
2603
|
+
const unsupportedReason = content !== "" ? "Message-level reasoningEffortUpdate requires empty system message content." : configurationUpdateUnsupportedReason;
|
|
2604
|
+
if (unsupportedReason != null) {
|
|
2605
|
+
throw new import_provider6.UnsupportedFunctionalityError({
|
|
2606
|
+
functionality: "Message-level reasoningEffortUpdate",
|
|
2607
|
+
message: unsupportedReason
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
input.push({
|
|
2611
|
+
type: "configuration_update",
|
|
2612
|
+
reasoning: { effort }
|
|
2613
|
+
});
|
|
2614
|
+
break;
|
|
2615
|
+
}
|
|
2381
2616
|
switch (systemMessageMode) {
|
|
2382
2617
|
case "system": {
|
|
2383
2618
|
const promptCacheBreakpoint = getPromptCacheBreakpoint2(providerOptions);
|
|
@@ -2453,7 +2688,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2453
2688
|
return {
|
|
2454
2689
|
type: "input_image",
|
|
2455
2690
|
...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2456
|
-
image_url: `data:${mediaType};base64,${(0,
|
|
2691
|
+
image_url: `data:${mediaType};base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2457
2692
|
},
|
|
2458
2693
|
detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3.openai) == null ? void 0 : _b2.imageDetail,
|
|
2459
2694
|
...promptCacheBreakpoint != null && {
|
|
@@ -2474,7 +2709,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2474
2709
|
type: "input_file",
|
|
2475
2710
|
...typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
|
|
2476
2711
|
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
2477
|
-
file_data: `data:application/pdf;base64,${(0,
|
|
2712
|
+
file_data: `data:application/pdf;base64,${(0, import_provider_utils22.convertToBase64)(part.data)}`
|
|
2478
2713
|
},
|
|
2479
2714
|
...promptCacheBreakpoint != null && {
|
|
2480
2715
|
prompt_cache_breakpoint: promptCacheBreakpoint
|
|
@@ -2524,7 +2759,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2524
2759
|
break;
|
|
2525
2760
|
}
|
|
2526
2761
|
if (hasLocalShellTool && part.toolName === "local_shell") {
|
|
2527
|
-
const parsedInput = await (0,
|
|
2762
|
+
const parsedInput = await (0, import_provider_utils22.validateTypes)({
|
|
2528
2763
|
value: part.input,
|
|
2529
2764
|
schema: localShellInputSchema
|
|
2530
2765
|
});
|
|
@@ -2566,7 +2801,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2566
2801
|
break;
|
|
2567
2802
|
}
|
|
2568
2803
|
case "reasoning": {
|
|
2569
|
-
const providerOptions2 = await (0,
|
|
2804
|
+
const providerOptions2 = await (0, import_provider_utils22.parseProviderOptions)({
|
|
2570
2805
|
provider: "openai",
|
|
2571
2806
|
providerOptions: part.providerOptions,
|
|
2572
2807
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
@@ -2630,7 +2865,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2630
2865
|
part.providerOptions
|
|
2631
2866
|
);
|
|
2632
2867
|
if (hasLocalShellTool && part.toolName === "local_shell" && output.type === "json") {
|
|
2633
|
-
const parsedOutput = await (0,
|
|
2868
|
+
const parsedOutput = await (0, import_provider_utils22.validateTypes)({
|
|
2634
2869
|
value: output.value,
|
|
2635
2870
|
schema: localShellOutputSchema
|
|
2636
2871
|
});
|
|
@@ -2723,9 +2958,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2723
2958
|
}
|
|
2724
2959
|
return { input, warnings };
|
|
2725
2960
|
}
|
|
2726
|
-
var openaiResponsesReasoningProviderOptionsSchema =
|
|
2727
|
-
itemId:
|
|
2728
|
-
reasoningEncryptedContent:
|
|
2961
|
+
var openaiResponsesReasoningProviderOptionsSchema = import_v417.z.object({
|
|
2962
|
+
itemId: import_v417.z.string().nullish(),
|
|
2963
|
+
reasoningEncryptedContent: import_v417.z.string().nullish()
|
|
2729
2964
|
});
|
|
2730
2965
|
|
|
2731
2966
|
// src/responses/map-openai-responses-finish-reason.ts
|
|
@@ -2747,288 +2982,288 @@ function mapOpenAIResponseFinishReason({
|
|
|
2747
2982
|
}
|
|
2748
2983
|
|
|
2749
2984
|
// src/responses/openai-responses-api.ts
|
|
2750
|
-
var
|
|
2751
|
-
var
|
|
2752
|
-
var openaiResponsesChunkSchema = (0,
|
|
2753
|
-
() => (0,
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
type:
|
|
2757
|
-
item_id:
|
|
2758
|
-
delta:
|
|
2759
|
-
logprobs:
|
|
2760
|
-
|
|
2761
|
-
token:
|
|
2762
|
-
logprob:
|
|
2763
|
-
top_logprobs:
|
|
2764
|
-
|
|
2765
|
-
token:
|
|
2766
|
-
logprob:
|
|
2985
|
+
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
2986
|
+
var import_v418 = require("zod/v4");
|
|
2987
|
+
var openaiResponsesChunkSchema = (0, import_provider_utils23.lazyValidator)(
|
|
2988
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
2989
|
+
import_v418.z.union([
|
|
2990
|
+
import_v418.z.object({
|
|
2991
|
+
type: import_v418.z.literal("response.output_text.delta"),
|
|
2992
|
+
item_id: import_v418.z.string(),
|
|
2993
|
+
delta: import_v418.z.string(),
|
|
2994
|
+
logprobs: import_v418.z.array(
|
|
2995
|
+
import_v418.z.object({
|
|
2996
|
+
token: import_v418.z.string(),
|
|
2997
|
+
logprob: import_v418.z.number(),
|
|
2998
|
+
top_logprobs: import_v418.z.array(
|
|
2999
|
+
import_v418.z.object({
|
|
3000
|
+
token: import_v418.z.string(),
|
|
3001
|
+
logprob: import_v418.z.number()
|
|
2767
3002
|
})
|
|
2768
3003
|
)
|
|
2769
3004
|
})
|
|
2770
3005
|
).nullish()
|
|
2771
3006
|
}),
|
|
2772
|
-
|
|
2773
|
-
type:
|
|
2774
|
-
response:
|
|
2775
|
-
incomplete_details:
|
|
2776
|
-
usage:
|
|
2777
|
-
input_tokens:
|
|
2778
|
-
input_tokens_details:
|
|
2779
|
-
cached_tokens:
|
|
2780
|
-
cache_write_tokens:
|
|
2781
|
-
orchestration_input_tokens:
|
|
2782
|
-
orchestration_input_cached_tokens:
|
|
3007
|
+
import_v418.z.object({
|
|
3008
|
+
type: import_v418.z.enum(["response.completed", "response.incomplete"]),
|
|
3009
|
+
response: import_v418.z.object({
|
|
3010
|
+
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
3011
|
+
usage: import_v418.z.object({
|
|
3012
|
+
input_tokens: import_v418.z.number(),
|
|
3013
|
+
input_tokens_details: import_v418.z.object({
|
|
3014
|
+
cached_tokens: import_v418.z.number().nullish(),
|
|
3015
|
+
cache_write_tokens: import_v418.z.number().nullish(),
|
|
3016
|
+
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
3017
|
+
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
2783
3018
|
}).nullish(),
|
|
2784
|
-
output_tokens:
|
|
2785
|
-
output_tokens_details:
|
|
2786
|
-
reasoning_tokens:
|
|
2787
|
-
orchestration_output_tokens:
|
|
3019
|
+
output_tokens: import_v418.z.number(),
|
|
3020
|
+
output_tokens_details: import_v418.z.object({
|
|
3021
|
+
reasoning_tokens: import_v418.z.number().nullish(),
|
|
3022
|
+
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
2788
3023
|
}).nullish()
|
|
2789
3024
|
}),
|
|
2790
|
-
reasoning:
|
|
2791
|
-
context:
|
|
3025
|
+
reasoning: import_v418.z.object({
|
|
3026
|
+
context: import_v418.z.string().nullish()
|
|
2792
3027
|
}).nullish(),
|
|
2793
|
-
service_tier:
|
|
3028
|
+
service_tier: import_v418.z.string().nullish()
|
|
2794
3029
|
})
|
|
2795
3030
|
}),
|
|
2796
|
-
|
|
2797
|
-
type:
|
|
2798
|
-
response:
|
|
2799
|
-
id:
|
|
2800
|
-
created_at:
|
|
2801
|
-
model:
|
|
2802
|
-
service_tier:
|
|
3031
|
+
import_v418.z.object({
|
|
3032
|
+
type: import_v418.z.literal("response.created"),
|
|
3033
|
+
response: import_v418.z.object({
|
|
3034
|
+
id: import_v418.z.string(),
|
|
3035
|
+
created_at: import_v418.z.number(),
|
|
3036
|
+
model: import_v418.z.string(),
|
|
3037
|
+
service_tier: import_v418.z.string().nullish()
|
|
2803
3038
|
})
|
|
2804
3039
|
}),
|
|
2805
|
-
|
|
2806
|
-
type:
|
|
2807
|
-
output_index:
|
|
2808
|
-
item:
|
|
2809
|
-
|
|
2810
|
-
type:
|
|
2811
|
-
id:
|
|
2812
|
-
phase:
|
|
3040
|
+
import_v418.z.object({
|
|
3041
|
+
type: import_v418.z.literal("response.output_item.added"),
|
|
3042
|
+
output_index: import_v418.z.number(),
|
|
3043
|
+
item: import_v418.z.discriminatedUnion("type", [
|
|
3044
|
+
import_v418.z.object({
|
|
3045
|
+
type: import_v418.z.literal("message"),
|
|
3046
|
+
id: import_v418.z.string(),
|
|
3047
|
+
phase: import_v418.z.enum(["commentary", "final_answer"]).nullish()
|
|
2813
3048
|
}),
|
|
2814
|
-
|
|
2815
|
-
type:
|
|
2816
|
-
id:
|
|
2817
|
-
encrypted_content:
|
|
3049
|
+
import_v418.z.object({
|
|
3050
|
+
type: import_v418.z.literal("reasoning"),
|
|
3051
|
+
id: import_v418.z.string(),
|
|
3052
|
+
encrypted_content: import_v418.z.string().nullish()
|
|
2818
3053
|
}),
|
|
2819
|
-
|
|
2820
|
-
type:
|
|
2821
|
-
id:
|
|
2822
|
-
call_id:
|
|
2823
|
-
name:
|
|
2824
|
-
arguments:
|
|
2825
|
-
async:
|
|
3054
|
+
import_v418.z.object({
|
|
3055
|
+
type: import_v418.z.literal("function_call"),
|
|
3056
|
+
id: import_v418.z.string(),
|
|
3057
|
+
call_id: import_v418.z.string(),
|
|
3058
|
+
name: import_v418.z.string(),
|
|
3059
|
+
arguments: import_v418.z.string(),
|
|
3060
|
+
async: import_v418.z.boolean().nullish()
|
|
2826
3061
|
}),
|
|
2827
|
-
|
|
2828
|
-
type:
|
|
2829
|
-
id:
|
|
2830
|
-
status:
|
|
3062
|
+
import_v418.z.object({
|
|
3063
|
+
type: import_v418.z.literal("web_search_call"),
|
|
3064
|
+
id: import_v418.z.string(),
|
|
3065
|
+
status: import_v418.z.string()
|
|
2831
3066
|
}),
|
|
2832
|
-
|
|
2833
|
-
type:
|
|
2834
|
-
id:
|
|
2835
|
-
status:
|
|
3067
|
+
import_v418.z.object({
|
|
3068
|
+
type: import_v418.z.literal("computer_call"),
|
|
3069
|
+
id: import_v418.z.string(),
|
|
3070
|
+
status: import_v418.z.string()
|
|
2836
3071
|
}),
|
|
2837
|
-
|
|
2838
|
-
type:
|
|
2839
|
-
id:
|
|
3072
|
+
import_v418.z.object({
|
|
3073
|
+
type: import_v418.z.literal("file_search_call"),
|
|
3074
|
+
id: import_v418.z.string()
|
|
2840
3075
|
}),
|
|
2841
|
-
|
|
2842
|
-
type:
|
|
2843
|
-
id:
|
|
3076
|
+
import_v418.z.object({
|
|
3077
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
3078
|
+
id: import_v418.z.string()
|
|
2844
3079
|
}),
|
|
2845
|
-
|
|
2846
|
-
type:
|
|
2847
|
-
id:
|
|
2848
|
-
container_id:
|
|
2849
|
-
code:
|
|
2850
|
-
outputs:
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
3080
|
+
import_v418.z.object({
|
|
3081
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
3082
|
+
id: import_v418.z.string(),
|
|
3083
|
+
container_id: import_v418.z.string(),
|
|
3084
|
+
code: import_v418.z.string().nullable(),
|
|
3085
|
+
outputs: import_v418.z.array(
|
|
3086
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3087
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
3088
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2854
3089
|
])
|
|
2855
3090
|
).nullable(),
|
|
2856
|
-
status:
|
|
3091
|
+
status: import_v418.z.string()
|
|
2857
3092
|
})
|
|
2858
3093
|
])
|
|
2859
3094
|
}),
|
|
2860
|
-
|
|
2861
|
-
type:
|
|
2862
|
-
output_index:
|
|
2863
|
-
item:
|
|
2864
|
-
|
|
2865
|
-
type:
|
|
2866
|
-
id:
|
|
2867
|
-
phase:
|
|
3095
|
+
import_v418.z.object({
|
|
3096
|
+
type: import_v418.z.literal("response.output_item.done"),
|
|
3097
|
+
output_index: import_v418.z.number(),
|
|
3098
|
+
item: import_v418.z.discriminatedUnion("type", [
|
|
3099
|
+
import_v418.z.object({
|
|
3100
|
+
type: import_v418.z.literal("message"),
|
|
3101
|
+
id: import_v418.z.string(),
|
|
3102
|
+
phase: import_v418.z.enum(["commentary", "final_answer"]).nullish()
|
|
2868
3103
|
}),
|
|
2869
|
-
|
|
2870
|
-
type:
|
|
2871
|
-
id:
|
|
2872
|
-
encrypted_content:
|
|
3104
|
+
import_v418.z.object({
|
|
3105
|
+
type: import_v418.z.literal("reasoning"),
|
|
3106
|
+
id: import_v418.z.string(),
|
|
3107
|
+
encrypted_content: import_v418.z.string().nullish()
|
|
2873
3108
|
}),
|
|
2874
|
-
|
|
2875
|
-
type:
|
|
2876
|
-
id:
|
|
2877
|
-
call_id:
|
|
2878
|
-
name:
|
|
2879
|
-
arguments:
|
|
2880
|
-
async:
|
|
2881
|
-
status:
|
|
3109
|
+
import_v418.z.object({
|
|
3110
|
+
type: import_v418.z.literal("function_call"),
|
|
3111
|
+
id: import_v418.z.string(),
|
|
3112
|
+
call_id: import_v418.z.string(),
|
|
3113
|
+
name: import_v418.z.string(),
|
|
3114
|
+
arguments: import_v418.z.string(),
|
|
3115
|
+
async: import_v418.z.boolean().nullish(),
|
|
3116
|
+
status: import_v418.z.enum(["in_progress", "completed", "incomplete"])
|
|
2882
3117
|
}),
|
|
2883
|
-
|
|
2884
|
-
type:
|
|
2885
|
-
id:
|
|
2886
|
-
code:
|
|
2887
|
-
container_id:
|
|
2888
|
-
outputs:
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
3118
|
+
import_v418.z.object({
|
|
3119
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
3120
|
+
id: import_v418.z.string(),
|
|
3121
|
+
code: import_v418.z.string().nullable(),
|
|
3122
|
+
container_id: import_v418.z.string(),
|
|
3123
|
+
outputs: import_v418.z.array(
|
|
3124
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3125
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
3126
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
2892
3127
|
])
|
|
2893
3128
|
).nullable()
|
|
2894
3129
|
}),
|
|
2895
|
-
|
|
2896
|
-
type:
|
|
2897
|
-
id:
|
|
2898
|
-
result:
|
|
3130
|
+
import_v418.z.object({
|
|
3131
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
3132
|
+
id: import_v418.z.string(),
|
|
3133
|
+
result: import_v418.z.string()
|
|
2899
3134
|
}),
|
|
2900
|
-
|
|
2901
|
-
type:
|
|
2902
|
-
id:
|
|
2903
|
-
status:
|
|
2904
|
-
action:
|
|
2905
|
-
|
|
2906
|
-
type:
|
|
2907
|
-
query:
|
|
2908
|
-
sources:
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
3135
|
+
import_v418.z.object({
|
|
3136
|
+
type: import_v418.z.literal("web_search_call"),
|
|
3137
|
+
id: import_v418.z.string(),
|
|
3138
|
+
status: import_v418.z.string(),
|
|
3139
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
3140
|
+
import_v418.z.object({
|
|
3141
|
+
type: import_v418.z.literal("search"),
|
|
3142
|
+
query: import_v418.z.string().nullish(),
|
|
3143
|
+
sources: import_v418.z.array(
|
|
3144
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3145
|
+
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
3146
|
+
import_v418.z.object({ type: import_v418.z.literal("api"), name: import_v418.z.string() })
|
|
2912
3147
|
])
|
|
2913
3148
|
).nullish()
|
|
2914
3149
|
}),
|
|
2915
|
-
|
|
2916
|
-
type:
|
|
2917
|
-
url:
|
|
3150
|
+
import_v418.z.object({
|
|
3151
|
+
type: import_v418.z.literal("open_page"),
|
|
3152
|
+
url: import_v418.z.string().nullish()
|
|
2918
3153
|
}),
|
|
2919
|
-
|
|
2920
|
-
type:
|
|
2921
|
-
url:
|
|
2922
|
-
pattern:
|
|
3154
|
+
import_v418.z.object({
|
|
3155
|
+
type: import_v418.z.literal("find_in_page"),
|
|
3156
|
+
url: import_v418.z.string().nullish(),
|
|
3157
|
+
pattern: import_v418.z.string().nullish()
|
|
2923
3158
|
})
|
|
2924
3159
|
]).nullish()
|
|
2925
3160
|
}),
|
|
2926
|
-
|
|
2927
|
-
type:
|
|
2928
|
-
id:
|
|
2929
|
-
queries:
|
|
2930
|
-
results:
|
|
2931
|
-
|
|
2932
|
-
attributes:
|
|
2933
|
-
file_id:
|
|
2934
|
-
filename:
|
|
2935
|
-
score:
|
|
2936
|
-
text:
|
|
3161
|
+
import_v418.z.object({
|
|
3162
|
+
type: import_v418.z.literal("file_search_call"),
|
|
3163
|
+
id: import_v418.z.string(),
|
|
3164
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
3165
|
+
results: import_v418.z.array(
|
|
3166
|
+
import_v418.z.object({
|
|
3167
|
+
attributes: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()),
|
|
3168
|
+
file_id: import_v418.z.string(),
|
|
3169
|
+
filename: import_v418.z.string(),
|
|
3170
|
+
score: import_v418.z.number(),
|
|
3171
|
+
text: import_v418.z.string()
|
|
2937
3172
|
})
|
|
2938
3173
|
).nullish()
|
|
2939
3174
|
}),
|
|
2940
|
-
|
|
2941
|
-
type:
|
|
2942
|
-
id:
|
|
2943
|
-
call_id:
|
|
2944
|
-
action:
|
|
2945
|
-
type:
|
|
2946
|
-
command:
|
|
2947
|
-
timeout_ms:
|
|
2948
|
-
user:
|
|
2949
|
-
working_directory:
|
|
2950
|
-
env:
|
|
3175
|
+
import_v418.z.object({
|
|
3176
|
+
type: import_v418.z.literal("local_shell_call"),
|
|
3177
|
+
id: import_v418.z.string(),
|
|
3178
|
+
call_id: import_v418.z.string(),
|
|
3179
|
+
action: import_v418.z.object({
|
|
3180
|
+
type: import_v418.z.literal("exec"),
|
|
3181
|
+
command: import_v418.z.array(import_v418.z.string()),
|
|
3182
|
+
timeout_ms: import_v418.z.number().optional(),
|
|
3183
|
+
user: import_v418.z.string().optional(),
|
|
3184
|
+
working_directory: import_v418.z.string().optional(),
|
|
3185
|
+
env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
|
|
2951
3186
|
})
|
|
2952
3187
|
}),
|
|
2953
|
-
|
|
2954
|
-
type:
|
|
2955
|
-
id:
|
|
2956
|
-
status:
|
|
3188
|
+
import_v418.z.object({
|
|
3189
|
+
type: import_v418.z.literal("computer_call"),
|
|
3190
|
+
id: import_v418.z.string(),
|
|
3191
|
+
status: import_v418.z.literal("completed")
|
|
2957
3192
|
})
|
|
2958
3193
|
])
|
|
2959
3194
|
}),
|
|
2960
|
-
|
|
2961
|
-
type:
|
|
2962
|
-
item_id:
|
|
2963
|
-
output_index:
|
|
2964
|
-
delta:
|
|
3195
|
+
import_v418.z.object({
|
|
3196
|
+
type: import_v418.z.literal("response.function_call_arguments.delta"),
|
|
3197
|
+
item_id: import_v418.z.string(),
|
|
3198
|
+
output_index: import_v418.z.number(),
|
|
3199
|
+
delta: import_v418.z.string()
|
|
2965
3200
|
}),
|
|
2966
|
-
|
|
2967
|
-
type:
|
|
2968
|
-
item_id:
|
|
2969
|
-
output_index:
|
|
2970
|
-
partial_image_b64:
|
|
3201
|
+
import_v418.z.object({
|
|
3202
|
+
type: import_v418.z.literal("response.image_generation_call.partial_image"),
|
|
3203
|
+
item_id: import_v418.z.string(),
|
|
3204
|
+
output_index: import_v418.z.number(),
|
|
3205
|
+
partial_image_b64: import_v418.z.string()
|
|
2971
3206
|
}),
|
|
2972
|
-
|
|
2973
|
-
type:
|
|
2974
|
-
item_id:
|
|
2975
|
-
output_index:
|
|
2976
|
-
delta:
|
|
3207
|
+
import_v418.z.object({
|
|
3208
|
+
type: import_v418.z.literal("response.code_interpreter_call_code.delta"),
|
|
3209
|
+
item_id: import_v418.z.string(),
|
|
3210
|
+
output_index: import_v418.z.number(),
|
|
3211
|
+
delta: import_v418.z.string()
|
|
2977
3212
|
}),
|
|
2978
|
-
|
|
2979
|
-
type:
|
|
2980
|
-
item_id:
|
|
2981
|
-
output_index:
|
|
2982
|
-
code:
|
|
3213
|
+
import_v418.z.object({
|
|
3214
|
+
type: import_v418.z.literal("response.code_interpreter_call_code.done"),
|
|
3215
|
+
item_id: import_v418.z.string(),
|
|
3216
|
+
output_index: import_v418.z.number(),
|
|
3217
|
+
code: import_v418.z.string()
|
|
2983
3218
|
}),
|
|
2984
|
-
|
|
2985
|
-
type:
|
|
2986
|
-
annotation:
|
|
2987
|
-
|
|
2988
|
-
type:
|
|
2989
|
-
start_index:
|
|
2990
|
-
end_index:
|
|
2991
|
-
url:
|
|
2992
|
-
title:
|
|
3219
|
+
import_v418.z.object({
|
|
3220
|
+
type: import_v418.z.literal("response.output_text.annotation.added"),
|
|
3221
|
+
annotation: import_v418.z.discriminatedUnion("type", [
|
|
3222
|
+
import_v418.z.object({
|
|
3223
|
+
type: import_v418.z.literal("url_citation"),
|
|
3224
|
+
start_index: import_v418.z.number(),
|
|
3225
|
+
end_index: import_v418.z.number(),
|
|
3226
|
+
url: import_v418.z.string(),
|
|
3227
|
+
title: import_v418.z.string()
|
|
2993
3228
|
}),
|
|
2994
|
-
|
|
2995
|
-
type:
|
|
2996
|
-
file_id:
|
|
2997
|
-
filename:
|
|
2998
|
-
index:
|
|
2999
|
-
start_index:
|
|
3000
|
-
end_index:
|
|
3001
|
-
quote:
|
|
3229
|
+
import_v418.z.object({
|
|
3230
|
+
type: import_v418.z.literal("file_citation"),
|
|
3231
|
+
file_id: import_v418.z.string(),
|
|
3232
|
+
filename: import_v418.z.string().nullish(),
|
|
3233
|
+
index: import_v418.z.number().nullish(),
|
|
3234
|
+
start_index: import_v418.z.number().nullish(),
|
|
3235
|
+
end_index: import_v418.z.number().nullish(),
|
|
3236
|
+
quote: import_v418.z.string().nullish()
|
|
3002
3237
|
})
|
|
3003
3238
|
])
|
|
3004
3239
|
}),
|
|
3005
|
-
|
|
3006
|
-
type:
|
|
3007
|
-
item_id:
|
|
3008
|
-
summary_index:
|
|
3240
|
+
import_v418.z.object({
|
|
3241
|
+
type: import_v418.z.literal("response.reasoning_summary_part.added"),
|
|
3242
|
+
item_id: import_v418.z.string(),
|
|
3243
|
+
summary_index: import_v418.z.number()
|
|
3009
3244
|
}),
|
|
3010
|
-
|
|
3011
|
-
type:
|
|
3012
|
-
item_id:
|
|
3013
|
-
summary_index:
|
|
3014
|
-
delta:
|
|
3245
|
+
import_v418.z.object({
|
|
3246
|
+
type: import_v418.z.literal("response.reasoning_summary_text.delta"),
|
|
3247
|
+
item_id: import_v418.z.string(),
|
|
3248
|
+
summary_index: import_v418.z.number(),
|
|
3249
|
+
delta: import_v418.z.string()
|
|
3015
3250
|
}),
|
|
3016
|
-
|
|
3017
|
-
type:
|
|
3018
|
-
item_id:
|
|
3019
|
-
summary_index:
|
|
3251
|
+
import_v418.z.object({
|
|
3252
|
+
type: import_v418.z.literal("response.reasoning_summary_part.done"),
|
|
3253
|
+
item_id: import_v418.z.string(),
|
|
3254
|
+
summary_index: import_v418.z.number()
|
|
3020
3255
|
}),
|
|
3021
|
-
|
|
3022
|
-
type:
|
|
3023
|
-
sequence_number:
|
|
3024
|
-
error:
|
|
3025
|
-
type:
|
|
3026
|
-
code:
|
|
3027
|
-
message:
|
|
3028
|
-
param:
|
|
3256
|
+
import_v418.z.object({
|
|
3257
|
+
type: import_v418.z.literal("error"),
|
|
3258
|
+
sequence_number: import_v418.z.number(),
|
|
3259
|
+
error: import_v418.z.object({
|
|
3260
|
+
type: import_v418.z.string(),
|
|
3261
|
+
code: import_v418.z.string(),
|
|
3262
|
+
message: import_v418.z.string(),
|
|
3263
|
+
param: import_v418.z.string().nullish()
|
|
3029
3264
|
})
|
|
3030
3265
|
}),
|
|
3031
|
-
|
|
3266
|
+
import_v418.z.object({ type: import_v418.z.string() }).loose().transform((value) => ({
|
|
3032
3267
|
type: "unknown_chunk",
|
|
3033
3268
|
message: value.type
|
|
3034
3269
|
}))
|
|
@@ -3036,389 +3271,203 @@ var openaiResponsesChunkSchema = (0, import_provider_utils22.lazyValidator)(
|
|
|
3036
3271
|
])
|
|
3037
3272
|
)
|
|
3038
3273
|
);
|
|
3039
|
-
var openaiResponsesResponseSchema = (0,
|
|
3040
|
-
() => (0,
|
|
3041
|
-
|
|
3042
|
-
id:
|
|
3043
|
-
created_at:
|
|
3044
|
-
error:
|
|
3045
|
-
message:
|
|
3046
|
-
type:
|
|
3047
|
-
param:
|
|
3048
|
-
code:
|
|
3274
|
+
var openaiResponsesResponseSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3275
|
+
() => (0, import_provider_utils23.zodSchema)(
|
|
3276
|
+
import_v418.z.object({
|
|
3277
|
+
id: import_v418.z.string().optional(),
|
|
3278
|
+
created_at: import_v418.z.number().optional(),
|
|
3279
|
+
error: import_v418.z.object({
|
|
3280
|
+
message: import_v418.z.string(),
|
|
3281
|
+
type: import_v418.z.string(),
|
|
3282
|
+
param: import_v418.z.string().nullish(),
|
|
3283
|
+
code: import_v418.z.string()
|
|
3049
3284
|
}).nullish(),
|
|
3050
|
-
model:
|
|
3051
|
-
output:
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
type:
|
|
3055
|
-
role:
|
|
3056
|
-
id:
|
|
3057
|
-
phase:
|
|
3058
|
-
content:
|
|
3059
|
-
|
|
3060
|
-
type:
|
|
3061
|
-
text:
|
|
3062
|
-
logprobs:
|
|
3063
|
-
|
|
3064
|
-
token:
|
|
3065
|
-
logprob:
|
|
3066
|
-
top_logprobs:
|
|
3067
|
-
|
|
3068
|
-
token:
|
|
3069
|
-
logprob:
|
|
3285
|
+
model: import_v418.z.string().optional(),
|
|
3286
|
+
output: import_v418.z.array(
|
|
3287
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3288
|
+
import_v418.z.object({
|
|
3289
|
+
type: import_v418.z.literal("message"),
|
|
3290
|
+
role: import_v418.z.literal("assistant"),
|
|
3291
|
+
id: import_v418.z.string(),
|
|
3292
|
+
phase: import_v418.z.enum(["commentary", "final_answer"]).nullish(),
|
|
3293
|
+
content: import_v418.z.array(
|
|
3294
|
+
import_v418.z.object({
|
|
3295
|
+
type: import_v418.z.literal("output_text"),
|
|
3296
|
+
text: import_v418.z.string(),
|
|
3297
|
+
logprobs: import_v418.z.array(
|
|
3298
|
+
import_v418.z.object({
|
|
3299
|
+
token: import_v418.z.string(),
|
|
3300
|
+
logprob: import_v418.z.number(),
|
|
3301
|
+
top_logprobs: import_v418.z.array(
|
|
3302
|
+
import_v418.z.object({
|
|
3303
|
+
token: import_v418.z.string(),
|
|
3304
|
+
logprob: import_v418.z.number()
|
|
3070
3305
|
})
|
|
3071
3306
|
)
|
|
3072
3307
|
})
|
|
3073
3308
|
).nullish(),
|
|
3074
|
-
annotations:
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
type:
|
|
3078
|
-
start_index:
|
|
3079
|
-
end_index:
|
|
3080
|
-
url:
|
|
3081
|
-
title:
|
|
3309
|
+
annotations: import_v418.z.array(
|
|
3310
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3311
|
+
import_v418.z.object({
|
|
3312
|
+
type: import_v418.z.literal("url_citation"),
|
|
3313
|
+
start_index: import_v418.z.number(),
|
|
3314
|
+
end_index: import_v418.z.number(),
|
|
3315
|
+
url: import_v418.z.string(),
|
|
3316
|
+
title: import_v418.z.string()
|
|
3082
3317
|
}),
|
|
3083
|
-
|
|
3084
|
-
type:
|
|
3085
|
-
file_id:
|
|
3086
|
-
filename:
|
|
3087
|
-
index:
|
|
3088
|
-
start_index:
|
|
3089
|
-
end_index:
|
|
3090
|
-
quote:
|
|
3318
|
+
import_v418.z.object({
|
|
3319
|
+
type: import_v418.z.literal("file_citation"),
|
|
3320
|
+
file_id: import_v418.z.string(),
|
|
3321
|
+
filename: import_v418.z.string().nullish(),
|
|
3322
|
+
index: import_v418.z.number().nullish(),
|
|
3323
|
+
start_index: import_v418.z.number().nullish(),
|
|
3324
|
+
end_index: import_v418.z.number().nullish(),
|
|
3325
|
+
quote: import_v418.z.string().nullish()
|
|
3091
3326
|
}),
|
|
3092
|
-
|
|
3093
|
-
type:
|
|
3094
|
-
container_id:
|
|
3095
|
-
file_id:
|
|
3096
|
-
filename:
|
|
3097
|
-
start_index:
|
|
3098
|
-
end_index:
|
|
3099
|
-
index:
|
|
3327
|
+
import_v418.z.object({
|
|
3328
|
+
type: import_v418.z.literal("container_file_citation"),
|
|
3329
|
+
container_id: import_v418.z.string(),
|
|
3330
|
+
file_id: import_v418.z.string(),
|
|
3331
|
+
filename: import_v418.z.string().nullish(),
|
|
3332
|
+
start_index: import_v418.z.number().nullish(),
|
|
3333
|
+
end_index: import_v418.z.number().nullish(),
|
|
3334
|
+
index: import_v418.z.number().nullish()
|
|
3100
3335
|
}),
|
|
3101
|
-
|
|
3102
|
-
type:
|
|
3103
|
-
file_id:
|
|
3104
|
-
index:
|
|
3336
|
+
import_v418.z.object({
|
|
3337
|
+
type: import_v418.z.literal("file_path"),
|
|
3338
|
+
file_id: import_v418.z.string(),
|
|
3339
|
+
index: import_v418.z.number().nullish()
|
|
3105
3340
|
})
|
|
3106
3341
|
])
|
|
3107
3342
|
)
|
|
3108
3343
|
})
|
|
3109
3344
|
)
|
|
3110
3345
|
}),
|
|
3111
|
-
|
|
3112
|
-
type:
|
|
3113
|
-
id:
|
|
3114
|
-
status:
|
|
3115
|
-
action:
|
|
3116
|
-
|
|
3117
|
-
type:
|
|
3118
|
-
query:
|
|
3119
|
-
sources:
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
type:
|
|
3124
|
-
name:
|
|
3346
|
+
import_v418.z.object({
|
|
3347
|
+
type: import_v418.z.literal("web_search_call"),
|
|
3348
|
+
id: import_v418.z.string(),
|
|
3349
|
+
status: import_v418.z.string(),
|
|
3350
|
+
action: import_v418.z.discriminatedUnion("type", [
|
|
3351
|
+
import_v418.z.object({
|
|
3352
|
+
type: import_v418.z.literal("search"),
|
|
3353
|
+
query: import_v418.z.string().nullish(),
|
|
3354
|
+
sources: import_v418.z.array(
|
|
3355
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3356
|
+
import_v418.z.object({ type: import_v418.z.literal("url"), url: import_v418.z.string() }),
|
|
3357
|
+
import_v418.z.object({
|
|
3358
|
+
type: import_v418.z.literal("api"),
|
|
3359
|
+
name: import_v418.z.string()
|
|
3125
3360
|
})
|
|
3126
3361
|
])
|
|
3127
3362
|
).nullish()
|
|
3128
3363
|
}),
|
|
3129
|
-
|
|
3130
|
-
type:
|
|
3131
|
-
url:
|
|
3364
|
+
import_v418.z.object({
|
|
3365
|
+
type: import_v418.z.literal("open_page"),
|
|
3366
|
+
url: import_v418.z.string().nullish()
|
|
3132
3367
|
}),
|
|
3133
|
-
|
|
3134
|
-
type:
|
|
3135
|
-
url:
|
|
3136
|
-
pattern:
|
|
3368
|
+
import_v418.z.object({
|
|
3369
|
+
type: import_v418.z.literal("find_in_page"),
|
|
3370
|
+
url: import_v418.z.string().nullish(),
|
|
3371
|
+
pattern: import_v418.z.string().nullish()
|
|
3137
3372
|
})
|
|
3138
3373
|
]).nullish()
|
|
3139
3374
|
}),
|
|
3140
|
-
|
|
3141
|
-
type:
|
|
3142
|
-
id:
|
|
3143
|
-
queries:
|
|
3144
|
-
results:
|
|
3145
|
-
|
|
3146
|
-
attributes:
|
|
3147
|
-
|
|
3148
|
-
|
|
3375
|
+
import_v418.z.object({
|
|
3376
|
+
type: import_v418.z.literal("file_search_call"),
|
|
3377
|
+
id: import_v418.z.string(),
|
|
3378
|
+
queries: import_v418.z.array(import_v418.z.string()),
|
|
3379
|
+
results: import_v418.z.array(
|
|
3380
|
+
import_v418.z.object({
|
|
3381
|
+
attributes: import_v418.z.record(
|
|
3382
|
+
import_v418.z.string(),
|
|
3383
|
+
import_v418.z.union([import_v418.z.string(), import_v418.z.number(), import_v418.z.boolean()])
|
|
3149
3384
|
),
|
|
3150
|
-
file_id:
|
|
3151
|
-
filename:
|
|
3152
|
-
score:
|
|
3153
|
-
text:
|
|
3385
|
+
file_id: import_v418.z.string(),
|
|
3386
|
+
filename: import_v418.z.string(),
|
|
3387
|
+
score: import_v418.z.number(),
|
|
3388
|
+
text: import_v418.z.string()
|
|
3154
3389
|
})
|
|
3155
3390
|
).nullish()
|
|
3156
3391
|
}),
|
|
3157
|
-
|
|
3158
|
-
type:
|
|
3159
|
-
id:
|
|
3160
|
-
code:
|
|
3161
|
-
container_id:
|
|
3162
|
-
outputs:
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3392
|
+
import_v418.z.object({
|
|
3393
|
+
type: import_v418.z.literal("code_interpreter_call"),
|
|
3394
|
+
id: import_v418.z.string(),
|
|
3395
|
+
code: import_v418.z.string().nullable(),
|
|
3396
|
+
container_id: import_v418.z.string(),
|
|
3397
|
+
outputs: import_v418.z.array(
|
|
3398
|
+
import_v418.z.discriminatedUnion("type", [
|
|
3399
|
+
import_v418.z.object({ type: import_v418.z.literal("logs"), logs: import_v418.z.string() }),
|
|
3400
|
+
import_v418.z.object({ type: import_v418.z.literal("image"), url: import_v418.z.string() })
|
|
3166
3401
|
])
|
|
3167
3402
|
).nullable()
|
|
3168
3403
|
}),
|
|
3169
|
-
|
|
3170
|
-
type:
|
|
3171
|
-
id:
|
|
3172
|
-
result:
|
|
3404
|
+
import_v418.z.object({
|
|
3405
|
+
type: import_v418.z.literal("image_generation_call"),
|
|
3406
|
+
id: import_v418.z.string(),
|
|
3407
|
+
result: import_v418.z.string()
|
|
3173
3408
|
}),
|
|
3174
|
-
|
|
3175
|
-
type:
|
|
3176
|
-
id:
|
|
3177
|
-
call_id:
|
|
3178
|
-
action:
|
|
3179
|
-
type:
|
|
3180
|
-
command:
|
|
3181
|
-
timeout_ms:
|
|
3182
|
-
user:
|
|
3183
|
-
working_directory:
|
|
3184
|
-
env:
|
|
3409
|
+
import_v418.z.object({
|
|
3410
|
+
type: import_v418.z.literal("local_shell_call"),
|
|
3411
|
+
id: import_v418.z.string(),
|
|
3412
|
+
call_id: import_v418.z.string(),
|
|
3413
|
+
action: import_v418.z.object({
|
|
3414
|
+
type: import_v418.z.literal("exec"),
|
|
3415
|
+
command: import_v418.z.array(import_v418.z.string()),
|
|
3416
|
+
timeout_ms: import_v418.z.number().optional(),
|
|
3417
|
+
user: import_v418.z.string().optional(),
|
|
3418
|
+
working_directory: import_v418.z.string().optional(),
|
|
3419
|
+
env: import_v418.z.record(import_v418.z.string(), import_v418.z.string()).optional()
|
|
3185
3420
|
})
|
|
3186
3421
|
}),
|
|
3187
|
-
|
|
3188
|
-
type:
|
|
3189
|
-
call_id:
|
|
3190
|
-
name:
|
|
3191
|
-
arguments:
|
|
3192
|
-
id:
|
|
3193
|
-
async:
|
|
3422
|
+
import_v418.z.object({
|
|
3423
|
+
type: import_v418.z.literal("function_call"),
|
|
3424
|
+
call_id: import_v418.z.string(),
|
|
3425
|
+
name: import_v418.z.string(),
|
|
3426
|
+
arguments: import_v418.z.string(),
|
|
3427
|
+
id: import_v418.z.string(),
|
|
3428
|
+
async: import_v418.z.boolean().nullish()
|
|
3194
3429
|
}),
|
|
3195
|
-
|
|
3196
|
-
type:
|
|
3197
|
-
id:
|
|
3198
|
-
status:
|
|
3430
|
+
import_v418.z.object({
|
|
3431
|
+
type: import_v418.z.literal("computer_call"),
|
|
3432
|
+
id: import_v418.z.string(),
|
|
3433
|
+
status: import_v418.z.string().optional()
|
|
3199
3434
|
}),
|
|
3200
|
-
|
|
3201
|
-
type:
|
|
3202
|
-
id:
|
|
3203
|
-
encrypted_content:
|
|
3204
|
-
summary:
|
|
3205
|
-
|
|
3206
|
-
type:
|
|
3207
|
-
text:
|
|
3435
|
+
import_v418.z.object({
|
|
3436
|
+
type: import_v418.z.literal("reasoning"),
|
|
3437
|
+
id: import_v418.z.string(),
|
|
3438
|
+
encrypted_content: import_v418.z.string().nullish(),
|
|
3439
|
+
summary: import_v418.z.array(
|
|
3440
|
+
import_v418.z.object({
|
|
3441
|
+
type: import_v418.z.literal("summary_text"),
|
|
3442
|
+
text: import_v418.z.string()
|
|
3208
3443
|
})
|
|
3209
3444
|
)
|
|
3210
3445
|
})
|
|
3211
3446
|
])
|
|
3212
3447
|
).optional(),
|
|
3213
|
-
service_tier:
|
|
3214
|
-
reasoning:
|
|
3215
|
-
context:
|
|
3448
|
+
service_tier: import_v418.z.string().nullish(),
|
|
3449
|
+
reasoning: import_v418.z.object({
|
|
3450
|
+
context: import_v418.z.string().nullish()
|
|
3216
3451
|
}).nullish(),
|
|
3217
|
-
incomplete_details:
|
|
3218
|
-
usage:
|
|
3219
|
-
input_tokens:
|
|
3220
|
-
input_tokens_details:
|
|
3221
|
-
cached_tokens:
|
|
3222
|
-
cache_write_tokens:
|
|
3223
|
-
orchestration_input_tokens:
|
|
3224
|
-
orchestration_input_cached_tokens:
|
|
3452
|
+
incomplete_details: import_v418.z.object({ reason: import_v418.z.string() }).nullish(),
|
|
3453
|
+
usage: import_v418.z.object({
|
|
3454
|
+
input_tokens: import_v418.z.number(),
|
|
3455
|
+
input_tokens_details: import_v418.z.object({
|
|
3456
|
+
cached_tokens: import_v418.z.number().nullish(),
|
|
3457
|
+
cache_write_tokens: import_v418.z.number().nullish(),
|
|
3458
|
+
orchestration_input_tokens: import_v418.z.number().nullish(),
|
|
3459
|
+
orchestration_input_cached_tokens: import_v418.z.number().nullish()
|
|
3225
3460
|
}).nullish(),
|
|
3226
|
-
output_tokens:
|
|
3227
|
-
output_tokens_details:
|
|
3228
|
-
reasoning_tokens:
|
|
3229
|
-
orchestration_output_tokens:
|
|
3461
|
+
output_tokens: import_v418.z.number(),
|
|
3462
|
+
output_tokens_details: import_v418.z.object({
|
|
3463
|
+
reasoning_tokens: import_v418.z.number().nullish(),
|
|
3464
|
+
orchestration_output_tokens: import_v418.z.number().nullish()
|
|
3230
3465
|
}).nullish()
|
|
3231
3466
|
}).optional()
|
|
3232
3467
|
})
|
|
3233
3468
|
)
|
|
3234
3469
|
);
|
|
3235
3470
|
|
|
3236
|
-
// src/responses/openai-responses-options.ts
|
|
3237
|
-
var import_provider_utils23 = require("@ai-sdk/provider-utils");
|
|
3238
|
-
var import_v418 = require("zod/v4");
|
|
3239
|
-
var TOP_LOGPROBS_MAX = 20;
|
|
3240
|
-
var openaiResponsesReasoningModelIds = [
|
|
3241
|
-
"o1",
|
|
3242
|
-
"o1-2024-12-17",
|
|
3243
|
-
"o3",
|
|
3244
|
-
"o3-2025-04-16",
|
|
3245
|
-
"o3-deep-research",
|
|
3246
|
-
"o3-deep-research-2025-06-26",
|
|
3247
|
-
"o3-mini",
|
|
3248
|
-
"o3-mini-2025-01-31",
|
|
3249
|
-
"o4-mini",
|
|
3250
|
-
"o4-mini-2025-04-16",
|
|
3251
|
-
"o4-mini-deep-research",
|
|
3252
|
-
"o4-mini-deep-research-2025-06-26",
|
|
3253
|
-
"codex-mini-latest",
|
|
3254
|
-
"computer-use-preview",
|
|
3255
|
-
"gpt-5",
|
|
3256
|
-
"gpt-5-2025-08-07",
|
|
3257
|
-
"gpt-5-codex",
|
|
3258
|
-
"gpt-5-mini",
|
|
3259
|
-
"gpt-5-mini-2025-08-07",
|
|
3260
|
-
"gpt-5-nano",
|
|
3261
|
-
"gpt-5-nano-2025-08-07",
|
|
3262
|
-
"gpt-5-pro",
|
|
3263
|
-
"gpt-5-pro-2025-10-06",
|
|
3264
|
-
"gpt-5.1",
|
|
3265
|
-
"gpt-5.1-chat-latest",
|
|
3266
|
-
"gpt-5.1-codex-mini",
|
|
3267
|
-
"gpt-5.1-codex",
|
|
3268
|
-
"gpt-5.1-codex-max",
|
|
3269
|
-
"gpt-5.2",
|
|
3270
|
-
"gpt-5.2-chat-latest",
|
|
3271
|
-
"gpt-5.2-pro",
|
|
3272
|
-
"gpt-5.2-codex",
|
|
3273
|
-
"gpt-5.3-chat-latest",
|
|
3274
|
-
"gpt-5.3-codex",
|
|
3275
|
-
"gpt-5.4",
|
|
3276
|
-
"gpt-5.4-2026-03-05",
|
|
3277
|
-
"gpt-5.4-mini",
|
|
3278
|
-
"gpt-5.4-mini-2026-03-17",
|
|
3279
|
-
"gpt-5.4-nano",
|
|
3280
|
-
"gpt-5.4-nano-2026-03-17",
|
|
3281
|
-
"gpt-5.4-pro",
|
|
3282
|
-
"gpt-5.4-pro-2026-03-05",
|
|
3283
|
-
"gpt-5.6",
|
|
3284
|
-
"gpt-5.6-luna",
|
|
3285
|
-
"gpt-5.6-sol",
|
|
3286
|
-
"gpt-5.6-terra",
|
|
3287
|
-
"gpt-6-astra",
|
|
3288
|
-
"gpt-6-luna",
|
|
3289
|
-
"gpt-6-sol"
|
|
3290
|
-
];
|
|
3291
|
-
var openaiResponsesModelIds = [
|
|
3292
|
-
"gpt-4.1",
|
|
3293
|
-
"gpt-4.1-2025-04-14",
|
|
3294
|
-
"gpt-4.1-mini",
|
|
3295
|
-
"gpt-4.1-mini-2025-04-14",
|
|
3296
|
-
"gpt-4.1-nano",
|
|
3297
|
-
"gpt-4.1-nano-2025-04-14",
|
|
3298
|
-
"gpt-4o",
|
|
3299
|
-
"gpt-4o-2024-05-13",
|
|
3300
|
-
"gpt-4o-2024-08-06",
|
|
3301
|
-
"gpt-4o-2024-11-20",
|
|
3302
|
-
"gpt-4o-audio-preview",
|
|
3303
|
-
"gpt-4o-audio-preview-2024-10-01",
|
|
3304
|
-
"gpt-4o-audio-preview-2024-12-17",
|
|
3305
|
-
"gpt-4o-search-preview",
|
|
3306
|
-
"gpt-4o-search-preview-2025-03-11",
|
|
3307
|
-
"gpt-4o-mini-search-preview",
|
|
3308
|
-
"gpt-4o-mini-search-preview-2025-03-11",
|
|
3309
|
-
"gpt-4o-mini",
|
|
3310
|
-
"gpt-4o-mini-2024-07-18",
|
|
3311
|
-
"gpt-4-turbo",
|
|
3312
|
-
"gpt-4-turbo-2024-04-09",
|
|
3313
|
-
"gpt-4-turbo-preview",
|
|
3314
|
-
"gpt-4-0125-preview",
|
|
3315
|
-
"gpt-4-1106-preview",
|
|
3316
|
-
"gpt-4",
|
|
3317
|
-
"gpt-4-0613",
|
|
3318
|
-
"gpt-4.5-preview",
|
|
3319
|
-
"gpt-4.5-preview-2025-02-27",
|
|
3320
|
-
"gpt-3.5-turbo-0125",
|
|
3321
|
-
"gpt-3.5-turbo",
|
|
3322
|
-
"gpt-3.5-turbo-1106",
|
|
3323
|
-
"chatgpt-4o-latest",
|
|
3324
|
-
"gpt-5-chat-latest",
|
|
3325
|
-
...openaiResponsesReasoningModelIds
|
|
3326
|
-
];
|
|
3327
|
-
var openaiResponsesProviderOptionsSchema = (0, import_provider_utils23.lazyValidator)(
|
|
3328
|
-
() => (0, import_provider_utils23.zodSchema)(
|
|
3329
|
-
import_v418.z.object({
|
|
3330
|
-
conversation: import_v418.z.string().nullish(),
|
|
3331
|
-
include: import_v418.z.array(
|
|
3332
|
-
import_v418.z.enum([
|
|
3333
|
-
"reasoning.encrypted_content",
|
|
3334
|
-
// handled internally by default, only needed for unknown reasoning models
|
|
3335
|
-
"file_search_call.results",
|
|
3336
|
-
"message.output_text.logprobs"
|
|
3337
|
-
])
|
|
3338
|
-
).nullish(),
|
|
3339
|
-
instructions: import_v418.z.string().nullish(),
|
|
3340
|
-
/**
|
|
3341
|
-
* Return the log probabilities of the tokens.
|
|
3342
|
-
*
|
|
3343
|
-
* Setting to true will return the log probabilities of the tokens that
|
|
3344
|
-
* were generated.
|
|
3345
|
-
*
|
|
3346
|
-
* Setting to a number will return the log probabilities of the top n
|
|
3347
|
-
* tokens that were generated.
|
|
3348
|
-
*
|
|
3349
|
-
* @see https://platform.openai.com/docs/api-reference/responses/create
|
|
3350
|
-
* @see https://cookbook.openai.com/examples/using_logprobs
|
|
3351
|
-
*/
|
|
3352
|
-
logprobs: import_v418.z.union([import_v418.z.boolean(), import_v418.z.number().min(1).max(TOP_LOGPROBS_MAX)]).optional(),
|
|
3353
|
-
/**
|
|
3354
|
-
* The maximum number of total calls to built-in tools that can be processed in a response.
|
|
3355
|
-
* This maximum number applies across all built-in tool calls, not per individual tool.
|
|
3356
|
-
* Any further attempts to call a tool by the model will be ignored.
|
|
3357
|
-
*/
|
|
3358
|
-
maxToolCalls: import_v418.z.number().nullish(),
|
|
3359
|
-
metadata: import_v418.z.any().nullish(),
|
|
3360
|
-
parallelToolCalls: import_v418.z.boolean().nullish(),
|
|
3361
|
-
previousResponseId: import_v418.z.string().nullish(),
|
|
3362
|
-
promptCacheKey: import_v418.z.string().nullish(),
|
|
3363
|
-
/**
|
|
3364
|
-
* Prompt cache behavior for GPT-5.6 and later models.
|
|
3365
|
-
* `mode` controls whether OpenAI also places an implicit breakpoint.
|
|
3366
|
-
* `ttl` sets the minimum cache lifetime and currently only supports 30 minutes.
|
|
3367
|
-
*/
|
|
3368
|
-
promptCacheOptions: import_v418.z.object({
|
|
3369
|
-
mode: import_v418.z.enum(["implicit", "explicit"]).optional(),
|
|
3370
|
-
ttl: import_v418.z.literal("30m").optional()
|
|
3371
|
-
}).optional(),
|
|
3372
|
-
/**
|
|
3373
|
-
* The retention policy for the prompt cache.
|
|
3374
|
-
* - 'in_memory': Default. Standard prompt caching behavior.
|
|
3375
|
-
* - '24h': Extended prompt caching that keeps cached prefixes active for up to 24 hours.
|
|
3376
|
-
* Available for models before GPT-5.6 that support extended caching.
|
|
3377
|
-
*
|
|
3378
|
-
* @deprecated For GPT-5.6 and later models, use `promptCacheOptions.ttl`.
|
|
3379
|
-
*
|
|
3380
|
-
* @default 'in_memory'
|
|
3381
|
-
*/
|
|
3382
|
-
promptCacheRetention: import_v418.z.enum(["in_memory", "24h"]).nullish(),
|
|
3383
|
-
/**
|
|
3384
|
-
* Reasoning effort for reasoning models. Defaults to `medium`. If you use
|
|
3385
|
-
* `providerOptions` to set the `reasoningEffort` option, this model setting will be ignored.
|
|
3386
|
-
* GPT-5.6 supports 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'.
|
|
3387
|
-
* Supported values vary by model.
|
|
3388
|
-
*/
|
|
3389
|
-
reasoningEffort: import_v418.z.string().nullish(),
|
|
3390
|
-
/**
|
|
3391
|
-
* Updates the reasoning effort for GPT-6 and later models starting with this response
|
|
3392
|
-
* without changing the request-level reasoning effort. This preserves the
|
|
3393
|
-
* request prefix for prompt caching.
|
|
3394
|
-
*
|
|
3395
|
-
* Only supported by GPT-6 and later models in standard, single-agent mode. Cannot be
|
|
3396
|
-
* combined with automatic truncation.
|
|
3397
|
-
*/
|
|
3398
|
-
reasoningEffortUpdate: import_v418.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
3399
|
-
/**
|
|
3400
|
-
* Controls how much model work GPT-5.6 performs before returning a final answer.
|
|
3401
|
-
* `standard` is the default. `pro` increases quality, latency, and token usage.
|
|
3402
|
-
*/
|
|
3403
|
-
reasoningMode: import_v418.z.enum(["standard", "pro"]).optional(),
|
|
3404
|
-
/**
|
|
3405
|
-
* Controls which available reasoning items GPT-5.6 can use.
|
|
3406
|
-
* `auto` uses the model default, `current_turn` excludes reasoning from earlier
|
|
3407
|
-
* turns, and `all_turns` makes compatible earlier reasoning available.
|
|
3408
|
-
*/
|
|
3409
|
-
reasoningContext: import_v418.z.enum(["auto", "current_turn", "all_turns"]).optional(),
|
|
3410
|
-
reasoningSummary: import_v418.z.string().nullish(),
|
|
3411
|
-
safetyIdentifier: import_v418.z.string().nullish(),
|
|
3412
|
-
serviceTier: import_v418.z.enum(["auto", "flex", "priority", "default"]).nullish(),
|
|
3413
|
-
store: import_v418.z.boolean().nullish(),
|
|
3414
|
-
strictJsonSchema: import_v418.z.boolean().nullish(),
|
|
3415
|
-
textVerbosity: import_v418.z.enum(["low", "medium", "high"]).nullish(),
|
|
3416
|
-
truncation: import_v418.z.enum(["auto", "disabled"]).nullish(),
|
|
3417
|
-
user: import_v418.z.string().nullish()
|
|
3418
|
-
})
|
|
3419
|
-
)
|
|
3420
|
-
);
|
|
3421
|
-
|
|
3422
3471
|
// src/responses/openai-responses-prepare-tools.ts
|
|
3423
3472
|
var import_provider7 = require("@ai-sdk/provider");
|
|
3424
3473
|
var import_provider_utils24 = require("@ai-sdk/provider-utils");
|
|
@@ -3591,6 +3640,18 @@ function resolveAsyncToolOption({
|
|
|
3591
3640
|
}
|
|
3592
3641
|
|
|
3593
3642
|
// src/responses/openai-responses-language-model.ts
|
|
3643
|
+
function getConfigurationUpdateUnsupportedReason({
|
|
3644
|
+
modelCapabilities,
|
|
3645
|
+
options
|
|
3646
|
+
}) {
|
|
3647
|
+
if (!modelCapabilities.supportsConfigurationUpdate) {
|
|
3648
|
+
return "reasoningEffortUpdate is only supported by GPT-6 and later models";
|
|
3649
|
+
}
|
|
3650
|
+
if ((options == null ? void 0 : options.reasoningMode) === "pro" || (options == null ? void 0 : options.truncation) === "auto") {
|
|
3651
|
+
return "reasoningEffortUpdate requires standard reasoning mode without automatic truncation";
|
|
3652
|
+
}
|
|
3653
|
+
return void 0;
|
|
3654
|
+
}
|
|
3594
3655
|
var OpenAIResponsesLanguageModel = class {
|
|
3595
3656
|
constructor(modelId, config) {
|
|
3596
3657
|
this.specificationVersion = "v2";
|
|
@@ -3655,8 +3716,14 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3655
3716
|
details: "conversation and previousResponseId cannot be used together"
|
|
3656
3717
|
});
|
|
3657
3718
|
}
|
|
3719
|
+
const configurationUpdateUnsupportedReason = getConfigurationUpdateUnsupportedReason({
|
|
3720
|
+
modelCapabilities,
|
|
3721
|
+
options: openaiOptions
|
|
3722
|
+
});
|
|
3658
3723
|
const { input, warnings: inputWarnings } = await convertToOpenAIResponsesInput({
|
|
3659
3724
|
prompt,
|
|
3725
|
+
configurationUpdateUnsupportedReason,
|
|
3726
|
+
providerOptionsName: this.config.provider.includes("azure") ? "azure" : "openai",
|
|
3660
3727
|
systemMessageMode: modelCapabilities.systemMessageMode,
|
|
3661
3728
|
explicitMessageItemType: this.config.explicitMessageItemType,
|
|
3662
3729
|
fileIdPrefixes: this.config.fileIdPrefixes,
|
|
@@ -3676,18 +3743,27 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
3676
3743
|
resolvedReasoningEffort = void 0;
|
|
3677
3744
|
}
|
|
3678
3745
|
const reasoningEffortUpdate = openaiOptions == null ? void 0 : openaiOptions.reasoningEffortUpdate;
|
|
3679
|
-
|
|
3680
|
-
if (reasoningEffortUpdate != null && !configurationUpdateIsSupported) {
|
|
3746
|
+
if (reasoningEffortUpdate != null && configurationUpdateUnsupportedReason != null) {
|
|
3681
3747
|
warnings.push({
|
|
3682
3748
|
type: "unsupported-setting",
|
|
3683
3749
|
setting: "reasoningEffortUpdate",
|
|
3684
|
-
details:
|
|
3750
|
+
details: configurationUpdateUnsupportedReason
|
|
3685
3751
|
});
|
|
3686
3752
|
} else if (reasoningEffortUpdate != null) {
|
|
3687
|
-
input
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3753
|
+
const firstItem = input[0];
|
|
3754
|
+
if ((firstItem == null ? void 0 : firstItem.type) !== "configuration_update" || firstItem.reasoning.effort !== reasoningEffortUpdate) {
|
|
3755
|
+
input.unshift({
|
|
3756
|
+
type: "configuration_update",
|
|
3757
|
+
reasoning: { effort: reasoningEffortUpdate }
|
|
3758
|
+
});
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
for (let i = 1; i < input.length; i++) {
|
|
3762
|
+
if (input[i - 1].type === "configuration_update" && input[i].type === "configuration_update") {
|
|
3763
|
+
throw new import_provider8.UnsupportedFunctionalityError({
|
|
3764
|
+
functionality: "Adjacent reasoning effort configuration updates"
|
|
3765
|
+
});
|
|
3766
|
+
}
|
|
3691
3767
|
}
|
|
3692
3768
|
const strictJsonSchema = (_b = openaiOptions == null ? void 0 : openaiOptions.strictJsonSchema) != null ? _b : false;
|
|
3693
3769
|
let include = openaiOptions == null ? void 0 : openaiOptions.include;
|
|
@@ -4342,7 +4418,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
4342
4418
|
providerExecuted: true
|
|
4343
4419
|
});
|
|
4344
4420
|
} else if (value.item.type === "message") {
|
|
4345
|
-
ongoingAnnotations.splice(0
|
|
4421
|
+
ongoingAnnotations.splice(0);
|
|
4346
4422
|
activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
|
|
4347
4423
|
controller.enqueue({
|
|
4348
4424
|
type: "text-start",
|
|
@@ -5140,7 +5216,7 @@ var OpenAITranscriptionModel = class {
|
|
|
5140
5216
|
};
|
|
5141
5217
|
|
|
5142
5218
|
// src/version.ts
|
|
5143
|
-
var VERSION = true ? "2.0.
|
|
5219
|
+
var VERSION = true ? "2.0.130" : "0.0.0-test";
|
|
5144
5220
|
|
|
5145
5221
|
// src/openai-provider.ts
|
|
5146
5222
|
function createOpenAI(options = {}) {
|