@ai-sdk/mistral 4.0.0-beta.2 → 4.0.0-beta.21

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,148 @@
1
1
  # @ai-sdk/mistral
2
2
 
3
+ ## 4.0.0-beta.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [90e2d8a]
8
+ - @ai-sdk/provider-utils@5.0.0-beta.18
9
+
10
+ ## 4.0.0-beta.20
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [3ae1786]
15
+ - @ai-sdk/provider-utils@5.0.0-beta.17
16
+
17
+ ## 4.0.0-beta.19
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [176466a]
22
+ - @ai-sdk/provider@4.0.0-beta.10
23
+ - @ai-sdk/provider-utils@5.0.0-beta.16
24
+
25
+ ## 4.0.0-beta.18
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [e311194]
30
+ - @ai-sdk/provider@4.0.0-beta.9
31
+ - @ai-sdk/provider-utils@5.0.0-beta.15
32
+
33
+ ## 4.0.0-beta.17
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [34bd95d]
38
+ - Updated dependencies [008271d]
39
+ - @ai-sdk/provider@4.0.0-beta.8
40
+ - @ai-sdk/provider-utils@5.0.0-beta.14
41
+
42
+ ## 4.0.0-beta.16
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [b0c2869]
47
+ - Updated dependencies [7e26e81]
48
+ - @ai-sdk/provider-utils@5.0.0-beta.13
49
+
50
+ ## 4.0.0-beta.15
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [46d1149]
55
+ - @ai-sdk/provider-utils@5.0.0-beta.12
56
+
57
+ ## 4.0.0-beta.14
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [6fd51c0]
62
+ - @ai-sdk/provider-utils@5.0.0-beta.11
63
+ - @ai-sdk/provider@4.0.0-beta.7
64
+
65
+ ## 4.0.0-beta.13
66
+
67
+ ### Patch Changes
68
+
69
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
70
+ - Updated dependencies [c29a26f]
71
+ - @ai-sdk/provider-utils@5.0.0-beta.10
72
+ - @ai-sdk/provider@4.0.0-beta.6
73
+
74
+ ## 4.0.0-beta.12
75
+
76
+ ### Patch Changes
77
+
78
+ - 38fc777: Add AI Gateway hint to provider READMEs
79
+
80
+ ## 4.0.0-beta.11
81
+
82
+ ### Patch Changes
83
+
84
+ - Updated dependencies [2e17091]
85
+ - @ai-sdk/provider-utils@5.0.0-beta.9
86
+
87
+ ## 4.0.0-beta.10
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [986c6fd]
92
+ - Updated dependencies [493295c]
93
+ - @ai-sdk/provider-utils@5.0.0-beta.8
94
+
95
+ ## 4.0.0-beta.9
96
+
97
+ ### Patch Changes
98
+
99
+ - Updated dependencies [1f509d4]
100
+ - @ai-sdk/provider-utils@5.0.0-beta.7
101
+ - @ai-sdk/provider@4.0.0-beta.5
102
+
103
+ ## 4.0.0-beta.8
104
+
105
+ ### Patch Changes
106
+
107
+ - 737b8f4: feat(provider/mistral): add support for reasoning configuration (mistral-small-latest)
108
+
109
+ ## 4.0.0-beta.7
110
+
111
+ ### Patch Changes
112
+
113
+ - 5259a95: chore: add warning for providers that do not support new reasoning parameter
114
+
115
+ ## 4.0.0-beta.6
116
+
117
+ ### Patch Changes
118
+
119
+ - Updated dependencies [3887c70]
120
+ - @ai-sdk/provider-utils@5.0.0-beta.6
121
+ - @ai-sdk/provider@4.0.0-beta.4
122
+
123
+ ## 4.0.0-beta.5
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies [776b617]
128
+ - @ai-sdk/provider-utils@5.0.0-beta.5
129
+ - @ai-sdk/provider@4.0.0-beta.3
130
+
131
+ ## 4.0.0-beta.4
132
+
133
+ ### Patch Changes
134
+
135
+ - Updated dependencies [61753c3]
136
+ - @ai-sdk/provider-utils@5.0.0-beta.4
137
+
138
+ ## 4.0.0-beta.3
139
+
140
+ ### Patch Changes
141
+
142
+ - Updated dependencies [f7d4f01]
143
+ - @ai-sdk/provider-utils@5.0.0-beta.3
144
+ - @ai-sdk/provider@4.0.0-beta.2
145
+
3
146
  ## 4.0.0-beta.2
4
147
 
5
148
  ### Patch Changes
@@ -218,13 +361,13 @@
218
361
  Before
219
362
 
220
363
  ```ts
221
- model.textEmbeddingModel('my-model-id');
364
+ model.textEmbeddingModel("my-model-id");
222
365
  ```
223
366
 
224
367
  After
225
368
 
226
369
  ```ts
227
- model.embeddingModel('my-model-id');
370
+ model.embeddingModel("my-model-id");
228
371
  ```
229
372
 
230
373
  - 2625a04: feat(openai); update spec for mcp approval
@@ -439,13 +582,13 @@
439
582
  Before
440
583
 
441
584
  ```ts
442
- model.textEmbeddingModel('my-model-id');
585
+ model.textEmbeddingModel("my-model-id");
443
586
  ```
444
587
 
445
588
  After
446
589
 
447
590
  ```ts
448
- model.embeddingModel('my-model-id');
591
+ model.embeddingModel("my-model-id");
449
592
  ```
450
593
 
451
594
  - Updated dependencies [8d9e8ad]
@@ -795,12 +938,12 @@
795
938
  - 3429644: feat(provider/mistral): `MistralLanguageModelOptions` type
796
939
 
797
940
  ```ts
798
- import { mistral, type MistralLanguageModelOptions } from '@ai-sdk/mistral';
799
- import { generateText } from 'ai';
941
+ import { mistral, type MistralLanguageModelOptions } from "@ai-sdk/mistral";
942
+ import { generateText } from "ai";
800
943
 
801
944
  await generateText({
802
- model: mistral('open-mistral-7b'),
803
- prompt: 'Invent a new holiday and describe its traditions.',
945
+ model: mistral("open-mistral-7b"),
946
+ prompt: "Invent a new holiday and describe its traditions.",
804
947
  providerOptions: {
805
948
  mistral: {
806
949
  safePrompt: true,
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  The **[Mistral provider](https://ai-sdk.dev/providers/ai-sdk-providers/mistral)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the Mistral chat API.
4
4
 
5
+ > **Deploying to Vercel?** With Vercel's AI Gateway you can access Mistral (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
6
+
5
7
  ## Setup
6
8
 
7
9
  The Mistral provider is available in the `@ai-sdk/mistral` module. You can install it with
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { ProviderV3, LanguageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
1
+ import { ProviderV4, LanguageModelV4, EmbeddingModelV4 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod/v4';
4
4
 
5
- type MistralChatModelId = 'ministral-3b-latest' | 'ministral-8b-latest' | 'mistral-large-latest' | 'mistral-medium-latest' | 'mistral-medium-2508' | 'mistral-medium-2505' | 'mistral-small-latest' | 'pixtral-large-latest' | 'magistral-small-2507' | 'magistral-medium-2507' | 'magistral-small-2506' | 'magistral-medium-2506' | 'pixtral-12b-2409' | 'open-mistral-7b' | 'open-mixtral-8x7b' | 'open-mixtral-8x22b' | (string & {});
5
+ type MistralChatModelId = 'ministral-3b-latest' | 'ministral-8b-latest' | 'ministral-14b-latest' | 'mistral-large-latest' | 'mistral-medium-latest' | 'mistral-large-2512' | 'mistral-medium-2508' | 'mistral-medium-2505' | 'mistral-small-2506' | 'pixtral-large-latest' | 'mistral-small-latest' | 'mistral-small-2603' | 'magistral-medium-latest' | 'magistral-small-latest' | 'magistral-medium-2509' | 'magistral-small-2509' | (string & {});
6
6
  declare const mistralLanguageModelOptions: z.ZodObject<{
7
7
  safePrompt: z.ZodOptional<z.ZodBoolean>;
8
8
  documentImageLimit: z.ZodOptional<z.ZodNumber>;
@@ -10,37 +10,41 @@ declare const mistralLanguageModelOptions: z.ZodObject<{
10
10
  structuredOutputs: z.ZodOptional<z.ZodBoolean>;
11
11
  strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
12
12
  parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
13
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
14
+ none: "none";
15
+ high: "high";
16
+ }>>;
13
17
  }, z.core.$strip>;
14
18
  type MistralLanguageModelOptions = z.infer<typeof mistralLanguageModelOptions>;
15
19
 
16
20
  type MistralEmbeddingModelId = 'mistral-embed' | (string & {});
17
21
 
18
- interface MistralProvider extends ProviderV3 {
19
- (modelId: MistralChatModelId): LanguageModelV3;
22
+ interface MistralProvider extends ProviderV4 {
23
+ (modelId: MistralChatModelId): LanguageModelV4;
20
24
  /**
21
25
  * Creates a model for text generation.
22
26
  */
23
- languageModel(modelId: MistralChatModelId): LanguageModelV3;
27
+ languageModel(modelId: MistralChatModelId): LanguageModelV4;
24
28
  /**
25
29
  * Creates a model for text generation.
26
30
  */
27
- chat(modelId: MistralChatModelId): LanguageModelV3;
31
+ chat(modelId: MistralChatModelId): LanguageModelV4;
28
32
  /**
29
33
  * Creates a model for text embeddings.
30
34
  */
31
- embedding(modelId: MistralEmbeddingModelId): EmbeddingModelV3;
35
+ embedding(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
32
36
  /**
33
37
  * Creates a model for text embeddings.
34
38
  */
35
- embeddingModel: (modelId: MistralEmbeddingModelId) => EmbeddingModelV3;
39
+ embeddingModel: (modelId: MistralEmbeddingModelId) => EmbeddingModelV4;
36
40
  /**
37
41
  * @deprecated Use `embedding` instead.
38
42
  */
39
- textEmbedding(modelId: MistralEmbeddingModelId): EmbeddingModelV3;
43
+ textEmbedding(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
40
44
  /**
41
45
  * @deprecated Use `embeddingModel` instead.
42
46
  */
43
- textEmbeddingModel(modelId: MistralEmbeddingModelId): EmbeddingModelV3;
47
+ textEmbeddingModel(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
44
48
  }
45
49
  interface MistralProviderSettings {
46
50
  /**
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { ProviderV3, LanguageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
1
+ import { ProviderV4, LanguageModelV4, EmbeddingModelV4 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod/v4';
4
4
 
5
- type MistralChatModelId = 'ministral-3b-latest' | 'ministral-8b-latest' | 'mistral-large-latest' | 'mistral-medium-latest' | 'mistral-medium-2508' | 'mistral-medium-2505' | 'mistral-small-latest' | 'pixtral-large-latest' | 'magistral-small-2507' | 'magistral-medium-2507' | 'magistral-small-2506' | 'magistral-medium-2506' | 'pixtral-12b-2409' | 'open-mistral-7b' | 'open-mixtral-8x7b' | 'open-mixtral-8x22b' | (string & {});
5
+ type MistralChatModelId = 'ministral-3b-latest' | 'ministral-8b-latest' | 'ministral-14b-latest' | 'mistral-large-latest' | 'mistral-medium-latest' | 'mistral-large-2512' | 'mistral-medium-2508' | 'mistral-medium-2505' | 'mistral-small-2506' | 'pixtral-large-latest' | 'mistral-small-latest' | 'mistral-small-2603' | 'magistral-medium-latest' | 'magistral-small-latest' | 'magistral-medium-2509' | 'magistral-small-2509' | (string & {});
6
6
  declare const mistralLanguageModelOptions: z.ZodObject<{
7
7
  safePrompt: z.ZodOptional<z.ZodBoolean>;
8
8
  documentImageLimit: z.ZodOptional<z.ZodNumber>;
@@ -10,37 +10,41 @@ declare const mistralLanguageModelOptions: z.ZodObject<{
10
10
  structuredOutputs: z.ZodOptional<z.ZodBoolean>;
11
11
  strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
12
12
  parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
13
+ reasoningEffort: z.ZodOptional<z.ZodEnum<{
14
+ none: "none";
15
+ high: "high";
16
+ }>>;
13
17
  }, z.core.$strip>;
14
18
  type MistralLanguageModelOptions = z.infer<typeof mistralLanguageModelOptions>;
15
19
 
16
20
  type MistralEmbeddingModelId = 'mistral-embed' | (string & {});
17
21
 
18
- interface MistralProvider extends ProviderV3 {
19
- (modelId: MistralChatModelId): LanguageModelV3;
22
+ interface MistralProvider extends ProviderV4 {
23
+ (modelId: MistralChatModelId): LanguageModelV4;
20
24
  /**
21
25
  * Creates a model for text generation.
22
26
  */
23
- languageModel(modelId: MistralChatModelId): LanguageModelV3;
27
+ languageModel(modelId: MistralChatModelId): LanguageModelV4;
24
28
  /**
25
29
  * Creates a model for text generation.
26
30
  */
27
- chat(modelId: MistralChatModelId): LanguageModelV3;
31
+ chat(modelId: MistralChatModelId): LanguageModelV4;
28
32
  /**
29
33
  * Creates a model for text embeddings.
30
34
  */
31
- embedding(modelId: MistralEmbeddingModelId): EmbeddingModelV3;
35
+ embedding(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
32
36
  /**
33
37
  * Creates a model for text embeddings.
34
38
  */
35
- embeddingModel: (modelId: MistralEmbeddingModelId) => EmbeddingModelV3;
39
+ embeddingModel: (modelId: MistralEmbeddingModelId) => EmbeddingModelV4;
36
40
  /**
37
41
  * @deprecated Use `embedding` instead.
38
42
  */
39
- textEmbedding(modelId: MistralEmbeddingModelId): EmbeddingModelV3;
43
+ textEmbedding(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
40
44
  /**
41
45
  * @deprecated Use `embeddingModel` instead.
42
46
  */
43
- textEmbeddingModel(modelId: MistralEmbeddingModelId): EmbeddingModelV3;
47
+ textEmbeddingModel(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
44
48
  }
45
49
  interface MistralProviderSettings {
46
50
  /**
package/dist/index.js CHANGED
@@ -99,6 +99,11 @@ function convertToMistralChatMessages(prompt) {
99
99
  return { type: "text", text: part.text };
100
100
  }
101
101
  case "file": {
102
+ if ((0, import_provider_utils.isProviderReference)(part.data)) {
103
+ throw new import_provider.UnsupportedFunctionalityError({
104
+ functionality: "file parts with provider references"
105
+ });
106
+ }
102
107
  if (part.mediaType.startsWith("image/")) {
103
108
  const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
104
109
  return {
@@ -259,7 +264,14 @@ var mistralLanguageModelOptions = import_v4.z.object({
259
264
  *
260
265
  * @default true
261
266
  */
262
- parallelToolCalls: import_v4.z.boolean().optional()
267
+ parallelToolCalls: import_v4.z.boolean().optional(),
268
+ /**
269
+ * Controls the reasoning effort for models that support adjustable reasoning.
270
+ *
271
+ * - `'high'`: Enable reasoning
272
+ * - `'none'`: Disable reasoning
273
+ */
274
+ reasoningEffort: import_v4.z.enum(["high", "none"]).optional()
263
275
  });
264
276
 
265
277
  // src/mistral-error.ts
@@ -339,7 +351,7 @@ function prepareTools({
339
351
  // src/mistral-chat-language-model.ts
340
352
  var MistralChatLanguageModel = class {
341
353
  constructor(modelId, config) {
342
- this.specificationVersion = "v3";
354
+ this.specificationVersion = "v4";
343
355
  this.supportedUrls = {
344
356
  "application/pdf": [/^https:\/\/.*$/]
345
357
  };
@@ -359,6 +371,7 @@ var MistralChatLanguageModel = class {
359
371
  topK,
360
372
  frequencyPenalty,
361
373
  presencePenalty,
374
+ reasoning,
362
375
  stopSequences,
363
376
  responseFormat,
364
377
  seed,
@@ -366,7 +379,7 @@ var MistralChatLanguageModel = class {
366
379
  tools,
367
380
  toolChoice
368
381
  }) {
369
- var _a, _b, _c, _d;
382
+ var _a, _b, _c, _d, _e;
370
383
  const warnings = [];
371
384
  const options = (_a = await (0, import_provider_utils3.parseProviderOptions)({
372
385
  provider: "mistral",
@@ -385,8 +398,29 @@ var MistralChatLanguageModel = class {
385
398
  if (stopSequences != null) {
386
399
  warnings.push({ type: "unsupported", feature: "stopSequences" });
387
400
  }
388
- const structuredOutputs = (_b = options.structuredOutputs) != null ? _b : true;
389
- const strictJsonSchema = (_c = options.strictJsonSchema) != null ? _c : false;
401
+ const supportsReasoningEffort = this.modelId === "mistral-small-latest" || this.modelId === "mistral-small-2603";
402
+ let resolvedReasoningEffort;
403
+ if (supportsReasoningEffort) {
404
+ resolvedReasoningEffort = (_b = options.reasoningEffort) != null ? _b : (0, import_provider_utils3.isCustomReasoning)(reasoning) ? reasoning === "none" ? "none" : (0, import_provider_utils3.mapReasoningToProviderEffort)({
405
+ reasoning,
406
+ effortMap: {
407
+ minimal: "high",
408
+ low: "high",
409
+ medium: "high",
410
+ high: "high",
411
+ xhigh: "high"
412
+ },
413
+ warnings
414
+ }) : void 0;
415
+ } else if ((0, import_provider_utils3.isCustomReasoning)(reasoning)) {
416
+ warnings.push({
417
+ type: "unsupported",
418
+ feature: "reasoning",
419
+ details: "This model does not support reasoning configuration."
420
+ });
421
+ }
422
+ const structuredOutputs = (_c = options.structuredOutputs) != null ? _c : true;
423
+ const strictJsonSchema = (_d = options.strictJsonSchema) != null ? _d : false;
390
424
  if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && !(responseFormat == null ? void 0 : responseFormat.schema)) {
391
425
  prompt = (0, import_provider_utils3.injectJsonInstructionIntoMessages)({
392
426
  messages: prompt,
@@ -403,13 +437,14 @@ var MistralChatLanguageModel = class {
403
437
  temperature,
404
438
  top_p: topP,
405
439
  random_seed: seed,
440
+ reasoning_effort: resolvedReasoningEffort,
406
441
  // response format:
407
442
  response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? structuredOutputs && (responseFormat == null ? void 0 : responseFormat.schema) != null ? {
408
443
  type: "json_schema",
409
444
  json_schema: {
410
445
  schema: responseFormat.schema,
411
446
  strict: strictJsonSchema,
412
- name: (_d = responseFormat.name) != null ? _d : "response",
447
+ name: (_e = responseFormat.name) != null ? _e : "response",
413
448
  description: responseFormat.description
414
449
  }
415
450
  } : { type: "json_object" } : void 0,
@@ -773,7 +808,7 @@ var import_provider_utils4 = require("@ai-sdk/provider-utils");
773
808
  var import_v44 = require("zod/v4");
774
809
  var MistralEmbeddingModel = class {
775
810
  constructor(modelId, config) {
776
- this.specificationVersion = "v3";
811
+ this.specificationVersion = "v4";
777
812
  this.maxEmbeddingsPerCall = 32;
778
813
  this.supportsParallelCalls = false;
779
814
  this.modelId = modelId;
@@ -828,7 +863,7 @@ var MistralTextEmbeddingResponseSchema = import_v44.z.object({
828
863
  });
829
864
 
830
865
  // src/version.ts
831
- var VERSION = true ? "4.0.0-beta.2" : "0.0.0-test";
866
+ var VERSION = true ? "4.0.0-beta.21" : "0.0.0-test";
832
867
 
833
868
  // src/mistral-provider.ts
834
869
  function createMistral(options = {}) {
@@ -866,7 +901,7 @@ function createMistral(options = {}) {
866
901
  }
867
902
  return createChatModel(modelId);
868
903
  };
869
- provider.specificationVersion = "v3";
904
+ provider.specificationVersion = "v4";
870
905
  provider.languageModel = createChatModel;
871
906
  provider.chat = createChatModel;
872
907
  provider.embedding = createEmbeddingModel;