@ai-sdk/mistral 3.0.20 → 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,12 @@
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
+
3
10
  ## 3.0.20
4
11
 
5
12
  ### 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.20" : "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.20" : "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 = {}) {
@@ -211,51 +211,58 @@ const { text } = await generateText({
211
211
  });
212
212
  ```
213
213
 
214
- 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)
215
216
  (see [AI SDK Core](/docs/ai-sdk-core)).
216
217
 
217
218
  #### Structured Outputs
218
219
 
219
- Mistral chat models support structured outputs using JSON Schema. You can use `generateObject` or `streamObject`
220
- 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' }`.
221
222
 
222
223
  ```ts
223
224
  import { mistral } from '@ai-sdk/mistral';
224
- import { generateObject } from 'ai';
225
+ import { generateText, Output } from 'ai';
225
226
  import { z } from 'zod';
226
227
 
227
- const result = await generateObject({
228
+ const result = await generateText({
228
229
  model: mistral('mistral-large-latest'),
229
- schema: z.object({
230
- recipe: z.object({
231
- name: z.string(),
232
- ingredients: z.array(z.string()),
233
- 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
+ }),
234
237
  }),
235
238
  }),
236
239
  prompt: 'Generate a simple pasta recipe.',
237
240
  });
238
241
 
239
- console.log(JSON.stringify(result.object, null, 2));
242
+ console.log(JSON.stringify(result.output, null, 2));
240
243
  ```
241
244
 
242
245
  You can enable strict JSON Schema validation using a provider option:
243
246
 
244
247
  ```ts highlight="7-11"
245
248
  import { mistral, type MistralLanguageModelOptions } from '@ai-sdk/mistral';
246
- import { generateObject } from 'ai';
249
+ import { generateText, Output } from 'ai';
247
250
  import { z } from 'zod';
248
251
 
249
- const result = await generateObject({
252
+ const result = await generateText({
250
253
  model: mistral('mistral-large-latest'),
251
254
  providerOptions: {
252
255
  mistral: {
253
- strictJsonSchema: true, // reject outputs that don't strictly match the schema
256
+ strictJsonSchema: true,
254
257
  } satisfies MistralLanguageModelOptions,
255
258
  },
256
- schema: z.object({
257
- title: z.string(),
258
- 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
+ }),
259
266
  }),
260
267
  prompt: 'Generate a small shopping list.',
261
268
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/mistral",
3
- "version": "3.0.20",
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.15"
33
+ "@ai-sdk/provider-utils": "4.0.16"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "20.17.24",