@ai-sdk/mistral 4.0.0-beta.1 → 4.0.0-beta.11

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,79 @@
1
1
  # @ai-sdk/mistral
2
2
 
3
+ ## 4.0.0-beta.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [2e17091]
8
+ - @ai-sdk/provider-utils@5.0.0-beta.9
9
+
10
+ ## 4.0.0-beta.10
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [986c6fd]
15
+ - Updated dependencies [493295c]
16
+ - @ai-sdk/provider-utils@5.0.0-beta.8
17
+
18
+ ## 4.0.0-beta.9
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [1f509d4]
23
+ - @ai-sdk/provider-utils@5.0.0-beta.7
24
+ - @ai-sdk/provider@4.0.0-beta.5
25
+
26
+ ## 4.0.0-beta.8
27
+
28
+ ### Patch Changes
29
+
30
+ - 737b8f4: feat(provider/mistral): add support for reasoning configuration (mistral-small-latest)
31
+
32
+ ## 4.0.0-beta.7
33
+
34
+ ### Patch Changes
35
+
36
+ - 5259a95: chore: add warning for providers that do not support new reasoning parameter
37
+
38
+ ## 4.0.0-beta.6
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [3887c70]
43
+ - @ai-sdk/provider-utils@5.0.0-beta.6
44
+ - @ai-sdk/provider@4.0.0-beta.4
45
+
46
+ ## 4.0.0-beta.5
47
+
48
+ ### Patch Changes
49
+
50
+ - Updated dependencies [776b617]
51
+ - @ai-sdk/provider-utils@5.0.0-beta.5
52
+ - @ai-sdk/provider@4.0.0-beta.3
53
+
54
+ ## 4.0.0-beta.4
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [61753c3]
59
+ - @ai-sdk/provider-utils@5.0.0-beta.4
60
+
61
+ ## 4.0.0-beta.3
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [f7d4f01]
66
+ - @ai-sdk/provider-utils@5.0.0-beta.3
67
+ - @ai-sdk/provider@4.0.0-beta.2
68
+
69
+ ## 4.0.0-beta.2
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [5c2a5a2]
74
+ - @ai-sdk/provider@4.0.0-beta.1
75
+ - @ai-sdk/provider-utils@5.0.0-beta.2
76
+
3
77
  ## 4.0.0-beta.1
4
78
 
5
79
  ### Patch Changes
@@ -210,13 +284,13 @@
210
284
  Before
211
285
 
212
286
  ```ts
213
- model.textEmbeddingModel('my-model-id');
287
+ model.textEmbeddingModel("my-model-id");
214
288
  ```
215
289
 
216
290
  After
217
291
 
218
292
  ```ts
219
- model.embeddingModel('my-model-id');
293
+ model.embeddingModel("my-model-id");
220
294
  ```
221
295
 
222
296
  - 2625a04: feat(openai); update spec for mcp approval
@@ -431,13 +505,13 @@
431
505
  Before
432
506
 
433
507
  ```ts
434
- model.textEmbeddingModel('my-model-id');
508
+ model.textEmbeddingModel("my-model-id");
435
509
  ```
436
510
 
437
511
  After
438
512
 
439
513
  ```ts
440
- model.embeddingModel('my-model-id');
514
+ model.embeddingModel("my-model-id");
441
515
  ```
442
516
 
443
517
  - Updated dependencies [8d9e8ad]
@@ -787,12 +861,12 @@
787
861
  - 3429644: feat(provider/mistral): `MistralLanguageModelOptions` type
788
862
 
789
863
  ```ts
790
- import { mistral, type MistralLanguageModelOptions } from '@ai-sdk/mistral';
791
- import { generateText } from 'ai';
864
+ import { mistral, type MistralLanguageModelOptions } from "@ai-sdk/mistral";
865
+ import { generateText } from "ai";
792
866
 
793
867
  await generateText({
794
- model: mistral('open-mistral-7b'),
795
- prompt: 'Invent a new holiday and describe its traditions.',
868
+ model: mistral("open-mistral-7b"),
869
+ prompt: "Invent a new holiday and describe its traditions.",
796
870
  providerOptions: {
797
871
  mistral: {
798
872
  safePrompt: true,
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
@@ -18,13 +18,13 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  VERSION: () => VERSION,
24
24
  createMistral: () => createMistral,
25
25
  mistral: () => mistral
26
26
  });
27
- module.exports = __toCommonJS(src_exports);
27
+ module.exports = __toCommonJS(index_exports);
28
28
 
29
29
  // src/mistral-provider.ts
30
30
  var import_provider4 = require("@ai-sdk/provider");
@@ -259,7 +259,14 @@ var mistralLanguageModelOptions = import_v4.z.object({
259
259
  *
260
260
  * @default true
261
261
  */
262
- parallelToolCalls: import_v4.z.boolean().optional()
262
+ parallelToolCalls: import_v4.z.boolean().optional(),
263
+ /**
264
+ * Controls the reasoning effort for models that support adjustable reasoning.
265
+ *
266
+ * - `'high'`: Enable reasoning
267
+ * - `'none'`: Disable reasoning
268
+ */
269
+ reasoningEffort: import_v4.z.enum(["high", "none"]).optional()
263
270
  });
264
271
 
265
272
  // src/mistral-error.ts
@@ -339,7 +346,7 @@ function prepareTools({
339
346
  // src/mistral-chat-language-model.ts
340
347
  var MistralChatLanguageModel = class {
341
348
  constructor(modelId, config) {
342
- this.specificationVersion = "v3";
349
+ this.specificationVersion = "v4";
343
350
  this.supportedUrls = {
344
351
  "application/pdf": [/^https:\/\/.*$/]
345
352
  };
@@ -359,6 +366,7 @@ var MistralChatLanguageModel = class {
359
366
  topK,
360
367
  frequencyPenalty,
361
368
  presencePenalty,
369
+ reasoning,
362
370
  stopSequences,
363
371
  responseFormat,
364
372
  seed,
@@ -366,7 +374,7 @@ var MistralChatLanguageModel = class {
366
374
  tools,
367
375
  toolChoice
368
376
  }) {
369
- var _a, _b, _c, _d;
377
+ var _a, _b, _c, _d, _e;
370
378
  const warnings = [];
371
379
  const options = (_a = await (0, import_provider_utils3.parseProviderOptions)({
372
380
  provider: "mistral",
@@ -385,8 +393,29 @@ var MistralChatLanguageModel = class {
385
393
  if (stopSequences != null) {
386
394
  warnings.push({ type: "unsupported", feature: "stopSequences" });
387
395
  }
388
- const structuredOutputs = (_b = options.structuredOutputs) != null ? _b : true;
389
- const strictJsonSchema = (_c = options.strictJsonSchema) != null ? _c : false;
396
+ const supportsReasoningEffort = this.modelId === "mistral-small-latest" || this.modelId === "mistral-small-2603";
397
+ let resolvedReasoningEffort;
398
+ if (supportsReasoningEffort) {
399
+ resolvedReasoningEffort = (_b = options.reasoningEffort) != null ? _b : (0, import_provider_utils3.isCustomReasoning)(reasoning) ? reasoning === "none" ? "none" : (0, import_provider_utils3.mapReasoningToProviderEffort)({
400
+ reasoning,
401
+ effortMap: {
402
+ minimal: "high",
403
+ low: "high",
404
+ medium: "high",
405
+ high: "high",
406
+ xhigh: "high"
407
+ },
408
+ warnings
409
+ }) : void 0;
410
+ } else if ((0, import_provider_utils3.isCustomReasoning)(reasoning)) {
411
+ warnings.push({
412
+ type: "unsupported",
413
+ feature: "reasoning",
414
+ details: "This model does not support reasoning configuration."
415
+ });
416
+ }
417
+ const structuredOutputs = (_c = options.structuredOutputs) != null ? _c : true;
418
+ const strictJsonSchema = (_d = options.strictJsonSchema) != null ? _d : false;
390
419
  if ((responseFormat == null ? void 0 : responseFormat.type) === "json" && !(responseFormat == null ? void 0 : responseFormat.schema)) {
391
420
  prompt = (0, import_provider_utils3.injectJsonInstructionIntoMessages)({
392
421
  messages: prompt,
@@ -403,13 +432,14 @@ var MistralChatLanguageModel = class {
403
432
  temperature,
404
433
  top_p: topP,
405
434
  random_seed: seed,
435
+ reasoning_effort: resolvedReasoningEffort,
406
436
  // response format:
407
437
  response_format: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? structuredOutputs && (responseFormat == null ? void 0 : responseFormat.schema) != null ? {
408
438
  type: "json_schema",
409
439
  json_schema: {
410
440
  schema: responseFormat.schema,
411
441
  strict: strictJsonSchema,
412
- name: (_d = responseFormat.name) != null ? _d : "response",
442
+ name: (_e = responseFormat.name) != null ? _e : "response",
413
443
  description: responseFormat.description
414
444
  }
415
445
  } : { type: "json_object" } : void 0,
@@ -773,7 +803,7 @@ var import_provider_utils4 = require("@ai-sdk/provider-utils");
773
803
  var import_v44 = require("zod/v4");
774
804
  var MistralEmbeddingModel = class {
775
805
  constructor(modelId, config) {
776
- this.specificationVersion = "v3";
806
+ this.specificationVersion = "v4";
777
807
  this.maxEmbeddingsPerCall = 32;
778
808
  this.supportsParallelCalls = false;
779
809
  this.modelId = modelId;
@@ -828,7 +858,7 @@ var MistralTextEmbeddingResponseSchema = import_v44.z.object({
828
858
  });
829
859
 
830
860
  // src/version.ts
831
- var VERSION = true ? "4.0.0-beta.1" : "0.0.0-test";
861
+ var VERSION = true ? "4.0.0-beta.11" : "0.0.0-test";
832
862
 
833
863
  // src/mistral-provider.ts
834
864
  function createMistral(options = {}) {
@@ -866,7 +896,7 @@ function createMistral(options = {}) {
866
896
  }
867
897
  return createChatModel(modelId);
868
898
  };
869
- provider.specificationVersion = "v3";
899
+ provider.specificationVersion = "v4";
870
900
  provider.languageModel = createChatModel;
871
901
  provider.chat = createChatModel;
872
902
  provider.embedding = createEmbeddingModel;