@ai-sdk/mistral 3.0.74 → 3.0.76

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
@@ -13,6 +13,8 @@ import {
13
13
  InvalidResponseDataError
14
14
  } from "@ai-sdk/provider";
15
15
  import {
16
+ lazySchema as lazySchema3,
17
+ zodSchema as zodSchema3,
16
18
  combineHeaders,
17
19
  createEventSourceResponseHandler,
18
20
  createJsonResponseHandler,
@@ -253,54 +255,70 @@ function mapMistralFinishReason(finishReason) {
253
255
  }
254
256
 
255
257
  // src/mistral-chat-options.ts
258
+ import {
259
+ lazySchema,
260
+ zodSchema
261
+ } from "@ai-sdk/provider-utils";
256
262
  import { z as z2 } from "zod/v4";
257
- var mistralLanguageModelOptions = z2.object({
258
- /**
259
- * Whether to inject a safety prompt before all conversations.
260
- *
261
- * Defaults to `false`.
262
- */
263
- safePrompt: z2.boolean().optional(),
264
- documentImageLimit: z2.number().optional(),
265
- documentPageLimit: z2.number().optional(),
266
- /**
267
- * Whether to use structured outputs.
268
- *
269
- * @default true
270
- */
271
- structuredOutputs: z2.boolean().optional(),
272
- /**
273
- * Whether to use strict JSON schema validation.
274
- *
275
- * @default false
276
- */
277
- strictJsonSchema: z2.boolean().optional(),
278
- /**
279
- * Whether to enable parallel function calling during tool use.
280
- * When set to false, the model will use at most one tool per response.
281
- *
282
- * @default true
283
- */
284
- parallelToolCalls: z2.boolean().optional(),
285
- /**
286
- * Controls the reasoning effort for models that support adjustable reasoning.
287
- *
288
- * - `'high'`: Enable reasoning
289
- * - `'none'`: Disable reasoning
290
- */
291
- reasoningEffort: z2.enum(["high", "none"]).optional()
292
- });
263
+ var mistralLanguageModelOptions = lazySchema(
264
+ () => zodSchema(
265
+ z2.object({
266
+ /**
267
+ * Whether to inject a safety prompt before all conversations.
268
+ *
269
+ * Defaults to `false`.
270
+ */
271
+ safePrompt: z2.boolean().optional(),
272
+ documentImageLimit: z2.number().optional(),
273
+ documentPageLimit: z2.number().optional(),
274
+ /**
275
+ * Whether to use structured outputs.
276
+ *
277
+ * @default true
278
+ */
279
+ structuredOutputs: z2.boolean().optional(),
280
+ /**
281
+ * Whether to use strict JSON schema validation.
282
+ *
283
+ * @default false
284
+ */
285
+ strictJsonSchema: z2.boolean().optional(),
286
+ /**
287
+ * Whether to enable parallel function calling during tool use.
288
+ * When set to false, the model will use at most one tool per response.
289
+ *
290
+ * @default true
291
+ */
292
+ parallelToolCalls: z2.boolean().optional(),
293
+ /**
294
+ * Controls the reasoning effort for models that support adjustable reasoning.
295
+ *
296
+ * - `'high'`: Enable reasoning
297
+ * - `'none'`: Disable reasoning
298
+ */
299
+ reasoningEffort: z2.enum(["high", "none"]).optional()
300
+ })
301
+ )
302
+ );
293
303
 
294
304
  // src/mistral-error.ts
295
- import { createJsonErrorResponseHandler } from "@ai-sdk/provider-utils";
305
+ import {
306
+ lazySchema as lazySchema2,
307
+ zodSchema as zodSchema2,
308
+ createJsonErrorResponseHandler
309
+ } from "@ai-sdk/provider-utils";
296
310
  import { z as z3 } from "zod/v4";
297
- var mistralErrorDataSchema = z3.object({
298
- object: z3.literal("error"),
299
- message: z3.string(),
300
- type: z3.string(),
301
- param: z3.string().nullable(),
302
- code: z3.string().nullable()
303
- });
311
+ var mistralErrorDataSchema = lazySchema2(
312
+ () => zodSchema2(
313
+ z3.object({
314
+ object: z3.literal("error"),
315
+ message: z3.string(),
316
+ type: z3.string(),
317
+ param: z3.string().nullable(),
318
+ code: z3.string().nullable()
319
+ })
320
+ )
321
+ );
304
322
  var mistralFailedResponseHandler = createJsonErrorResponseHandler({
305
323
  errorSchema: mistralErrorDataSchema,
306
324
  errorToMessage: (data) => data.message
@@ -750,7 +768,7 @@ function extractTextContent(content) {
750
768
  }
751
769
  return textContent.length ? textContent.join("") : void 0;
752
770
  }
753
- var mistralContentSchema = z4.union([
771
+ var mistralContentSchema = () => z4.union([
754
772
  z4.string(),
755
773
  z4.array(
756
774
  z4.discriminatedUnion("type", [
@@ -784,61 +802,74 @@ var mistralContentSchema = z4.union([
784
802
  ])
785
803
  )
786
804
  ]).nullish();
787
- var mistralChatResponseSchema = z4.object({
788
- id: z4.string().nullish(),
789
- created: z4.number().nullish(),
790
- model: z4.string().nullish(),
791
- choices: z4.array(
805
+ var mistralChatResponseSchema = lazySchema3(
806
+ () => zodSchema3(
792
807
  z4.object({
793
- message: z4.object({
794
- role: z4.literal("assistant"),
795
- content: mistralContentSchema,
796
- tool_calls: z4.array(
797
- z4.object({
798
- id: z4.string(),
799
- function: z4.object({ name: z4.string(), arguments: z4.string() })
800
- })
801
- ).nullish()
802
- }),
803
- index: z4.number(),
804
- finish_reason: z4.string().nullish()
808
+ id: z4.string().nullish(),
809
+ created: z4.number().nullish(),
810
+ model: z4.string().nullish(),
811
+ choices: z4.array(
812
+ z4.object({
813
+ message: z4.object({
814
+ role: z4.literal("assistant"),
815
+ content: mistralContentSchema(),
816
+ tool_calls: z4.array(
817
+ z4.object({
818
+ id: z4.string(),
819
+ function: z4.object({
820
+ name: z4.string(),
821
+ arguments: z4.string()
822
+ })
823
+ })
824
+ ).nullish()
825
+ }),
826
+ index: z4.number(),
827
+ finish_reason: z4.string().nullish()
828
+ })
829
+ ),
830
+ object: z4.literal("chat.completion"),
831
+ usage: mistralUsageSchema
805
832
  })
806
- ),
807
- object: z4.literal("chat.completion"),
808
- usage: mistralUsageSchema
809
- });
810
- var mistralChatChunkSchema = z4.object({
811
- id: z4.string().nullish(),
812
- created: z4.number().nullish(),
813
- model: z4.string().nullish(),
814
- choices: z4.array(
833
+ )
834
+ );
835
+ var mistralChatChunkSchema = lazySchema3(
836
+ () => zodSchema3(
815
837
  z4.object({
816
- delta: z4.object({
817
- role: z4.enum(["assistant"]).optional(),
818
- content: mistralContentSchema,
819
- tool_calls: z4.array(
820
- z4.object({
821
- index: z4.number().nullish(),
822
- id: z4.string().nullish(),
823
- function: z4.object({
824
- name: z4.string().nullish(),
825
- arguments: z4.string().nullish()
826
- })
827
- })
828
- ).nullish()
829
- }),
830
- finish_reason: z4.string().nullish(),
831
- index: z4.number()
838
+ id: z4.string().nullish(),
839
+ created: z4.number().nullish(),
840
+ model: z4.string().nullish(),
841
+ choices: z4.array(
842
+ z4.object({
843
+ delta: z4.object({
844
+ role: z4.enum(["assistant"]).optional(),
845
+ content: mistralContentSchema(),
846
+ tool_calls: z4.array(
847
+ z4.object({
848
+ index: z4.number().nullish(),
849
+ id: z4.string().nullish(),
850
+ function: z4.object({
851
+ name: z4.string().nullish(),
852
+ arguments: z4.string().nullish()
853
+ })
854
+ })
855
+ ).nullish()
856
+ }),
857
+ finish_reason: z4.string().nullish(),
858
+ index: z4.number()
859
+ })
860
+ ),
861
+ usage: mistralUsageSchema.nullish()
832
862
  })
833
- ),
834
- usage: mistralUsageSchema.nullish()
835
- });
863
+ )
864
+ );
836
865
 
837
866
  // src/mistral-embedding-model.ts
838
867
  import {
839
868
  TooManyEmbeddingValuesForCallError
840
869
  } from "@ai-sdk/provider";
841
870
  import {
871
+ lazySchema as lazySchema4,
872
+ zodSchema as zodSchema4,
842
873
  combineHeaders as combineHeaders2,
843
874
  createJsonResponseHandler as createJsonResponseHandler2,
844
875
  postJsonToApi as postJsonToApi2
@@ -895,13 +926,19 @@ var MistralEmbeddingModel = class {
895
926
  };
896
927
  }
897
928
  };
898
- var MistralTextEmbeddingResponseSchema = z5.object({
899
- data: z5.array(z5.object({ embedding: z5.array(z5.number()) })),
900
- usage: z5.object({ prompt_tokens: z5.number() }).nullish()
901
- });
929
+ var MistralTextEmbeddingResponseSchema = lazySchema4(
930
+ () => zodSchema4(
931
+ z5.object({
932
+ data: z5.array(z5.object({ embedding: z5.array(z5.number()) })),
933
+ usage: z5.object({ prompt_tokens: z5.number() }).nullish()
934
+ })
935
+ )
936
+ );
902
937
 
903
938
  // src/mistral-speech-model.ts
904
939
  import {
940
+ lazySchema as lazySchema6,
941
+ zodSchema as zodSchema6,
905
942
  combineHeaders as combineHeaders3,
906
943
  createJsonResponseHandler as createJsonResponseHandler3,
907
944
  parseProviderOptions as parseProviderOptions2,
@@ -910,15 +947,33 @@ import {
910
947
  import { z as z7 } from "zod/v4";
911
948
 
912
949
  // src/mistral-speech-model-options.ts
950
+ import {
951
+ lazySchema as lazySchema5,
952
+ zodSchema as zodSchema5
953
+ } from "@ai-sdk/provider-utils";
913
954
  import { z as z6 } from "zod/v4";
914
- var mistralSpeechModelOptions = z6.object({
915
- /**
916
- * Base64-encoded reference audio for one-off voice cloning.
917
- *
918
- * When provided, this takes precedence over the standard `voice` option.
919
- */
920
- refAudio: z6.string().min(1).optional()
921
- });
955
+ var mistralSpeechModelOptions = lazySchema5(
956
+ () => zodSchema5(
957
+ z6.object({
958
+ /**
959
+ * Base64-encoded reference audio for one-off voice cloning.
960
+ *
961
+ * When provided, this takes precedence over the standard `voice` option.
962
+ */
963
+ refAudio: z6.string().min(1).optional(),
964
+ /**
965
+ * How expressive the speech is, from 1 to 5. Higher values trade voice
966
+ * similarity and stability for stronger delivery. Supported by Voxtral 3.
967
+ */
968
+ expressiveness: z6.number().min(1).max(5).optional(),
969
+ /**
970
+ * Pronunciation hints mapping words to lists of IPA phonemes.
971
+ * Supported by Voxtral 3.
972
+ */
973
+ phonemeHints: z6.record(z6.string().min(1), z6.array(z6.string().min(1)).min(1)).optional()
974
+ })
975
+ )
976
+ );
922
977
 
923
978
  // src/mistral-speech-model.ts
924
979
  var MistralSpeechModel = class {
@@ -982,6 +1037,8 @@ var MistralSpeechModel = class {
982
1037
  input: text,
983
1038
  voice_id: refAudio == null ? voice : void 0,
984
1039
  ref_audio: refAudio,
1040
+ expressiveness: mistralOptions == null ? void 0 : mistralOptions.expressiveness,
1041
+ phoneme_hints: mistralOptions == null ? void 0 : mistralOptions.phonemeHints,
985
1042
  response_format: responseFormat,
986
1043
  stream: false
987
1044
  };
@@ -1032,12 +1089,16 @@ var MistralSpeechModel = class {
1032
1089
  };
1033
1090
  }
1034
1091
  };
1035
- var mistralSpeechResponseSchema = z7.object({
1036
- audio_data: z7.string()
1037
- });
1092
+ var mistralSpeechResponseSchema = lazySchema6(
1093
+ () => zodSchema6(
1094
+ z7.object({
1095
+ audio_data: z7.string()
1096
+ })
1097
+ )
1098
+ );
1038
1099
 
1039
1100
  // src/version.ts
1040
- var VERSION = true ? "3.0.74" : "0.0.0-test";
1101
+ var VERSION = true ? "3.0.76" : "0.0.0-test";
1041
1102
 
1042
1103
  // src/mistral-provider.ts
1043
1104
  function createMistral(options = {}) {