@ai-sdk/mistral 4.0.0-beta.3 → 4.0.0-beta.30
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 +228 -8
- package/README.md +2 -0
- package/dist/index.d.ts +14 -10
- package/dist/index.js +208 -150
- package/dist/index.js.map +1 -1
- package/docs/20-mistral.mdx +21 -0
- package/package.json +9 -10
- package/src/convert-mistral-usage.ts +2 -2
- package/src/convert-to-mistral-chat-messages.ts +12 -6
- package/src/map-mistral-finish-reason.ts +2 -2
- package/src/mistral-chat-language-model.ts +74 -22
- package/src/mistral-chat-options.ts +18 -12
- package/src/mistral-embedding-model.ts +24 -7
- package/src/mistral-prepare-tools.ts +6 -6
- package/src/mistral-provider.ts +12 -12
- package/dist/index.d.mts +0 -78
- package/dist/index.mjs +0 -883
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,225 @@
|
|
|
1
1
|
# @ai-sdk/mistral
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.30
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
8
|
+
- Updated dependencies [785fe16]
|
|
9
|
+
- Updated dependencies [67df0a0]
|
|
10
|
+
- Updated dependencies [befb78c]
|
|
11
|
+
- Updated dependencies [0458559]
|
|
12
|
+
- Updated dependencies [5852c0a]
|
|
13
|
+
- Updated dependencies [fc92055]
|
|
14
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
15
|
+
|
|
16
|
+
## 4.0.0-beta.29
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [2e98477]
|
|
21
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
22
|
+
|
|
23
|
+
## 4.0.0-beta.28
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [eea8d98]
|
|
28
|
+
- @ai-sdk/provider-utils@5.0.0-beta.25
|
|
29
|
+
|
|
30
|
+
## 4.0.0-beta.27
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [f807e45]
|
|
35
|
+
- @ai-sdk/provider-utils@5.0.0-beta.24
|
|
36
|
+
|
|
37
|
+
## 4.0.0-beta.26
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [350ea38]
|
|
42
|
+
- @ai-sdk/provider-utils@5.0.0-beta.23
|
|
43
|
+
|
|
44
|
+
## 4.0.0-beta.25
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [083947b]
|
|
49
|
+
- @ai-sdk/provider-utils@5.0.0-beta.22
|
|
50
|
+
|
|
51
|
+
## 4.0.0-beta.24
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Updated dependencies [add1126]
|
|
56
|
+
- @ai-sdk/provider-utils@5.0.0-beta.21
|
|
57
|
+
|
|
58
|
+
## 4.0.0-beta.23
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
63
|
+
|
|
64
|
+
**`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
|
|
65
|
+
|
|
66
|
+
**All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
|
|
67
|
+
|
|
68
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
69
|
+
|
|
70
|
+
- ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
|
|
71
|
+
- Updated dependencies [b3976a2]
|
|
72
|
+
- Updated dependencies [ff5eba1]
|
|
73
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
74
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
75
|
+
|
|
76
|
+
## 4.0.0-beta.22
|
|
77
|
+
|
|
78
|
+
### Major Changes
|
|
79
|
+
|
|
80
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- Updated dependencies [ef992f8]
|
|
85
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
86
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
87
|
+
|
|
88
|
+
## 4.0.0-beta.21
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- Updated dependencies [90e2d8a]
|
|
93
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
94
|
+
|
|
95
|
+
## 4.0.0-beta.20
|
|
96
|
+
|
|
97
|
+
### Patch Changes
|
|
98
|
+
|
|
99
|
+
- Updated dependencies [3ae1786]
|
|
100
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
101
|
+
|
|
102
|
+
## 4.0.0-beta.19
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [176466a]
|
|
107
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
108
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
109
|
+
|
|
110
|
+
## 4.0.0-beta.18
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- Updated dependencies [e311194]
|
|
115
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
116
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
117
|
+
|
|
118
|
+
## 4.0.0-beta.17
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- Updated dependencies [34bd95d]
|
|
123
|
+
- Updated dependencies [008271d]
|
|
124
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
125
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
126
|
+
|
|
127
|
+
## 4.0.0-beta.16
|
|
128
|
+
|
|
129
|
+
### Patch Changes
|
|
130
|
+
|
|
131
|
+
- Updated dependencies [b0c2869]
|
|
132
|
+
- Updated dependencies [7e26e81]
|
|
133
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
134
|
+
|
|
135
|
+
## 4.0.0-beta.15
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- Updated dependencies [46d1149]
|
|
140
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
141
|
+
|
|
142
|
+
## 4.0.0-beta.14
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- Updated dependencies [6fd51c0]
|
|
147
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
148
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
149
|
+
|
|
150
|
+
## 4.0.0-beta.13
|
|
151
|
+
|
|
152
|
+
### Patch Changes
|
|
153
|
+
|
|
154
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
155
|
+
- Updated dependencies [c29a26f]
|
|
156
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
157
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
158
|
+
|
|
159
|
+
## 4.0.0-beta.12
|
|
160
|
+
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
164
|
+
|
|
165
|
+
## 4.0.0-beta.11
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- Updated dependencies [2e17091]
|
|
170
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
171
|
+
|
|
172
|
+
## 4.0.0-beta.10
|
|
173
|
+
|
|
174
|
+
### Patch Changes
|
|
175
|
+
|
|
176
|
+
- Updated dependencies [986c6fd]
|
|
177
|
+
- Updated dependencies [493295c]
|
|
178
|
+
- @ai-sdk/provider-utils@5.0.0-beta.8
|
|
179
|
+
|
|
180
|
+
## 4.0.0-beta.9
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- Updated dependencies [1f509d4]
|
|
185
|
+
- @ai-sdk/provider-utils@5.0.0-beta.7
|
|
186
|
+
- @ai-sdk/provider@4.0.0-beta.5
|
|
187
|
+
|
|
188
|
+
## 4.0.0-beta.8
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- 737b8f4: feat(provider/mistral): add support for reasoning configuration (mistral-small-latest)
|
|
193
|
+
|
|
194
|
+
## 4.0.0-beta.7
|
|
195
|
+
|
|
196
|
+
### Patch Changes
|
|
197
|
+
|
|
198
|
+
- 5259a95: chore: add warning for providers that do not support new reasoning parameter
|
|
199
|
+
|
|
200
|
+
## 4.0.0-beta.6
|
|
201
|
+
|
|
202
|
+
### Patch Changes
|
|
203
|
+
|
|
204
|
+
- Updated dependencies [3887c70]
|
|
205
|
+
- @ai-sdk/provider-utils@5.0.0-beta.6
|
|
206
|
+
- @ai-sdk/provider@4.0.0-beta.4
|
|
207
|
+
|
|
208
|
+
## 4.0.0-beta.5
|
|
209
|
+
|
|
210
|
+
### Patch Changes
|
|
211
|
+
|
|
212
|
+
- Updated dependencies [776b617]
|
|
213
|
+
- @ai-sdk/provider-utils@5.0.0-beta.5
|
|
214
|
+
- @ai-sdk/provider@4.0.0-beta.3
|
|
215
|
+
|
|
216
|
+
## 4.0.0-beta.4
|
|
217
|
+
|
|
218
|
+
### Patch Changes
|
|
219
|
+
|
|
220
|
+
- Updated dependencies [61753c3]
|
|
221
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
222
|
+
|
|
3
223
|
## 4.0.0-beta.3
|
|
4
224
|
|
|
5
225
|
### Patch Changes
|
|
@@ -226,13 +446,13 @@
|
|
|
226
446
|
Before
|
|
227
447
|
|
|
228
448
|
```ts
|
|
229
|
-
model.textEmbeddingModel(
|
|
449
|
+
model.textEmbeddingModel("my-model-id");
|
|
230
450
|
```
|
|
231
451
|
|
|
232
452
|
After
|
|
233
453
|
|
|
234
454
|
```ts
|
|
235
|
-
model.embeddingModel(
|
|
455
|
+
model.embeddingModel("my-model-id");
|
|
236
456
|
```
|
|
237
457
|
|
|
238
458
|
- 2625a04: feat(openai); update spec for mcp approval
|
|
@@ -447,13 +667,13 @@
|
|
|
447
667
|
Before
|
|
448
668
|
|
|
449
669
|
```ts
|
|
450
|
-
model.textEmbeddingModel(
|
|
670
|
+
model.textEmbeddingModel("my-model-id");
|
|
451
671
|
```
|
|
452
672
|
|
|
453
673
|
After
|
|
454
674
|
|
|
455
675
|
```ts
|
|
456
|
-
model.embeddingModel(
|
|
676
|
+
model.embeddingModel("my-model-id");
|
|
457
677
|
```
|
|
458
678
|
|
|
459
679
|
- Updated dependencies [8d9e8ad]
|
|
@@ -803,12 +1023,12 @@
|
|
|
803
1023
|
- 3429644: feat(provider/mistral): `MistralLanguageModelOptions` type
|
|
804
1024
|
|
|
805
1025
|
```ts
|
|
806
|
-
import { mistral, type MistralLanguageModelOptions } from
|
|
807
|
-
import { generateText } from
|
|
1026
|
+
import { mistral, type MistralLanguageModelOptions } from "@ai-sdk/mistral";
|
|
1027
|
+
import { generateText } from "ai";
|
|
808
1028
|
|
|
809
1029
|
await generateText({
|
|
810
|
-
model: mistral(
|
|
811
|
-
prompt:
|
|
1030
|
+
model: mistral("open-mistral-7b"),
|
|
1031
|
+
prompt: "Invent a new holiday and describe its traditions.",
|
|
812
1032
|
providerOptions: {
|
|
813
1033
|
mistral: {
|
|
814
1034
|
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.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
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' | '
|
|
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
|
|
19
|
-
(modelId: MistralChatModelId):
|
|
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):
|
|
27
|
+
languageModel(modelId: MistralChatModelId): LanguageModelV4;
|
|
24
28
|
/**
|
|
25
29
|
* Creates a model for text generation.
|
|
26
30
|
*/
|
|
27
|
-
chat(modelId: MistralChatModelId):
|
|
31
|
+
chat(modelId: MistralChatModelId): LanguageModelV4;
|
|
28
32
|
/**
|
|
29
33
|
* Creates a model for text embeddings.
|
|
30
34
|
*/
|
|
31
|
-
embedding(modelId: MistralEmbeddingModelId):
|
|
35
|
+
embedding(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
|
|
32
36
|
/**
|
|
33
37
|
* Creates a model for text embeddings.
|
|
34
38
|
*/
|
|
35
|
-
embeddingModel: (modelId: MistralEmbeddingModelId) =>
|
|
39
|
+
embeddingModel: (modelId: MistralEmbeddingModelId) => EmbeddingModelV4;
|
|
36
40
|
/**
|
|
37
41
|
* @deprecated Use `embedding` instead.
|
|
38
42
|
*/
|
|
39
|
-
textEmbedding(modelId: MistralEmbeddingModelId):
|
|
43
|
+
textEmbedding(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
|
|
40
44
|
/**
|
|
41
45
|
* @deprecated Use `embeddingModel` instead.
|
|
42
46
|
*/
|
|
43
|
-
textEmbeddingModel(modelId: MistralEmbeddingModelId):
|
|
47
|
+
textEmbeddingModel(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
|
|
44
48
|
}
|
|
45
49
|
interface MistralProviderSettings {
|
|
46
50
|
/**
|