@ai-sdk/openai 2.0.118 → 2.0.122

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.
@@ -1,6 +1,6 @@
1
1
  import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2CallOptions, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
- import { InferValidator, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { InferValidator, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL } from '@ai-sdk/provider-utils';
4
4
 
5
5
  type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | (string & {});
6
6
  declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
@@ -113,6 +113,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
113
113
  readonly specificationVersion = "v2";
114
114
  readonly modelId: OpenAIEmbeddingModelId;
115
115
  readonly maxEmbeddingsPerCall = 2048;
116
+ readonly [EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL] = 300000;
116
117
  readonly supportsParallelCalls = true;
117
118
  private readonly config;
118
119
  get provider(): string;
@@ -1,6 +1,6 @@
1
1
  import { LanguageModelV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV2CallOptions, TranscriptionModelV2, SpeechModelV2 } from '@ai-sdk/provider';
2
2
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
- import { InferValidator, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { InferValidator, FetchFunction, EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL } from '@ai-sdk/provider-utils';
4
4
 
5
5
  type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | (string & {});
6
6
  declare const openaiChatLanguageModelOptions: _ai_sdk_provider_utils.LazyValidator<{
@@ -113,6 +113,7 @@ declare class OpenAIEmbeddingModel implements EmbeddingModelV2<string> {
113
113
  readonly specificationVersion = "v2";
114
114
  readonly modelId: OpenAIEmbeddingModelId;
115
115
  readonly maxEmbeddingsPerCall = 2048;
116
+ readonly [EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL] = 300000;
116
117
  readonly supportsParallelCalls = true;
117
118
  private readonly config;
118
119
  get provider(): string;
@@ -83,10 +83,10 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
83
83
 
84
84
  // src/openai-language-model-capabilities.ts
85
85
  function getOpenAILanguageModelCapabilities(modelId) {
86
- var _a, _b, _c, _d, _e;
86
+ var _a2, _b, _c, _d, _e;
87
87
  const oSeriesVersion = getOSeriesVersion(modelId);
88
88
  const gptVersion = getGptVersion(modelId);
89
- const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a.startsWith("chat")) != null ? _b : false);
89
+ const isGptChatModel = (gptVersion == null ? void 0 : gptVersion.minor) == null && ((_b = (_a2 = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _a2.startsWith("chat")) != null ? _b : false);
90
90
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
91
91
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
92
92
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
@@ -120,9 +120,14 @@ function getGptVersion(modelId) {
120
120
  // src/chat/convert-to-openai-chat-messages.ts
121
121
  var import_provider = require("@ai-sdk/provider");
122
122
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
123
+ function serializeToolCallArguments(input) {
124
+ return JSON.stringify(
125
+ typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
126
+ );
127
+ }
123
128
  function getPromptCacheBreakpoint(providerOptions) {
124
- var _a;
125
- return (_a = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a.promptCacheBreakpoint;
129
+ var _a2;
130
+ return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
126
131
  }
127
132
  function convertToOpenAIChatMessages({
128
133
  prompt,
@@ -186,7 +191,7 @@ function convertToOpenAIChatMessages({
186
191
  messages.push({
187
192
  role: "user",
188
193
  content: content.map((part, index) => {
189
- var _a, _b, _c;
194
+ var _a2, _b, _c;
190
195
  switch (part.type) {
191
196
  case "text": {
192
197
  const promptCacheBreakpoint = getPromptCacheBreakpoint(
@@ -211,7 +216,7 @@ function convertToOpenAIChatMessages({
211
216
  image_url: {
212
217
  url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`,
213
218
  // OpenAI specific extension: image detail
214
- detail: (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.imageDetail
219
+ detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
215
220
  },
216
221
  ...promptCacheBreakpoint != null && {
217
222
  prompt_cache_breakpoint: promptCacheBreakpoint
@@ -310,7 +315,7 @@ function convertToOpenAIChatMessages({
310
315
  type: "function",
311
316
  function: {
312
317
  name: part.toolName,
313
- arguments: JSON.stringify(part.input)
318
+ arguments: serializeToolCallArguments(part.input)
314
319
  }
315
320
  });
316
321
  break;
@@ -745,13 +750,13 @@ var OpenAIChatLanguageModel = class {
745
750
  toolChoice,
746
751
  providerOptions
747
752
  }) {
748
- var _a, _b, _c, _d;
753
+ var _a2, _b, _c, _d;
749
754
  const warnings = [];
750
- const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
755
+ const openaiOptions = (_a2 = await (0, import_provider_utils5.parseProviderOptions)({
751
756
  provider: "openai",
752
757
  providerOptions,
753
758
  schema: openaiChatLanguageModelOptions
754
- })) != null ? _a : {};
759
+ })) != null ? _a2 : {};
755
760
  const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
756
761
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
757
762
  if (topK != null) {
@@ -925,7 +930,7 @@ var OpenAIChatLanguageModel = class {
925
930
  };
926
931
  }
927
932
  async doGenerate(options) {
928
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
933
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
929
934
  const { args: body, warnings } = await this.getArgs(options);
930
935
  const {
931
936
  responseHeaders,
@@ -951,7 +956,7 @@ var OpenAIChatLanguageModel = class {
951
956
  if (text != null && text.length > 0) {
952
957
  content.push({ type: "text", text });
953
958
  }
954
- for (const toolCall of (_a = choice.message.tool_calls) != null ? _a : []) {
959
+ for (const toolCall of (_a2 = choice.message.tool_calls) != null ? _a2 : []) {
955
960
  content.push({
956
961
  type: "tool-call",
957
962
  toolCallId: (_b = toolCall.id) != null ? _b : (0, import_provider_utils5.generateId)(),
@@ -1045,7 +1050,7 @@ var OpenAIChatLanguageModel = class {
1045
1050
  controller.enqueue({ type: "stream-start", warnings });
1046
1051
  },
1047
1052
  transform(chunk, controller) {
1048
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
1053
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
1049
1054
  if (options.includeRawChunks) {
1050
1055
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1051
1056
  }
@@ -1071,7 +1076,7 @@ var OpenAIChatLanguageModel = class {
1071
1076
  }
1072
1077
  }
1073
1078
  if (value.usage != null) {
1074
- usage.inputTokens = (_a = value.usage.prompt_tokens) != null ? _a : void 0;
1079
+ usage.inputTokens = (_a2 = value.usage.prompt_tokens) != null ? _a2 : void 0;
1075
1080
  usage.outputTokens = (_b = value.usage.completion_tokens) != null ? _b : void 0;
1076
1081
  usage.totalTokens = (_c = value.usage.total_tokens) != null ? _c : void 0;
1077
1082
  usage.reasoningTokens = (_e = (_d = value.usage.completion_tokens_details) == null ? void 0 : _d.reasoning_tokens) != null ? _e : void 0;
@@ -1531,7 +1536,7 @@ var OpenAICompletionLanguageModel = class {
1531
1536
  };
1532
1537
  }
1533
1538
  async doGenerate(options) {
1534
- var _a, _b, _c;
1539
+ var _a2, _b, _c;
1535
1540
  const { args, warnings } = await this.getArgs(options);
1536
1541
  const {
1537
1542
  responseHeaders,
@@ -1559,7 +1564,7 @@ var OpenAICompletionLanguageModel = class {
1559
1564
  return {
1560
1565
  content: [{ type: "text", text: choice.text }],
1561
1566
  usage: {
1562
- inputTokens: (_a = response.usage) == null ? void 0 : _a.prompt_tokens,
1567
+ inputTokens: (_a2 = response.usage) == null ? void 0 : _a2.prompt_tokens,
1563
1568
  outputTokens: (_b = response.usage) == null ? void 0 : _b.completion_tokens,
1564
1569
  totalTokens: (_c = response.usage) == null ? void 0 : _c.total_tokens
1565
1570
  },
@@ -1710,10 +1715,13 @@ var openaiTextEmbeddingResponseSchema = (0, import_provider_utils10.lazyValidato
1710
1715
  );
1711
1716
 
1712
1717
  // src/embedding/openai-embedding-model.ts
1718
+ var _a;
1719
+ _a = import_provider_utils11.EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL;
1713
1720
  var OpenAIEmbeddingModel = class {
1714
1721
  constructor(modelId, config) {
1715
1722
  this.specificationVersion = "v2";
1716
1723
  this.maxEmbeddingsPerCall = 2048;
1724
+ this[_a] = 3e5;
1717
1725
  this.supportsParallelCalls = true;
1718
1726
  this.modelId = modelId;
1719
1727
  this.config = config;
@@ -1727,7 +1735,7 @@ var OpenAIEmbeddingModel = class {
1727
1735
  abortSignal,
1728
1736
  providerOptions
1729
1737
  }) {
1730
- var _a;
1738
+ var _a2;
1731
1739
  if (values.length > this.maxEmbeddingsPerCall) {
1732
1740
  throw new import_provider5.TooManyEmbeddingValuesForCallError({
1733
1741
  provider: this.provider,
@@ -1736,11 +1744,11 @@ var OpenAIEmbeddingModel = class {
1736
1744
  values
1737
1745
  });
1738
1746
  }
1739
- const openaiOptions = (_a = await (0, import_provider_utils11.parseProviderOptions)({
1747
+ const openaiOptions = (_a2 = await (0, import_provider_utils11.parseProviderOptions)({
1740
1748
  provider: "openai",
1741
1749
  providerOptions,
1742
1750
  schema: openaiEmbeddingProviderOptions
1743
- })) != null ? _a : {};
1751
+ })) != null ? _a2 : {};
1744
1752
  const {
1745
1753
  responseHeaders,
1746
1754
  value: response,
@@ -1824,8 +1832,8 @@ function hasDefaultResponseFormat(modelId) {
1824
1832
  );
1825
1833
  }
1826
1834
  function getMaxImagesPerCall(modelId) {
1827
- var _a;
1828
- return (_a = modelMaxImagesPerCall[modelId]) != null ? _a : modelId.startsWith("gpt-image-") ? 10 : 1;
1835
+ var _a2;
1836
+ return (_a2 = modelMaxImagesPerCall[modelId]) != null ? _a2 : modelId.startsWith("gpt-image-") ? 10 : 1;
1829
1837
  }
1830
1838
  var baseImageModelOptionsObject = import_v49.z.object({
1831
1839
  /**
@@ -1900,7 +1908,7 @@ var OpenAIImageModel = class {
1900
1908
  headers,
1901
1909
  abortSignal
1902
1910
  }) {
1903
- var _a, _b, _c, _d;
1911
+ var _a2, _b, _c, _d;
1904
1912
  const warnings = [];
1905
1913
  if (aspectRatio != null) {
1906
1914
  warnings.push({
@@ -1912,7 +1920,7 @@ var OpenAIImageModel = class {
1912
1920
  if (seed != null) {
1913
1921
  warnings.push({ type: "unsupported-setting", setting: "seed" });
1914
1922
  }
1915
- const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1923
+ const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
1916
1924
  const openaiOptions = (_d = await (0, import_provider_utils14.parseProviderOptions)({
1917
1925
  provider: "openai",
1918
1926
  providerOptions,
@@ -2192,8 +2200,8 @@ var OpenAITranscriptionModel = class {
2192
2200
  };
2193
2201
  }
2194
2202
  async doGenerate(options) {
2195
- var _a, _b, _c, _d, _e, _f, _g, _h;
2196
- const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
2203
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
2204
+ const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
2197
2205
  const { formData, warnings } = await this.getArgs(options);
2198
2206
  const {
2199
2207
  value: response,
@@ -2319,8 +2327,8 @@ var OpenAISpeechModel = class {
2319
2327
  };
2320
2328
  }
2321
2329
  async doGenerate(options) {
2322
- var _a, _b, _c;
2323
- const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
2330
+ var _a2, _b, _c;
2331
+ const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
2324
2332
  const { requestBody, warnings } = await this.getArgs(options);
2325
2333
  const {
2326
2334
  value: audio,
@@ -2392,8 +2400,8 @@ var localShell = (0, import_provider_utils20.createProviderDefinedToolFactoryWit
2392
2400
 
2393
2401
  // src/responses/convert-to-openai-responses-input.ts
2394
2402
  function getPromptCacheBreakpoint2(providerOptions) {
2395
- var _a;
2396
- return (_a = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a.promptCacheBreakpoint;
2403
+ var _a2;
2404
+ return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
2397
2405
  }
2398
2406
  function isFileId(data, prefixes) {
2399
2407
  if (!prefixes) return false;
@@ -2406,7 +2414,7 @@ async function convertToOpenAIResponsesInput({
2406
2414
  store,
2407
2415
  hasLocalShellTool = false
2408
2416
  }) {
2409
- var _a, _b, _c, _d, _e, _f;
2417
+ var _a2, _b, _c, _d, _e, _f;
2410
2418
  let input = [];
2411
2419
  const warnings = [];
2412
2420
  for (const { role, content, providerOptions } of prompt) {
@@ -2461,7 +2469,7 @@ async function convertToOpenAIResponsesInput({
2461
2469
  input.push({
2462
2470
  role: "user",
2463
2471
  content: content.map((part, index) => {
2464
- var _a2, _b2, _c2;
2472
+ var _a3, _b2, _c2;
2465
2473
  switch (part.type) {
2466
2474
  case "text": {
2467
2475
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(
@@ -2486,7 +2494,7 @@ async function convertToOpenAIResponsesInput({
2486
2494
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2487
2495
  image_url: `data:${mediaType};base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
2488
2496
  },
2489
- detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail,
2497
+ detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3.openai) == null ? void 0 : _b2.imageDetail,
2490
2498
  ...promptCacheBreakpoint != null && {
2491
2499
  prompt_cache_breakpoint: promptCacheBreakpoint
2492
2500
  }
@@ -2528,7 +2536,7 @@ async function convertToOpenAIResponsesInput({
2528
2536
  for (const part of content) {
2529
2537
  switch (part.type) {
2530
2538
  case "text": {
2531
- const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId;
2539
+ const id = (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.itemId;
2532
2540
  const phase = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.phase;
2533
2541
  if (store && id != null) {
2534
2542
  input.push({ type: "item_reference", id });
@@ -3844,7 +3852,7 @@ var OpenAIResponsesLanguageModel = class {
3844
3852
  toolChoice,
3845
3853
  responseFormat
3846
3854
  }) {
3847
- var _a, _b, _c, _d;
3855
+ var _a2, _b, _c, _d;
3848
3856
  const warnings = [];
3849
3857
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
3850
3858
  if (topK != null) {
@@ -3884,7 +3892,7 @@ var OpenAIResponsesLanguageModel = class {
3884
3892
  prompt,
3885
3893
  systemMessageMode: modelCapabilities.systemMessageMode,
3886
3894
  fileIdPrefixes: this.config.fileIdPrefixes,
3887
- store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
3895
+ store: (_a2 = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a2 : true,
3888
3896
  hasLocalShellTool: hasOpenAITool("openai.local_shell")
3889
3897
  });
3890
3898
  warnings.push(...inputWarnings);
@@ -4062,7 +4070,7 @@ var OpenAIResponsesLanguageModel = class {
4062
4070
  };
4063
4071
  }
4064
4072
  async doGenerate(options) {
4065
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
4073
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
4066
4074
  const {
4067
4075
  args: body,
4068
4076
  warnings,
@@ -4115,7 +4123,7 @@ var OpenAIResponsesLanguageModel = class {
4115
4123
  providerMetadata: {
4116
4124
  [providerKey]: {
4117
4125
  itemId: part.id,
4118
- reasoningEncryptedContent: (_a = part.encrypted_content) != null ? _a : null
4126
+ reasoningEncryptedContent: (_a2 = part.encrypted_content) != null ? _a2 : null
4119
4127
  }
4120
4128
  }
4121
4129
  });
@@ -4428,7 +4436,7 @@ var OpenAIResponsesLanguageModel = class {
4428
4436
  controller.enqueue({ type: "stream-start", warnings });
4429
4437
  },
4430
4438
  transform(chunk, controller) {
4431
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
4439
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
4432
4440
  if (options.includeRawChunks) {
4433
4441
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
4434
4442
  }
@@ -4519,7 +4527,7 @@ var OpenAIResponsesLanguageModel = class {
4519
4527
  });
4520
4528
  } else if (value.item.type === "message") {
4521
4529
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
4522
- activeMessagePhase = (_a = value.item.phase) != null ? _a : void 0;
4530
+ activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
4523
4531
  controller.enqueue({
4524
4532
  type: "text-start",
4525
4533
  id: value.item.id,
@@ -4919,14 +4927,14 @@ function isErrorChunk(chunk) {
4919
4927
  return chunk.type === "error";
4920
4928
  }
4921
4929
  function mapWebSearchOutput(action) {
4922
- var _a;
4930
+ var _a2;
4923
4931
  if (action == null) {
4924
4932
  return {};
4925
4933
  }
4926
4934
  switch (action.type) {
4927
4935
  case "search":
4928
4936
  return {
4929
- action: { type: "search", query: (_a = action.query) != null ? _a : void 0 },
4937
+ action: { type: "search", query: (_a2 = action.query) != null ? _a2 : void 0 },
4930
4938
  // include sources when provided by the Responses API (behind include flag)
4931
4939
  ...action.sources != null && { sources: action.sources }
4932
4940
  };
@@ -4943,8 +4951,8 @@ function mapWebSearchOutput(action) {
4943
4951
  }
4944
4952
  }
4945
4953
  function getResponsesUsageMetadata(usage) {
4946
- var _a, _b, _c, _d;
4947
- const cacheWriteTokens = (_a = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _a.cache_write_tokens;
4954
+ var _a2, _b, _c, _d;
4955
+ const cacheWriteTokens = (_a2 = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _a2.cache_write_tokens;
4948
4956
  const orchestrationInputTokens = (_b = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _b.orchestration_input_tokens;
4949
4957
  const orchestrationInputCachedTokens = (_c = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _c.orchestration_input_cached_tokens;
4950
4958
  const orchestrationOutputTokens = (_d = usage == null ? void 0 : usage.output_tokens_details) == null ? void 0 : _d.orchestration_output_tokens;