@ai-sdk/openai-compatible 1.0.0-canary.6 → 1.0.0-canary.7

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/dist/index.mjs CHANGED
@@ -9,9 +9,10 @@ import {
9
9
  createJsonResponseHandler,
10
10
  generateId,
11
11
  isParsableJson,
12
+ parseProviderOptions,
12
13
  postJsonToApi
13
14
  } from "@ai-sdk/provider-utils";
14
- import { z as z2 } from "zod";
15
+ import { z as z3 } from "zod";
15
16
 
16
17
  // src/convert-to-openai-compatible-chat-messages.ts
17
18
  import {
@@ -152,17 +153,27 @@ function mapOpenAICompatibleFinishReason(finishReason) {
152
153
  }
153
154
  }
154
155
 
155
- // src/openai-compatible-error.ts
156
+ // src/openai-compatible-chat-options.ts
156
157
  import { z } from "zod";
157
- var openaiCompatibleErrorDataSchema = z.object({
158
- error: z.object({
159
- message: z.string(),
158
+ var openaiCompatibleProviderOptions = z.object({
159
+ /**
160
+ * A unique identifier representing your end-user, which can help the provider to
161
+ * monitor and detect abuse.
162
+ */
163
+ user: z.string().optional()
164
+ });
165
+
166
+ // src/openai-compatible-error.ts
167
+ import { z as z2 } from "zod";
168
+ var openaiCompatibleErrorDataSchema = z2.object({
169
+ error: z2.object({
170
+ message: z2.string(),
160
171
  // The additional information below is handled loosely to support
161
172
  // OpenAI-compatible providers that have slightly different error
162
173
  // responses:
163
- type: z.string().nullish(),
164
- param: z.any().nullish(),
165
- code: z.union([z.string(), z.number()]).nullish()
174
+ type: z2.string().nullish(),
175
+ param: z2.any().nullish(),
176
+ code: z2.union([z2.string(), z2.number()]).nullish()
166
177
  })
167
178
  });
168
179
  var defaultOpenAICompatibleErrorStructure = {
@@ -228,11 +239,10 @@ function prepareTools({
228
239
  // src/openai-compatible-chat-language-model.ts
229
240
  var OpenAICompatibleChatLanguageModel = class {
230
241
  // type inferred via constructor
231
- constructor(modelId, settings, config) {
242
+ constructor(modelId, config) {
232
243
  this.specificationVersion = "v2";
233
244
  var _a, _b;
234
245
  this.modelId = modelId;
235
- this.settings = settings;
236
246
  this.config = config;
237
247
  const errorStructure = (_a = config.errorStructure) != null ? _a : defaultOpenAICompatibleErrorStructure;
238
248
  this.chunkSchema = createOpenAICompatibleChatChunkSchema(
@@ -265,8 +275,20 @@ var OpenAICompatibleChatLanguageModel = class {
265
275
  toolChoice,
266
276
  tools
267
277
  }) {
268
- var _a;
278
+ var _a, _b, _c;
269
279
  const warnings = [];
280
+ const compatibleOptions = Object.assign(
281
+ (_a = parseProviderOptions({
282
+ provider: "openai-compatible",
283
+ providerOptions,
284
+ schema: openaiCompatibleProviderOptions
285
+ })) != null ? _a : {},
286
+ (_b = parseProviderOptions({
287
+ provider: this.providerOptionsName,
288
+ providerOptions,
289
+ schema: openaiCompatibleProviderOptions
290
+ })) != null ? _b : {}
291
+ );
270
292
  if (topK != null) {
271
293
  warnings.push({ type: "unsupported-setting", setting: "topK" });
272
294
  }
@@ -290,7 +312,7 @@ var OpenAICompatibleChatLanguageModel = class {
290
312
  // model id:
291
313
  model: this.modelId,
292
314
  // model specific settings:
293
- user: this.settings.user,
315
+ user: compatibleOptions.user,
294
316
  // standardized settings:
295
317
  max_tokens: maxOutputTokens,
296
318
  temperature,
@@ -301,7 +323,7 @@ var OpenAICompatibleChatLanguageModel = class {
301
323
  type: "json_schema",
302
324
  json_schema: {
303
325
  schema: responseFormat.schema,
304
- name: (_a = responseFormat.name) != null ? _a : "response",
326
+ name: (_c = responseFormat.name) != null ? _c : "response",
305
327
  description: responseFormat.description
306
328
  }
307
329
  } : { type: "json_object" } : void 0,
@@ -318,7 +340,7 @@ var OpenAICompatibleChatLanguageModel = class {
318
340
  };
319
341
  }
320
342
  async doGenerate(options) {
321
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
343
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
322
344
  const { args, warnings } = this.getArgs({ ...options });
323
345
  const body = JSON.stringify(args);
324
346
  const {
@@ -362,11 +384,18 @@ var OpenAICompatibleChatLanguageModel = class {
362
384
  providerMetadata[this.providerOptionsName].cachedPromptTokens = promptTokenDetails == null ? void 0 : promptTokenDetails.cached_tokens;
363
385
  }
364
386
  return {
365
- text: (_e = choice.message.content) != null ? _e : void 0,
366
- reasoning: (_f = choice.message.reasoning_content) != null ? _f : void 0,
367
- toolCalls: (_g = choice.message.tool_calls) == null ? void 0 : _g.map((toolCall) => {
387
+ text: choice.message.content != null ? { type: "text", text: choice.message.content } : void 0,
388
+ reasoning: choice.message.reasoning_content ? [
389
+ {
390
+ type: "reasoning",
391
+ reasoningType: "text",
392
+ text: choice.message.reasoning_content
393
+ }
394
+ ] : void 0,
395
+ toolCalls: (_e = choice.message.tool_calls) == null ? void 0 : _e.map((toolCall) => {
368
396
  var _a2;
369
397
  return {
398
+ type: "tool-call",
370
399
  toolCallType: "function",
371
400
  toolCallId: (_a2 = toolCall.id) != null ? _a2 : generateId(),
372
401
  toolName: toolCall.function.name,
@@ -375,8 +404,8 @@ var OpenAICompatibleChatLanguageModel = class {
375
404
  }),
376
405
  finishReason: mapOpenAICompatibleFinishReason(choice.finish_reason),
377
406
  usage: {
378
- inputTokens: (_i = (_h = responseBody.usage) == null ? void 0 : _h.prompt_tokens) != null ? _i : void 0,
379
- outputTokens: (_k = (_j = responseBody.usage) == null ? void 0 : _j.completion_tokens) != null ? _k : void 0
407
+ inputTokens: (_g = (_f = responseBody.usage) == null ? void 0 : _f.prompt_tokens) != null ? _g : void 0,
408
+ outputTokens: (_i = (_h = responseBody.usage) == null ? void 0 : _h.completion_tokens) != null ? _i : void 0
380
409
  },
381
410
  providerMetadata,
382
411
  request: { body },
@@ -486,13 +515,14 @@ var OpenAICompatibleChatLanguageModel = class {
486
515
  if (delta.reasoning_content != null) {
487
516
  controller.enqueue({
488
517
  type: "reasoning",
489
- textDelta: delta.reasoning_content
518
+ reasoningType: "text",
519
+ text: delta.reasoning_content
490
520
  });
491
521
  }
492
522
  if (delta.content != null) {
493
523
  controller.enqueue({
494
- type: "text-delta",
495
- textDelta: delta.content
524
+ type: "text",
525
+ text: delta.content
496
526
  });
497
527
  }
498
528
  if (delta.tool_calls != null) {
@@ -613,68 +643,68 @@ var OpenAICompatibleChatLanguageModel = class {
613
643
  };
614
644
  }
615
645
  };
616
- var openaiCompatibleTokenUsageSchema = z2.object({
617
- prompt_tokens: z2.number().nullish(),
618
- completion_tokens: z2.number().nullish(),
619
- prompt_tokens_details: z2.object({
620
- cached_tokens: z2.number().nullish()
646
+ var openaiCompatibleTokenUsageSchema = z3.object({
647
+ prompt_tokens: z3.number().nullish(),
648
+ completion_tokens: z3.number().nullish(),
649
+ prompt_tokens_details: z3.object({
650
+ cached_tokens: z3.number().nullish()
621
651
  }).nullish(),
622
- completion_tokens_details: z2.object({
623
- reasoning_tokens: z2.number().nullish(),
624
- accepted_prediction_tokens: z2.number().nullish(),
625
- rejected_prediction_tokens: z2.number().nullish()
652
+ completion_tokens_details: z3.object({
653
+ reasoning_tokens: z3.number().nullish(),
654
+ accepted_prediction_tokens: z3.number().nullish(),
655
+ rejected_prediction_tokens: z3.number().nullish()
626
656
  }).nullish()
627
657
  }).nullish();
628
- var OpenAICompatibleChatResponseSchema = z2.object({
629
- id: z2.string().nullish(),
630
- created: z2.number().nullish(),
631
- model: z2.string().nullish(),
632
- choices: z2.array(
633
- z2.object({
634
- message: z2.object({
635
- role: z2.literal("assistant").nullish(),
636
- content: z2.string().nullish(),
637
- reasoning_content: z2.string().nullish(),
638
- tool_calls: z2.array(
639
- z2.object({
640
- id: z2.string().nullish(),
641
- type: z2.literal("function"),
642
- function: z2.object({
643
- name: z2.string(),
644
- arguments: z2.string()
658
+ var OpenAICompatibleChatResponseSchema = z3.object({
659
+ id: z3.string().nullish(),
660
+ created: z3.number().nullish(),
661
+ model: z3.string().nullish(),
662
+ choices: z3.array(
663
+ z3.object({
664
+ message: z3.object({
665
+ role: z3.literal("assistant").nullish(),
666
+ content: z3.string().nullish(),
667
+ reasoning_content: z3.string().nullish(),
668
+ tool_calls: z3.array(
669
+ z3.object({
670
+ id: z3.string().nullish(),
671
+ type: z3.literal("function"),
672
+ function: z3.object({
673
+ name: z3.string(),
674
+ arguments: z3.string()
645
675
  })
646
676
  })
647
677
  ).nullish()
648
678
  }),
649
- finish_reason: z2.string().nullish()
679
+ finish_reason: z3.string().nullish()
650
680
  })
651
681
  ),
652
682
  usage: openaiCompatibleTokenUsageSchema
653
683
  });
654
- var createOpenAICompatibleChatChunkSchema = (errorSchema) => z2.union([
655
- z2.object({
656
- id: z2.string().nullish(),
657
- created: z2.number().nullish(),
658
- model: z2.string().nullish(),
659
- choices: z2.array(
660
- z2.object({
661
- delta: z2.object({
662
- role: z2.enum(["assistant"]).nullish(),
663
- content: z2.string().nullish(),
664
- reasoning_content: z2.string().nullish(),
665
- tool_calls: z2.array(
666
- z2.object({
667
- index: z2.number(),
668
- id: z2.string().nullish(),
669
- type: z2.literal("function").optional(),
670
- function: z2.object({
671
- name: z2.string().nullish(),
672
- arguments: z2.string().nullish()
684
+ var createOpenAICompatibleChatChunkSchema = (errorSchema) => z3.union([
685
+ z3.object({
686
+ id: z3.string().nullish(),
687
+ created: z3.number().nullish(),
688
+ model: z3.string().nullish(),
689
+ choices: z3.array(
690
+ z3.object({
691
+ delta: z3.object({
692
+ role: z3.enum(["assistant"]).nullish(),
693
+ content: z3.string().nullish(),
694
+ reasoning_content: z3.string().nullish(),
695
+ tool_calls: z3.array(
696
+ z3.object({
697
+ index: z3.number(),
698
+ id: z3.string().nullish(),
699
+ type: z3.literal("function").optional(),
700
+ function: z3.object({
701
+ name: z3.string().nullish(),
702
+ arguments: z3.string().nullish()
673
703
  })
674
704
  })
675
705
  ).nullish()
676
706
  }).nullish(),
677
- finish_reason: z2.string().nullish()
707
+ finish_reason: z3.string().nullish()
678
708
  })
679
709
  ),
680
710
  usage: openaiCompatibleTokenUsageSchema
@@ -688,9 +718,10 @@ import {
688
718
  createEventSourceResponseHandler as createEventSourceResponseHandler2,
689
719
  createJsonErrorResponseHandler as createJsonErrorResponseHandler2,
690
720
  createJsonResponseHandler as createJsonResponseHandler2,
721
+ parseProviderOptions as parseProviderOptions2,
691
722
  postJsonToApi as postJsonToApi2
692
723
  } from "@ai-sdk/provider-utils";
693
- import { z as z3 } from "zod";
724
+ import { z as z5 } from "zod";
694
725
 
695
726
  // src/convert-to-openai-compatible-completion-prompt.ts
696
727
  import {
@@ -774,15 +805,39 @@ ${user}:`]
774
805
  };
775
806
  }
776
807
 
808
+ // src/openai-compatible-completion-options.ts
809
+ import { z as z4 } from "zod";
810
+ var openaiCompatibleCompletionProviderOptions = z4.object({
811
+ /**
812
+ * Echo back the prompt in addition to the completion.
813
+ */
814
+ echo: z4.boolean().optional(),
815
+ /**
816
+ * Modify the likelihood of specified tokens appearing in the completion.
817
+ *
818
+ * Accepts a JSON object that maps tokens (specified by their token ID in
819
+ * the GPT tokenizer) to an associated bias value from -100 to 100.
820
+ */
821
+ logitBias: z4.record(z4.number(), z4.number()).optional(),
822
+ /**
823
+ * The suffix that comes after a completion of inserted text.
824
+ */
825
+ suffix: z4.string().optional(),
826
+ /**
827
+ * A unique identifier representing your end-user, which can help providers to
828
+ * monitor and detect abuse.
829
+ */
830
+ user: z4.string().optional()
831
+ });
832
+
777
833
  // src/openai-compatible-completion-language-model.ts
778
834
  var OpenAICompatibleCompletionLanguageModel = class {
779
835
  // type inferred via constructor
780
- constructor(modelId, settings, config) {
836
+ constructor(modelId, config) {
781
837
  this.specificationVersion = "v2";
782
838
  this.defaultObjectGenerationMode = void 0;
783
839
  var _a;
784
840
  this.modelId = modelId;
785
- this.settings = settings;
786
841
  this.config = config;
787
842
  const errorStructure = (_a = config.errorStructure) != null ? _a : defaultOpenAICompatibleErrorStructure;
788
843
  this.chunkSchema = createOpenAICompatibleCompletionChunkSchema(
@@ -812,7 +867,13 @@ var OpenAICompatibleCompletionLanguageModel = class {
812
867
  tools,
813
868
  toolChoice
814
869
  }) {
870
+ var _a;
815
871
  const warnings = [];
872
+ const completionOptions = (_a = parseProviderOptions2({
873
+ provider: this.providerOptionsName,
874
+ providerOptions,
875
+ schema: openaiCompatibleCompletionProviderOptions
876
+ })) != null ? _a : {};
816
877
  if (topK != null) {
817
878
  warnings.push({ type: "unsupported-setting", setting: "topK" });
818
879
  }
@@ -836,10 +897,10 @@ var OpenAICompatibleCompletionLanguageModel = class {
836
897
  // model id:
837
898
  model: this.modelId,
838
899
  // model specific settings:
839
- echo: this.settings.echo,
840
- logit_bias: this.settings.logitBias,
841
- suffix: this.settings.suffix,
842
- user: this.settings.user,
900
+ echo: completionOptions.echo,
901
+ logit_bias: completionOptions.logitBias,
902
+ suffix: completionOptions.suffix,
903
+ user: completionOptions.user,
843
904
  // standardized settings:
844
905
  max_tokens: maxOutputTokens,
845
906
  temperature,
@@ -879,7 +940,7 @@ var OpenAICompatibleCompletionLanguageModel = class {
879
940
  });
880
941
  const choice = response.choices[0];
881
942
  return {
882
- text: choice.text,
943
+ text: { type: "text", text: choice.text },
883
944
  usage: {
884
945
  inputTokens: (_b = (_a = response.usage) == null ? void 0 : _a.prompt_tokens) != null ? _b : void 0,
885
946
  outputTokens: (_d = (_c = response.usage) == null ? void 0 : _c.completion_tokens) != null ? _d : void 0
@@ -955,8 +1016,8 @@ var OpenAICompatibleCompletionLanguageModel = class {
955
1016
  }
956
1017
  if ((choice == null ? void 0 : choice.text) != null) {
957
1018
  controller.enqueue({
958
- type: "text-delta",
959
- textDelta: choice.text
1019
+ type: "text",
1020
+ text: choice.text
960
1021
  });
961
1022
  }
962
1023
  },
@@ -975,36 +1036,36 @@ var OpenAICompatibleCompletionLanguageModel = class {
975
1036
  };
976
1037
  }
977
1038
  };
978
- var openaiCompatibleCompletionResponseSchema = z3.object({
979
- id: z3.string().nullish(),
980
- created: z3.number().nullish(),
981
- model: z3.string().nullish(),
982
- choices: z3.array(
983
- z3.object({
984
- text: z3.string(),
985
- finish_reason: z3.string()
1039
+ var openaiCompatibleCompletionResponseSchema = z5.object({
1040
+ id: z5.string().nullish(),
1041
+ created: z5.number().nullish(),
1042
+ model: z5.string().nullish(),
1043
+ choices: z5.array(
1044
+ z5.object({
1045
+ text: z5.string(),
1046
+ finish_reason: z5.string()
986
1047
  })
987
1048
  ),
988
- usage: z3.object({
989
- prompt_tokens: z3.number(),
990
- completion_tokens: z3.number()
1049
+ usage: z5.object({
1050
+ prompt_tokens: z5.number(),
1051
+ completion_tokens: z5.number()
991
1052
  }).nullish()
992
1053
  });
993
- var createOpenAICompatibleCompletionChunkSchema = (errorSchema) => z3.union([
994
- z3.object({
995
- id: z3.string().nullish(),
996
- created: z3.number().nullish(),
997
- model: z3.string().nullish(),
998
- choices: z3.array(
999
- z3.object({
1000
- text: z3.string(),
1001
- finish_reason: z3.string().nullish(),
1002
- index: z3.number()
1054
+ var createOpenAICompatibleCompletionChunkSchema = (errorSchema) => z5.union([
1055
+ z5.object({
1056
+ id: z5.string().nullish(),
1057
+ created: z5.number().nullish(),
1058
+ model: z5.string().nullish(),
1059
+ choices: z5.array(
1060
+ z5.object({
1061
+ text: z5.string(),
1062
+ finish_reason: z5.string().nullish(),
1063
+ index: z5.number()
1003
1064
  })
1004
1065
  ),
1005
- usage: z3.object({
1006
- prompt_tokens: z3.number(),
1007
- completion_tokens: z3.number()
1066
+ usage: z5.object({
1067
+ prompt_tokens: z5.number(),
1068
+ completion_tokens: z5.number()
1008
1069
  }).nullish()
1009
1070
  }),
1010
1071
  errorSchema
@@ -1018,14 +1079,31 @@ import {
1018
1079
  combineHeaders as combineHeaders3,
1019
1080
  createJsonErrorResponseHandler as createJsonErrorResponseHandler3,
1020
1081
  createJsonResponseHandler as createJsonResponseHandler3,
1082
+ parseProviderOptions as parseProviderOptions3,
1021
1083
  postJsonToApi as postJsonToApi3
1022
1084
  } from "@ai-sdk/provider-utils";
1023
- import { z as z4 } from "zod";
1085
+ import { z as z7 } from "zod";
1086
+
1087
+ // src/openai-compatible-embedding-options.ts
1088
+ import { z as z6 } from "zod";
1089
+ var openaiCompatibleEmbeddingProviderOptions = z6.object({
1090
+ /**
1091
+ * The number of dimensions the resulting output embeddings should have.
1092
+ * Only supported in text-embedding-3 and later models.
1093
+ */
1094
+ dimensions: z6.number().optional(),
1095
+ /**
1096
+ * A unique identifier representing your end-user, which can help providers to
1097
+ * monitor and detect abuse.
1098
+ */
1099
+ user: z6.string().optional()
1100
+ });
1101
+
1102
+ // src/openai-compatible-embedding-model.ts
1024
1103
  var OpenAICompatibleEmbeddingModel = class {
1025
- constructor(modelId, settings, config) {
1026
- this.specificationVersion = "v1";
1104
+ constructor(modelId, config) {
1105
+ this.specificationVersion = "v2";
1027
1106
  this.modelId = modelId;
1028
- this.settings = settings;
1029
1107
  this.config = config;
1030
1108
  }
1031
1109
  get provider() {
@@ -1039,12 +1117,28 @@ var OpenAICompatibleEmbeddingModel = class {
1039
1117
  var _a;
1040
1118
  return (_a = this.config.supportsParallelCalls) != null ? _a : true;
1041
1119
  }
1120
+ get providerOptionsName() {
1121
+ return this.config.provider.split(".")[0].trim();
1122
+ }
1042
1123
  async doEmbed({
1043
1124
  values,
1044
1125
  headers,
1045
- abortSignal
1126
+ abortSignal,
1127
+ providerOptions
1046
1128
  }) {
1047
- var _a;
1129
+ var _a, _b, _c;
1130
+ const compatibleOptions = Object.assign(
1131
+ (_a = parseProviderOptions3({
1132
+ provider: "openai-compatible",
1133
+ providerOptions,
1134
+ schema: openaiCompatibleEmbeddingProviderOptions
1135
+ })) != null ? _a : {},
1136
+ (_b = parseProviderOptions3({
1137
+ provider: this.providerOptionsName,
1138
+ providerOptions,
1139
+ schema: openaiCompatibleEmbeddingProviderOptions
1140
+ })) != null ? _b : {}
1141
+ );
1048
1142
  if (values.length > this.maxEmbeddingsPerCall) {
1049
1143
  throw new TooManyEmbeddingValuesForCallError({
1050
1144
  provider: this.provider,
@@ -1053,7 +1147,11 @@ var OpenAICompatibleEmbeddingModel = class {
1053
1147
  values
1054
1148
  });
1055
1149
  }
1056
- const { responseHeaders, value: response } = await postJsonToApi3({
1150
+ const {
1151
+ responseHeaders,
1152
+ value: response,
1153
+ rawValue
1154
+ } = await postJsonToApi3({
1057
1155
  url: this.config.url({
1058
1156
  path: "/embeddings",
1059
1157
  modelId: this.modelId
@@ -1063,11 +1161,11 @@ var OpenAICompatibleEmbeddingModel = class {
1063
1161
  model: this.modelId,
1064
1162
  input: values,
1065
1163
  encoding_format: "float",
1066
- dimensions: this.settings.dimensions,
1067
- user: this.settings.user
1164
+ dimensions: compatibleOptions.dimensions,
1165
+ user: compatibleOptions.user
1068
1166
  },
1069
1167
  failedResponseHandler: createJsonErrorResponseHandler3(
1070
- (_a = this.config.errorStructure) != null ? _a : defaultOpenAICompatibleErrorStructure
1168
+ (_c = this.config.errorStructure) != null ? _c : defaultOpenAICompatibleErrorStructure
1071
1169
  ),
1072
1170
  successfulResponseHandler: createJsonResponseHandler3(
1073
1171
  openaiTextEmbeddingResponseSchema
@@ -1078,13 +1176,13 @@ var OpenAICompatibleEmbeddingModel = class {
1078
1176
  return {
1079
1177
  embeddings: response.data.map((item) => item.embedding),
1080
1178
  usage: response.usage ? { tokens: response.usage.prompt_tokens } : void 0,
1081
- rawResponse: { headers: responseHeaders }
1179
+ response: { headers: responseHeaders, body: rawValue }
1082
1180
  };
1083
1181
  }
1084
1182
  };
1085
- var openaiTextEmbeddingResponseSchema = z4.object({
1086
- data: z4.array(z4.object({ embedding: z4.array(z4.number()) })),
1087
- usage: z4.object({ prompt_tokens: z4.number() }).nullish()
1183
+ var openaiTextEmbeddingResponseSchema = z7.object({
1184
+ data: z7.array(z7.object({ embedding: z7.array(z7.number()) })),
1185
+ usage: z7.object({ prompt_tokens: z7.number() }).nullish()
1088
1186
  });
1089
1187
 
1090
1188
  // src/openai-compatible-image-model.ts
@@ -1094,7 +1192,7 @@ import {
1094
1192
  createJsonResponseHandler as createJsonResponseHandler4,
1095
1193
  postJsonToApi as postJsonToApi4
1096
1194
  } from "@ai-sdk/provider-utils";
1097
- import { z as z5 } from "zod";
1195
+ import { z as z8 } from "zod";
1098
1196
  var OpenAICompatibleImageModel = class {
1099
1197
  constructor(modelId, settings, config) {
1100
1198
  this.modelId = modelId;
@@ -1167,8 +1265,8 @@ var OpenAICompatibleImageModel = class {
1167
1265
  };
1168
1266
  }
1169
1267
  };
1170
- var openaiCompatibleImageResponseSchema = z5.object({
1171
- data: z5.array(z5.object({ b64_json: z5.string() }))
1268
+ var openaiCompatibleImageResponseSchema = z8.object({
1269
+ data: z8.array(z8.object({ b64_json: z8.string() }))
1172
1270
  });
1173
1271
 
1174
1272
  // src/openai-compatible-provider.ts
@@ -1192,27 +1290,24 @@ function createOpenAICompatible(options) {
1192
1290
  headers: getHeaders,
1193
1291
  fetch: options.fetch
1194
1292
  });
1195
- const createLanguageModel = (modelId, settings = {}) => createChatModel(modelId, settings);
1196
- const createChatModel = (modelId, settings = {}) => new OpenAICompatibleChatLanguageModel(modelId, settings, {
1293
+ const createLanguageModel = (modelId) => createChatModel(modelId);
1294
+ const createChatModel = (modelId) => new OpenAICompatibleChatLanguageModel(modelId, {
1197
1295
  ...getCommonModelConfig("chat"),
1198
1296
  defaultObjectGenerationMode: "tool"
1199
1297
  });
1200
- const createCompletionModel = (modelId, settings = {}) => new OpenAICompatibleCompletionLanguageModel(
1298
+ const createCompletionModel = (modelId) => new OpenAICompatibleCompletionLanguageModel(
1201
1299
  modelId,
1202
- settings,
1203
1300
  getCommonModelConfig("completion")
1204
1301
  );
1205
- const createEmbeddingModel = (modelId, settings = {}) => new OpenAICompatibleEmbeddingModel(
1206
- modelId,
1207
- settings,
1208
- getCommonModelConfig("embedding")
1209
- );
1302
+ const createEmbeddingModel = (modelId) => new OpenAICompatibleEmbeddingModel(modelId, {
1303
+ ...getCommonModelConfig("embedding")
1304
+ });
1210
1305
  const createImageModel = (modelId, settings = {}) => new OpenAICompatibleImageModel(
1211
1306
  modelId,
1212
1307
  settings,
1213
1308
  getCommonModelConfig("image")
1214
1309
  );
1215
- const provider = (modelId, settings) => createLanguageModel(modelId, settings);
1310
+ const provider = (modelId) => createLanguageModel(modelId);
1216
1311
  provider.languageModel = createLanguageModel;
1217
1312
  provider.chatModel = createChatModel;
1218
1313
  provider.completionModel = createCompletionModel;