@ai-sdk/mistral 3.0.19 → 3.0.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,19 @@
1
1
  # @ai-sdk/mistral
2
2
 
3
+ ## 3.0.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [58bc42d]
8
+ - @ai-sdk/provider-utils@4.0.16
9
+
10
+ ## 3.0.20
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [4024a3a]
15
+ - @ai-sdk/provider-utils@4.0.15
16
+
3
17
  ## 3.0.19
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -828,7 +828,7 @@ var MistralTextEmbeddingResponseSchema = import_v44.z.object({
828
828
  });
829
829
 
830
830
  // src/version.ts
831
- var VERSION = true ? "3.0.19" : "0.0.0-test";
831
+ var VERSION = true ? "3.0.21" : "0.0.0-test";
832
832
 
833
833
  // src/mistral-provider.ts
834
834
  function createMistral(options = {}) {
package/dist/index.mjs CHANGED
@@ -824,7 +824,7 @@ var MistralTextEmbeddingResponseSchema = z4.object({
824
824
  });
825
825
 
826
826
  // src/version.ts
827
- var VERSION = true ? "3.0.19" : "0.0.0-test";
827
+ var VERSION = true ? "3.0.21" : "0.0.0-test";
828
828
 
829
829
  // src/mistral-provider.ts
830
830
  function createMistral(options = {}) {
@@ -137,6 +137,9 @@ Mistral chat models support document OCR for PDF files.
137
137
  You can optionally set image and page limits using the provider options.
138
138
 
139
139
  ```ts
140
+ import { mistral, type MistralLanguageModelOptions } from '@ai-sdk/mistral';
141
+ import { generateText } from 'ai';
142
+
140
143
  const result = await generateText({
141
144
  model: mistral('mistral-small-latest'),
142
145
  messages: [
@@ -162,7 +165,7 @@ const result = await generateText({
162
165
  mistral: {
163
166
  documentImageLimit: 8,
164
167
  documentPageLimit: 64,
165
- },
168
+ } satisfies MistralLanguageModelOptions,
166
169
  },
167
170
  });
168
171
  ```
@@ -208,51 +211,58 @@ const { text } = await generateText({
208
211
  });
209
212
  ```
210
213
 
211
- Mistral language models can also be used in the `streamText`, `generateObject`, and `streamObject` functions
214
+ Mistral language models can also be used in the `streamText` function
215
+ and support structured data generation with [`Output`](/docs/reference/ai-sdk-core/output)
212
216
  (see [AI SDK Core](/docs/ai-sdk-core)).
213
217
 
214
218
  #### Structured Outputs
215
219
 
216
- Mistral chat models support structured outputs using JSON Schema. You can use `generateObject` or `streamObject`
217
- with Zod, Valibot, or raw JSON Schema. The SDK sends your schema via Mistral's `response_format: { type: 'json_schema' }`.
220
+ Mistral chat models support structured outputs using JSON Schema. You can use `generateText` or `streamText` with [`Output`](/docs/reference/ai-sdk-core/output)
221
+ and Zod, Valibot, or raw JSON Schema. The SDK sends your schema via Mistral's `response_format: { type: 'json_schema' }`.
218
222
 
219
223
  ```ts
220
224
  import { mistral } from '@ai-sdk/mistral';
221
- import { generateObject } from 'ai';
225
+ import { generateText, Output } from 'ai';
222
226
  import { z } from 'zod';
223
227
 
224
- const result = await generateObject({
228
+ const result = await generateText({
225
229
  model: mistral('mistral-large-latest'),
226
- schema: z.object({
227
- recipe: z.object({
228
- name: z.string(),
229
- ingredients: z.array(z.string()),
230
- instructions: z.array(z.string()),
230
+ output: Output.object({
231
+ schema: z.object({
232
+ recipe: z.object({
233
+ name: z.string(),
234
+ ingredients: z.array(z.string()),
235
+ instructions: z.array(z.string()),
236
+ }),
231
237
  }),
232
238
  }),
233
239
  prompt: 'Generate a simple pasta recipe.',
234
240
  });
235
241
 
236
- console.log(JSON.stringify(result.object, null, 2));
242
+ console.log(JSON.stringify(result.output, null, 2));
237
243
  ```
238
244
 
239
245
  You can enable strict JSON Schema validation using a provider option:
240
246
 
241
247
  ```ts highlight="7-11"
242
- import { mistral } from '@ai-sdk/mistral';
243
- import { generateObject } from 'ai';
248
+ import { mistral, type MistralLanguageModelOptions } from '@ai-sdk/mistral';
249
+ import { generateText, Output } from 'ai';
244
250
  import { z } from 'zod';
245
251
 
246
- const result = await generateObject({
252
+ const result = await generateText({
247
253
  model: mistral('mistral-large-latest'),
248
254
  providerOptions: {
249
255
  mistral: {
250
- strictJsonSchema: true, // reject outputs that don't strictly match the schema
251
- },
256
+ strictJsonSchema: true,
257
+ } satisfies MistralLanguageModelOptions,
252
258
  },
253
- schema: z.object({
254
- title: z.string(),
255
- items: z.array(z.object({ id: z.string(), qty: z.number().int().min(1) })),
259
+ output: Output.object({
260
+ schema: z.object({
261
+ title: z.string(),
262
+ items: z.array(
263
+ z.object({ id: z.string(), qty: z.number().int().min(1) }),
264
+ ),
265
+ }),
256
266
  }),
257
267
  prompt: 'Generate a small shopping list.',
258
268
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/mistral",
3
- "version": "3.0.19",
3
+ "version": "3.0.21",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@ai-sdk/provider": "3.0.8",
33
- "@ai-sdk/provider-utils": "4.0.14"
33
+ "@ai-sdk/provider-utils": "4.0.16"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.17.24",