@ai-sdk/mistral 4.0.0-beta.0 → 4.0.0-beta.10

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.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [986c6fd]
8
+ - Updated dependencies [493295c]
9
+ - @ai-sdk/provider-utils@5.0.0-beta.8
10
+
11
+ ## 4.0.0-beta.9
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [1f509d4]
16
+ - @ai-sdk/provider-utils@5.0.0-beta.7
17
+ - @ai-sdk/provider@4.0.0-beta.5
18
+
19
+ ## 4.0.0-beta.8
20
+
21
+ ### Patch Changes
22
+
23
+ - 737b8f4: feat(provider/mistral): add support for reasoning configuration (mistral-small-latest)
24
+
25
+ ## 4.0.0-beta.7
26
+
27
+ ### Patch Changes
28
+
29
+ - 5259a95: chore: add warning for providers that do not support new reasoning parameter
30
+
31
+ ## 4.0.0-beta.6
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [3887c70]
36
+ - @ai-sdk/provider-utils@5.0.0-beta.6
37
+ - @ai-sdk/provider@4.0.0-beta.4
38
+
39
+ ## 4.0.0-beta.5
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [776b617]
44
+ - @ai-sdk/provider-utils@5.0.0-beta.5
45
+ - @ai-sdk/provider@4.0.0-beta.3
46
+
47
+ ## 4.0.0-beta.4
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [61753c3]
52
+ - @ai-sdk/provider-utils@5.0.0-beta.4
53
+
54
+ ## 4.0.0-beta.3
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [f7d4f01]
59
+ - @ai-sdk/provider-utils@5.0.0-beta.3
60
+ - @ai-sdk/provider@4.0.0-beta.2
61
+
62
+ ## 4.0.0-beta.2
63
+
64
+ ### Patch Changes
65
+
66
+ - Updated dependencies [5c2a5a2]
67
+ - @ai-sdk/provider@4.0.0-beta.1
68
+ - @ai-sdk/provider-utils@5.0.0-beta.2
69
+
70
+ ## 4.0.0-beta.1
71
+
72
+ ### Patch Changes
73
+
74
+ - Updated dependencies [531251e]
75
+ - @ai-sdk/provider-utils@5.0.0-beta.1
76
+
3
77
  ## 4.0.0-beta.0
4
78
 
5
79
  ### Major Changes
@@ -203,13 +277,13 @@
203
277
  Before
204
278
 
205
279
  ```ts
206
- model.textEmbeddingModel('my-model-id');
280
+ model.textEmbeddingModel("my-model-id");
207
281
  ```
208
282
 
209
283
  After
210
284
 
211
285
  ```ts
212
- model.embeddingModel('my-model-id');
286
+ model.embeddingModel("my-model-id");
213
287
  ```
214
288
 
215
289
  - 2625a04: feat(openai); update spec for mcp approval
@@ -424,13 +498,13 @@
424
498
  Before
425
499
 
426
500
  ```ts
427
- model.textEmbeddingModel('my-model-id');
501
+ model.textEmbeddingModel("my-model-id");
428
502
  ```
429
503
 
430
504
  After
431
505
 
432
506
  ```ts
433
- model.embeddingModel('my-model-id');
507
+ model.embeddingModel("my-model-id");
434
508
  ```
435
509
 
436
510
  - Updated dependencies [8d9e8ad]
@@ -780,12 +854,12 @@
780
854
  - 3429644: feat(provider/mistral): `MistralLanguageModelOptions` type
781
855
 
782
856
  ```ts
783
- import { mistral, type MistralLanguageModelOptions } from '@ai-sdk/mistral';
784
- import { generateText } from 'ai';
857
+ import { mistral, type MistralLanguageModelOptions } from "@ai-sdk/mistral";
858
+ import { generateText } from "ai";
785
859
 
786
860
  await generateText({
787
- model: mistral('open-mistral-7b'),
788
- prompt: 'Invent a new holiday and describe its traditions.',
861
+ model: mistral("open-mistral-7b"),
862
+ prompt: "Invent a new holiday and describe its traditions.",
789
863
  providerOptions: {
790
864
  mistral: {
791
865
  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.0" : "0.0.0-test";
861
+ var VERSION = true ? "4.0.0-beta.10" : "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;