@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.122
4
+
5
+ ### Patch Changes
6
+
7
+ - f70d0a3: Normalize non-object replayed Chat Completions tool arguments to empty objects.
8
+
9
+ ## 2.0.121
10
+
11
+ ### Patch Changes
12
+
13
+ - 77d33c0: Split OpenAI and Azure OpenAI embedding requests by a conservative UTF-8 byte budget derived from their aggregate token limit, in addition to input count limits.
14
+ - Updated dependencies [77d33c0]
15
+ - @ai-sdk/provider-utils@3.0.35
16
+
17
+ ## 2.0.120
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [2fff9f1]
22
+ - Updated dependencies [f364ea0]
23
+ - @ai-sdk/provider-utils@3.0.34
24
+
25
+ ## 2.0.119
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [9e8e087]
30
+ - @ai-sdk/provider-utils@3.0.33
31
+
3
32
  ## 2.0.118
4
33
 
5
34
  ### Patch Changes
package/dist/index.js CHANGED
@@ -54,10 +54,10 @@ var openaiFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
54
54
 
55
55
  // src/openai-language-model-capabilities.ts
56
56
  function getOpenAILanguageModelCapabilities(modelId) {
57
- var _a, _b, _c, _d, _e;
57
+ var _a2, _b, _c, _d, _e;
58
58
  const oSeriesVersion = getOSeriesVersion(modelId);
59
59
  const gptVersion = getGptVersion(modelId);
60
- 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);
60
+ 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);
61
61
  const isGptNanoModel = (_d = (_c = gptVersion == null ? void 0 : gptVersion.variant) == null ? void 0 : _c.startsWith("nano")) != null ? _d : false;
62
62
  const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
63
63
  const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
@@ -91,9 +91,14 @@ function getGptVersion(modelId) {
91
91
  // src/chat/convert-to-openai-chat-messages.ts
92
92
  var import_provider = require("@ai-sdk/provider");
93
93
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
94
+ function serializeToolCallArguments(input) {
95
+ return JSON.stringify(
96
+ typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
97
+ );
98
+ }
94
99
  function getPromptCacheBreakpoint(providerOptions) {
95
- var _a;
96
- return (_a = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a.promptCacheBreakpoint;
100
+ var _a2;
101
+ return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
97
102
  }
98
103
  function convertToOpenAIChatMessages({
99
104
  prompt,
@@ -157,7 +162,7 @@ function convertToOpenAIChatMessages({
157
162
  messages.push({
158
163
  role: "user",
159
164
  content: content.map((part, index) => {
160
- var _a, _b, _c;
165
+ var _a2, _b, _c;
161
166
  switch (part.type) {
162
167
  case "text": {
163
168
  const promptCacheBreakpoint = getPromptCacheBreakpoint(
@@ -182,7 +187,7 @@ function convertToOpenAIChatMessages({
182
187
  image_url: {
183
188
  url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`,
184
189
  // OpenAI specific extension: image detail
185
- detail: (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.imageDetail
190
+ detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
186
191
  },
187
192
  ...promptCacheBreakpoint != null && {
188
193
  prompt_cache_breakpoint: promptCacheBreakpoint
@@ -281,7 +286,7 @@ function convertToOpenAIChatMessages({
281
286
  type: "function",
282
287
  function: {
283
288
  name: part.toolName,
284
- arguments: JSON.stringify(part.input)
289
+ arguments: serializeToolCallArguments(part.input)
285
290
  }
286
291
  });
287
292
  break;
@@ -716,13 +721,13 @@ var OpenAIChatLanguageModel = class {
716
721
  toolChoice,
717
722
  providerOptions
718
723
  }) {
719
- var _a, _b, _c, _d;
724
+ var _a2, _b, _c, _d;
720
725
  const warnings = [];
721
- const openaiOptions = (_a = await (0, import_provider_utils5.parseProviderOptions)({
726
+ const openaiOptions = (_a2 = await (0, import_provider_utils5.parseProviderOptions)({
722
727
  provider: "openai",
723
728
  providerOptions,
724
729
  schema: openaiChatLanguageModelOptions
725
- })) != null ? _a : {};
730
+ })) != null ? _a2 : {};
726
731
  const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
727
732
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
728
733
  if (topK != null) {
@@ -896,7 +901,7 @@ var OpenAIChatLanguageModel = class {
896
901
  };
897
902
  }
898
903
  async doGenerate(options) {
899
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
904
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
900
905
  const { args: body, warnings } = await this.getArgs(options);
901
906
  const {
902
907
  responseHeaders,
@@ -922,7 +927,7 @@ var OpenAIChatLanguageModel = class {
922
927
  if (text != null && text.length > 0) {
923
928
  content.push({ type: "text", text });
924
929
  }
925
- for (const toolCall of (_a = choice.message.tool_calls) != null ? _a : []) {
930
+ for (const toolCall of (_a2 = choice.message.tool_calls) != null ? _a2 : []) {
926
931
  content.push({
927
932
  type: "tool-call",
928
933
  toolCallId: (_b = toolCall.id) != null ? _b : (0, import_provider_utils5.generateId)(),
@@ -1016,7 +1021,7 @@ var OpenAIChatLanguageModel = class {
1016
1021
  controller.enqueue({ type: "stream-start", warnings });
1017
1022
  },
1018
1023
  transform(chunk, controller) {
1019
- 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;
1024
+ 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;
1020
1025
  if (options.includeRawChunks) {
1021
1026
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
1022
1027
  }
@@ -1042,7 +1047,7 @@ var OpenAIChatLanguageModel = class {
1042
1047
  }
1043
1048
  }
1044
1049
  if (value.usage != null) {
1045
- usage.inputTokens = (_a = value.usage.prompt_tokens) != null ? _a : void 0;
1050
+ usage.inputTokens = (_a2 = value.usage.prompt_tokens) != null ? _a2 : void 0;
1046
1051
  usage.outputTokens = (_b = value.usage.completion_tokens) != null ? _b : void 0;
1047
1052
  usage.totalTokens = (_c = value.usage.total_tokens) != null ? _c : void 0;
1048
1053
  usage.reasoningTokens = (_e = (_d = value.usage.completion_tokens_details) == null ? void 0 : _d.reasoning_tokens) != null ? _e : void 0;
@@ -1502,7 +1507,7 @@ var OpenAICompletionLanguageModel = class {
1502
1507
  };
1503
1508
  }
1504
1509
  async doGenerate(options) {
1505
- var _a, _b, _c;
1510
+ var _a2, _b, _c;
1506
1511
  const { args, warnings } = await this.getArgs(options);
1507
1512
  const {
1508
1513
  responseHeaders,
@@ -1530,7 +1535,7 @@ var OpenAICompletionLanguageModel = class {
1530
1535
  return {
1531
1536
  content: [{ type: "text", text: choice.text }],
1532
1537
  usage: {
1533
- inputTokens: (_a = response.usage) == null ? void 0 : _a.prompt_tokens,
1538
+ inputTokens: (_a2 = response.usage) == null ? void 0 : _a2.prompt_tokens,
1534
1539
  outputTokens: (_b = response.usage) == null ? void 0 : _b.completion_tokens,
1535
1540
  totalTokens: (_c = response.usage) == null ? void 0 : _c.total_tokens
1536
1541
  },
@@ -1681,10 +1686,13 @@ var openaiTextEmbeddingResponseSchema = (0, import_provider_utils10.lazyValidato
1681
1686
  );
1682
1687
 
1683
1688
  // src/embedding/openai-embedding-model.ts
1689
+ var _a;
1690
+ _a = import_provider_utils11.EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL;
1684
1691
  var OpenAIEmbeddingModel = class {
1685
1692
  constructor(modelId, config) {
1686
1693
  this.specificationVersion = "v2";
1687
1694
  this.maxEmbeddingsPerCall = 2048;
1695
+ this[_a] = 3e5;
1688
1696
  this.supportsParallelCalls = true;
1689
1697
  this.modelId = modelId;
1690
1698
  this.config = config;
@@ -1698,7 +1706,7 @@ var OpenAIEmbeddingModel = class {
1698
1706
  abortSignal,
1699
1707
  providerOptions
1700
1708
  }) {
1701
- var _a;
1709
+ var _a2;
1702
1710
  if (values.length > this.maxEmbeddingsPerCall) {
1703
1711
  throw new import_provider5.TooManyEmbeddingValuesForCallError({
1704
1712
  provider: this.provider,
@@ -1707,11 +1715,11 @@ var OpenAIEmbeddingModel = class {
1707
1715
  values
1708
1716
  });
1709
1717
  }
1710
- const openaiOptions = (_a = await (0, import_provider_utils11.parseProviderOptions)({
1718
+ const openaiOptions = (_a2 = await (0, import_provider_utils11.parseProviderOptions)({
1711
1719
  provider: "openai",
1712
1720
  providerOptions,
1713
1721
  schema: openaiEmbeddingProviderOptions
1714
- })) != null ? _a : {};
1722
+ })) != null ? _a2 : {};
1715
1723
  const {
1716
1724
  responseHeaders,
1717
1725
  value: response,
@@ -1795,8 +1803,8 @@ function hasDefaultResponseFormat(modelId) {
1795
1803
  );
1796
1804
  }
1797
1805
  function getMaxImagesPerCall(modelId) {
1798
- var _a;
1799
- return (_a = modelMaxImagesPerCall[modelId]) != null ? _a : modelId.startsWith("gpt-image-") ? 10 : 1;
1806
+ var _a2;
1807
+ return (_a2 = modelMaxImagesPerCall[modelId]) != null ? _a2 : modelId.startsWith("gpt-image-") ? 10 : 1;
1800
1808
  }
1801
1809
  var baseImageModelOptionsObject = import_v49.z.object({
1802
1810
  /**
@@ -1871,7 +1879,7 @@ var OpenAIImageModel = class {
1871
1879
  headers,
1872
1880
  abortSignal
1873
1881
  }) {
1874
- var _a, _b, _c, _d;
1882
+ var _a2, _b, _c, _d;
1875
1883
  const warnings = [];
1876
1884
  if (aspectRatio != null) {
1877
1885
  warnings.push({
@@ -1883,7 +1891,7 @@ var OpenAIImageModel = class {
1883
1891
  if (seed != null) {
1884
1892
  warnings.push({ type: "unsupported-setting", setting: "seed" });
1885
1893
  }
1886
- const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
1894
+ const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
1887
1895
  const openaiOptions = (_d = await (0, import_provider_utils14.parseProviderOptions)({
1888
1896
  provider: "openai",
1889
1897
  providerOptions,
@@ -2319,8 +2327,8 @@ var import_provider6 = require("@ai-sdk/provider");
2319
2327
  var import_provider_utils21 = require("@ai-sdk/provider-utils");
2320
2328
  var import_v416 = require("zod/v4");
2321
2329
  function getPromptCacheBreakpoint2(providerOptions) {
2322
- var _a;
2323
- return (_a = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a.promptCacheBreakpoint;
2330
+ var _a2;
2331
+ return (_a2 = providerOptions == null ? void 0 : providerOptions.openai) == null ? void 0 : _a2.promptCacheBreakpoint;
2324
2332
  }
2325
2333
  function isFileId(data, prefixes) {
2326
2334
  if (!prefixes) return false;
@@ -2333,7 +2341,7 @@ async function convertToOpenAIResponsesInput({
2333
2341
  store,
2334
2342
  hasLocalShellTool = false
2335
2343
  }) {
2336
- var _a, _b, _c, _d, _e, _f;
2344
+ var _a2, _b, _c, _d, _e, _f;
2337
2345
  let input = [];
2338
2346
  const warnings = [];
2339
2347
  for (const { role, content, providerOptions } of prompt) {
@@ -2388,7 +2396,7 @@ async function convertToOpenAIResponsesInput({
2388
2396
  input.push({
2389
2397
  role: "user",
2390
2398
  content: content.map((part, index) => {
2391
- var _a2, _b2, _c2;
2399
+ var _a3, _b2, _c2;
2392
2400
  switch (part.type) {
2393
2401
  case "text": {
2394
2402
  const promptCacheBreakpoint = getPromptCacheBreakpoint2(
@@ -2413,7 +2421,7 @@ async function convertToOpenAIResponsesInput({
2413
2421
  ...part.data instanceof URL ? { image_url: part.data.toString() } : typeof part.data === "string" && isFileId(part.data, fileIdPrefixes) ? { file_id: part.data } : {
2414
2422
  image_url: `data:${mediaType};base64,${(0, import_provider_utils21.convertToBase64)(part.data)}`
2415
2423
  },
2416
- detail: (_b2 = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b2.imageDetail,
2424
+ detail: (_b2 = (_a3 = part.providerOptions) == null ? void 0 : _a3.openai) == null ? void 0 : _b2.imageDetail,
2417
2425
  ...promptCacheBreakpoint != null && {
2418
2426
  prompt_cache_breakpoint: promptCacheBreakpoint
2419
2427
  }
@@ -2455,7 +2463,7 @@ async function convertToOpenAIResponsesInput({
2455
2463
  for (const part of content) {
2456
2464
  switch (part.type) {
2457
2465
  case "text": {
2458
- const id = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId;
2466
+ const id = (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.itemId;
2459
2467
  const phase = (_d = (_c = part.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.phase;
2460
2468
  if (store && id != null) {
2461
2469
  input.push({ type: "item_reference", id });
@@ -3532,7 +3540,7 @@ var OpenAIResponsesLanguageModel = class {
3532
3540
  toolChoice,
3533
3541
  responseFormat
3534
3542
  }) {
3535
- var _a, _b, _c, _d;
3543
+ var _a2, _b, _c, _d;
3536
3544
  const warnings = [];
3537
3545
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
3538
3546
  if (topK != null) {
@@ -3572,7 +3580,7 @@ var OpenAIResponsesLanguageModel = class {
3572
3580
  prompt,
3573
3581
  systemMessageMode: modelCapabilities.systemMessageMode,
3574
3582
  fileIdPrefixes: this.config.fileIdPrefixes,
3575
- store: (_a = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a : true,
3583
+ store: (_a2 = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _a2 : true,
3576
3584
  hasLocalShellTool: hasOpenAITool("openai.local_shell")
3577
3585
  });
3578
3586
  warnings.push(...inputWarnings);
@@ -3750,7 +3758,7 @@ var OpenAIResponsesLanguageModel = class {
3750
3758
  };
3751
3759
  }
3752
3760
  async doGenerate(options) {
3753
- 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;
3761
+ 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;
3754
3762
  const {
3755
3763
  args: body,
3756
3764
  warnings,
@@ -3803,7 +3811,7 @@ var OpenAIResponsesLanguageModel = class {
3803
3811
  providerMetadata: {
3804
3812
  [providerKey]: {
3805
3813
  itemId: part.id,
3806
- reasoningEncryptedContent: (_a = part.encrypted_content) != null ? _a : null
3814
+ reasoningEncryptedContent: (_a2 = part.encrypted_content) != null ? _a2 : null
3807
3815
  }
3808
3816
  }
3809
3817
  });
@@ -4116,7 +4124,7 @@ var OpenAIResponsesLanguageModel = class {
4116
4124
  controller.enqueue({ type: "stream-start", warnings });
4117
4125
  },
4118
4126
  transform(chunk, controller) {
4119
- 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;
4127
+ 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;
4120
4128
  if (options.includeRawChunks) {
4121
4129
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
4122
4130
  }
@@ -4207,7 +4215,7 @@ var OpenAIResponsesLanguageModel = class {
4207
4215
  });
4208
4216
  } else if (value.item.type === "message") {
4209
4217
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
4210
- activeMessagePhase = (_a = value.item.phase) != null ? _a : void 0;
4218
+ activeMessagePhase = (_a2 = value.item.phase) != null ? _a2 : void 0;
4211
4219
  controller.enqueue({
4212
4220
  type: "text-start",
4213
4221
  id: value.item.id,
@@ -4607,14 +4615,14 @@ function isErrorChunk(chunk) {
4607
4615
  return chunk.type === "error";
4608
4616
  }
4609
4617
  function mapWebSearchOutput(action) {
4610
- var _a;
4618
+ var _a2;
4611
4619
  if (action == null) {
4612
4620
  return {};
4613
4621
  }
4614
4622
  switch (action.type) {
4615
4623
  case "search":
4616
4624
  return {
4617
- action: { type: "search", query: (_a = action.query) != null ? _a : void 0 },
4625
+ action: { type: "search", query: (_a2 = action.query) != null ? _a2 : void 0 },
4618
4626
  // include sources when provided by the Responses API (behind include flag)
4619
4627
  ...action.sources != null && { sources: action.sources }
4620
4628
  };
@@ -4631,8 +4639,8 @@ function mapWebSearchOutput(action) {
4631
4639
  }
4632
4640
  }
4633
4641
  function getResponsesUsageMetadata(usage) {
4634
- var _a, _b, _c, _d;
4635
- const cacheWriteTokens = (_a = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _a.cache_write_tokens;
4642
+ var _a2, _b, _c, _d;
4643
+ const cacheWriteTokens = (_a2 = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _a2.cache_write_tokens;
4636
4644
  const orchestrationInputTokens = (_b = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _b.orchestration_input_tokens;
4637
4645
  const orchestrationInputCachedTokens = (_c = usage == null ? void 0 : usage.input_tokens_details) == null ? void 0 : _c.orchestration_input_cached_tokens;
4638
4646
  const orchestrationOutputTokens = (_d = usage == null ? void 0 : usage.output_tokens_details) == null ? void 0 : _d.orchestration_output_tokens;
@@ -4730,8 +4738,8 @@ var OpenAISpeechModel = class {
4730
4738
  };
4731
4739
  }
4732
4740
  async doGenerate(options) {
4733
- var _a, _b, _c;
4734
- const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
4741
+ var _a2, _b, _c;
4742
+ const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
4735
4743
  const { requestBody, warnings } = await this.getArgs(options);
4736
4744
  const {
4737
4745
  value: audio,
@@ -4955,8 +4963,8 @@ var OpenAITranscriptionModel = class {
4955
4963
  };
4956
4964
  }
4957
4965
  async doGenerate(options) {
4958
- var _a, _b, _c, _d, _e, _f, _g, _h;
4959
- const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
4966
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
4967
+ const currentDate = (_c = (_b = (_a2 = this.config._internal) == null ? void 0 : _a2.currentDate) == null ? void 0 : _b.call(_a2)) != null ? _c : /* @__PURE__ */ new Date();
4960
4968
  const { formData, warnings } = await this.getArgs(options);
4961
4969
  const {
4962
4970
  value: response,
@@ -5002,17 +5010,17 @@ var OpenAITranscriptionModel = class {
5002
5010
  };
5003
5011
 
5004
5012
  // src/version.ts
5005
- var VERSION = true ? "2.0.118" : "0.0.0-test";
5013
+ var VERSION = true ? "2.0.122" : "0.0.0-test";
5006
5014
 
5007
5015
  // src/openai-provider.ts
5008
5016
  function createOpenAI(options = {}) {
5009
- var _a, _b;
5010
- const baseURL = (_a = (0, import_provider_utils31.withoutTrailingSlash)(
5017
+ var _a2, _b;
5018
+ const baseURL = (_a2 = (0, import_provider_utils31.withoutTrailingSlash)(
5011
5019
  (0, import_provider_utils31.loadOptionalSetting)({
5012
5020
  settingValue: options.baseURL,
5013
5021
  environmentVariableName: "OPENAI_BASE_URL"
5014
5022
  })
5015
- )) != null ? _a : "https://api.openai.com/v1";
5023
+ )) != null ? _a2 : "https://api.openai.com/v1";
5016
5024
  const providerName = (_b = options.name) != null ? _b : "openai";
5017
5025
  const getHeaders = () => (0, import_provider_utils31.withUserAgentSuffix)(
5018
5026
  {