@ai-sdk/mistral 3.0.11 → 3.0.13

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,21 @@
1
1
  # @ai-sdk/mistral
2
2
 
3
+ ## 3.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [462ad00]
8
+ - @ai-sdk/provider-utils@4.0.10
9
+
10
+ ## 3.0.12
11
+
12
+ ### Patch Changes
13
+
14
+ - 4de5a1d: chore: excluded tests from src folder in npm package
15
+ - Updated dependencies [4de5a1d]
16
+ - @ai-sdk/provider@3.0.5
17
+ - @ai-sdk/provider-utils@4.0.9
18
+
3
19
  ## 3.0.11
4
20
 
5
21
  ### 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.11" : "0.0.0-test";
831
+ var VERSION = true ? "3.0.13" : "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.11" : "0.0.0-test";
827
+ var VERSION = true ? "3.0.13" : "0.0.0-test";
828
828
 
829
829
  // src/mistral-provider.ts
830
830
  function createMistral(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/mistral",
3
- "version": "3.0.11",
3
+ "version": "3.0.13",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -10,6 +10,10 @@
10
10
  "dist/**/*",
11
11
  "docs/**/*",
12
12
  "src",
13
+ "!src/**/*.test.ts",
14
+ "!src/**/*.test-d.ts",
15
+ "!src/**/__snapshots__",
16
+ "!src/**/__fixtures__",
13
17
  "CHANGELOG.md",
14
18
  "README.md"
15
19
  ],
@@ -25,16 +29,16 @@
25
29
  }
26
30
  },
27
31
  "dependencies": {
28
- "@ai-sdk/provider": "3.0.4",
29
- "@ai-sdk/provider-utils": "4.0.8"
32
+ "@ai-sdk/provider": "3.0.5",
33
+ "@ai-sdk/provider-utils": "4.0.10"
30
34
  },
31
35
  "devDependencies": {
32
36
  "@types/node": "20.17.24",
33
37
  "tsup": "^8",
34
38
  "typescript": "5.8.3",
35
39
  "zod": "3.25.76",
36
- "@vercel/ai-tsconfig": "0.0.0",
37
- "@ai-sdk/test-server": "1.0.2"
40
+ "@ai-sdk/test-server": "1.0.3",
41
+ "@vercel/ai-tsconfig": "0.0.0"
38
42
  },
39
43
  "peerDependencies": {
40
44
  "zod": "^3.25.76 || ^4.1.8"
@@ -1,22 +0,0 @@
1
- {
2
- "id": "5319bd0299614c679a0068a4f2c8ffd0",
3
- "created": 1769088720,
4
- "model": "mistral-small-latest",
5
- "usage": {
6
- "prompt_tokens": 13,
7
- "total_tokens": 447,
8
- "completion_tokens": 434
9
- },
10
- "object": "chat.completion",
11
- "choices": [
12
- {
13
- "index": 0,
14
- "finish_reason": "stop",
15
- "message": {
16
- "role": "assistant",
17
- "tool_calls": null,
18
- "content": "**Holiday Name: \"World Kindness Day of Sharing\"**\n\n**Date:** The third Saturday in October\n\n**Purpose:** To celebrate and promote acts of kindness, generosity, and connection by sharing something meaningful with others—whether it's time, skills, stories, or physical items.\n\n### **Traditions & Customs:**\n\n1. **\"Share a Skill\" Exchanges:**\n - People teach others something they're good at—cooking, crafting, gardening, or even life advice—free of charge. Community centers, schools, and online platforms host skill-sharing sessions.\n\n2. **\"Story Swap\" Gatherings:**\n - Friends and strangers meet in parks, cafes, or virtual spaces to share personal stories, jokes, or wisdom. The goal is to foster empathy and connection through storytelling.\n\n3. **\"Kindness Kits\" for Strangers:**\n - People assemble small care packages (handwritten notes, snacks, seeds, or handmade crafts) and leave them in public places (libraries, bus stops, parks) for others to find.\n\n4. **\"Pay It Forward\" Chains:**\n - Individuals perform random acts of kindness (buying coffee for the next person, donating to a cause, or helping a neighbor) and encourage others to do the same.\n\n5. **\"Memory Lane\" Sharing:**\n - Families and friends gather to share old photos, heirlooms, or family recipes, passing down traditions and creating new ones.\n\n6. **\"Global Kindness Map\":**\n - An interactive online map where people pin acts of kindness they've done or received, inspiring others to contribute.\n\n**Symbol:** A **hand holding a heart** (representing giving and compassion).\n\n**Food & Drink:** \"Kindness Cookies\" (homemade treats shared with neighbors) and \"Unity Tea\" (a blend of herbs from different cultures, symbolizing harmony).\n\n**Why It's Special:** Unlike commercial holidays, this day focuses on **meaningful human connection**—reminding everyone that kindness is a universal language.\n\nWould you celebrate it? What would you share? 😊"
19
- }
20
- }
21
- ]
22
- }
@@ -1,57 +0,0 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
-
3
- exports[`assistant messages > should add prefix true to trailing assistant messages 1`] = `
4
- [
5
- {
6
- "content": [
7
- {
8
- "text": "Hello",
9
- "type": "text",
10
- },
11
- ],
12
- "role": "user",
13
- },
14
- {
15
- "content": "Hello!",
16
- "prefix": true,
17
- "role": "assistant",
18
- "tool_calls": undefined,
19
- },
20
- ]
21
- `;
22
-
23
- exports[`user messages > should convert messages with PDF file parts using URL 1`] = `
24
- [
25
- {
26
- "content": [
27
- {
28
- "text": "Please analyze this document",
29
- "type": "text",
30
- },
31
- {
32
- "document_url": "https://example.com/document.pdf",
33
- "type": "document_url",
34
- },
35
- ],
36
- "role": "user",
37
- },
38
- ]
39
- `;
40
-
41
- exports[`user messages > should convert messages with image parts 1`] = `
42
- [
43
- {
44
- "content": [
45
- {
46
- "text": "Hello",
47
- "type": "text",
48
- },
49
- {
50
- "image_url": "data:image/png;base64,AAECAw==",
51
- "type": "image_url",
52
- },
53
- ],
54
- "role": "user",
55
- },
56
- ]
57
- `;
@@ -1,44 +0,0 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
-
3
- exports[`doEmbed > should expose the raw response 1`] = `
4
- {
5
- "body": {
6
- "data": [
7
- {
8
- "embedding": [
9
- 0.1,
10
- 0.2,
11
- 0.3,
12
- 0.4,
13
- 0.5,
14
- ],
15
- "index": 0,
16
- "object": "embedding",
17
- },
18
- {
19
- "embedding": [
20
- 0.6,
21
- 0.7,
22
- 0.8,
23
- 0.9,
24
- 1,
25
- ],
26
- "index": 1,
27
- "object": "embedding",
28
- },
29
- ],
30
- "id": "b322cfc2b9d34e2f8e14fc99874faee5",
31
- "model": "mistral-embed",
32
- "object": "list",
33
- "usage": {
34
- "prompt_tokens": 8,
35
- "total_tokens": 8,
36
- },
37
- },
38
- "headers": {
39
- "content-length": "267",
40
- "content-type": "application/json",
41
- "test-header": "test-value",
42
- },
43
- }
44
- `;
@@ -1,372 +0,0 @@
1
- import { convertToMistralChatMessages } from './convert-to-mistral-chat-messages';
2
- import { describe, it, expect } from 'vitest';
3
-
4
- describe('user messages', () => {
5
- it('should convert messages with image parts', async () => {
6
- const result = convertToMistralChatMessages([
7
- {
8
- role: 'user',
9
- content: [
10
- { type: 'text', text: 'Hello' },
11
- {
12
- type: 'file',
13
- data: 'AAECAw==',
14
- mediaType: 'image/png',
15
- },
16
- ],
17
- },
18
- ]);
19
-
20
- expect(result).toMatchSnapshot();
21
- });
22
-
23
- it('should convert messages with image parts from Uint8Array', async () => {
24
- const result = convertToMistralChatMessages([
25
- {
26
- role: 'user',
27
- content: [
28
- { type: 'text', text: 'Hi' },
29
- {
30
- type: 'file',
31
- data: new Uint8Array([0, 1, 2, 3]),
32
- mediaType: 'image/png',
33
- },
34
- ],
35
- },
36
- ]);
37
-
38
- expect(result).toMatchInlineSnapshot(`
39
- [
40
- {
41
- "content": [
42
- {
43
- "text": "Hi",
44
- "type": "text",
45
- },
46
- {
47
- "image_url": "data:image/png;base64,AAECAw==",
48
- "type": "image_url",
49
- },
50
- ],
51
- "role": "user",
52
- },
53
- ]
54
- `);
55
- });
56
-
57
- it('should convert messages with PDF file parts using URL', () => {
58
- const result = convertToMistralChatMessages([
59
- {
60
- role: 'user',
61
- content: [
62
- { type: 'text', text: 'Please analyze this document' },
63
- {
64
- type: 'file',
65
- data: new URL('https://example.com/document.pdf'),
66
- mediaType: 'application/pdf',
67
- },
68
- ],
69
- },
70
- ]);
71
-
72
- expect(result).toMatchSnapshot();
73
- });
74
-
75
- it('should convert messages with PDF file parts from Uint8Array', () => {
76
- const result = convertToMistralChatMessages([
77
- {
78
- role: 'user',
79
- content: [
80
- { type: 'text', text: 'Analyze this PDF' },
81
- {
82
- type: 'file',
83
- data: new Uint8Array([0, 1, 2, 3]),
84
- mediaType: 'application/pdf',
85
- },
86
- ],
87
- },
88
- ]);
89
-
90
- expect(result).toMatchInlineSnapshot(`
91
- [
92
- {
93
- "content": [
94
- {
95
- "text": "Analyze this PDF",
96
- "type": "text",
97
- },
98
- {
99
- "document_url": "data:application/pdf;base64,AAECAw==",
100
- "type": "document_url",
101
- },
102
- ],
103
- "role": "user",
104
- },
105
- ]
106
- `);
107
- });
108
-
109
- it('should convert messages with reasoning content', () => {
110
- const result = convertToMistralChatMessages([
111
- {
112
- role: 'assistant',
113
- content: [
114
- { type: 'reasoning', text: 'Let me think about this...' },
115
- { type: 'text', text: 'The answer is 42.' },
116
- ],
117
- },
118
- ]);
119
-
120
- expect(result).toMatchInlineSnapshot(`
121
- [
122
- {
123
- "content": "Let me think about this...The answer is 42.",
124
- "prefix": true,
125
- "role": "assistant",
126
- "tool_calls": undefined,
127
- },
128
- ]
129
- `);
130
- });
131
- });
132
-
133
- describe('tool calls', () => {
134
- it('should stringify arguments to tool calls', () => {
135
- const result = convertToMistralChatMessages([
136
- {
137
- role: 'assistant',
138
- content: [
139
- {
140
- type: 'tool-call',
141
- input: { key: 'arg-value' },
142
- toolCallId: 'tool-call-id-1',
143
- toolName: 'tool-1',
144
- },
145
- ],
146
- },
147
- {
148
- role: 'tool',
149
- content: [
150
- {
151
- type: 'tool-result',
152
- toolCallId: 'tool-call-id-1',
153
- toolName: 'tool-1',
154
- output: { type: 'json', value: { key: 'result-value' } },
155
- },
156
- ],
157
- },
158
- ]);
159
-
160
- expect(result).toMatchInlineSnapshot(`
161
- [
162
- {
163
- "content": "",
164
- "prefix": undefined,
165
- "role": "assistant",
166
- "tool_calls": [
167
- {
168
- "function": {
169
- "arguments": "{"key":"arg-value"}",
170
- "name": "tool-1",
171
- },
172
- "id": "tool-call-id-1",
173
- "type": "function",
174
- },
175
- ],
176
- },
177
- {
178
- "content": "{"key":"result-value"}",
179
- "name": "tool-1",
180
- "role": "tool",
181
- "tool_call_id": "tool-call-id-1",
182
- },
183
- ]
184
- `);
185
- });
186
-
187
- it('should handle text output format', () => {
188
- const result = convertToMistralChatMessages([
189
- {
190
- role: 'assistant',
191
- content: [
192
- {
193
- type: 'tool-call',
194
- input: { query: 'test' },
195
- toolCallId: 'tool-call-id-2',
196
- toolName: 'text-tool',
197
- },
198
- ],
199
- },
200
- {
201
- role: 'tool',
202
- content: [
203
- {
204
- type: 'tool-result',
205
- toolCallId: 'tool-call-id-2',
206
- toolName: 'text-tool',
207
- output: { type: 'text', value: 'This is a text response' },
208
- },
209
- ],
210
- },
211
- ]);
212
-
213
- expect(result).toMatchInlineSnapshot(`
214
- [
215
- {
216
- "content": "",
217
- "prefix": undefined,
218
- "role": "assistant",
219
- "tool_calls": [
220
- {
221
- "function": {
222
- "arguments": "{"query":"test"}",
223
- "name": "text-tool",
224
- },
225
- "id": "tool-call-id-2",
226
- "type": "function",
227
- },
228
- ],
229
- },
230
- {
231
- "content": "This is a text response",
232
- "name": "text-tool",
233
- "role": "tool",
234
- "tool_call_id": "tool-call-id-2",
235
- },
236
- ]
237
- `);
238
- });
239
-
240
- it('should handle content output format', () => {
241
- const result = convertToMistralChatMessages([
242
- {
243
- role: 'assistant',
244
- content: [
245
- {
246
- type: 'tool-call',
247
- input: { query: 'generate image' },
248
- toolCallId: 'tool-call-id-3',
249
- toolName: 'image-tool',
250
- },
251
- ],
252
- },
253
- {
254
- role: 'tool',
255
- content: [
256
- {
257
- type: 'tool-result',
258
- toolCallId: 'tool-call-id-3',
259
- toolName: 'image-tool',
260
- output: {
261
- type: 'content',
262
- value: [
263
- { type: 'text', text: 'Here is the result:' },
264
- {
265
- type: 'image-data',
266
- data: 'base64data',
267
- mediaType: 'image/png',
268
- },
269
- ],
270
- },
271
- },
272
- ],
273
- },
274
- ]);
275
-
276
- expect(result).toMatchInlineSnapshot(`
277
- [
278
- {
279
- "content": "",
280
- "prefix": undefined,
281
- "role": "assistant",
282
- "tool_calls": [
283
- {
284
- "function": {
285
- "arguments": "{"query":"generate image"}",
286
- "name": "image-tool",
287
- },
288
- "id": "tool-call-id-3",
289
- "type": "function",
290
- },
291
- ],
292
- },
293
- {
294
- "content": "[{"type":"text","text":"Here is the result:"},{"type":"image-data","data":"base64data","mediaType":"image/png"}]",
295
- "name": "image-tool",
296
- "role": "tool",
297
- "tool_call_id": "tool-call-id-3",
298
- },
299
- ]
300
- `);
301
- });
302
-
303
- it('should handle error output format', () => {
304
- const result = convertToMistralChatMessages([
305
- {
306
- role: 'assistant',
307
- content: [
308
- {
309
- type: 'tool-call',
310
- input: { query: 'test' },
311
- toolCallId: 'tool-call-id-4',
312
- toolName: 'error-tool',
313
- },
314
- ],
315
- },
316
- {
317
- role: 'tool',
318
- content: [
319
- {
320
- type: 'tool-result',
321
- toolCallId: 'tool-call-id-4',
322
- toolName: 'error-tool',
323
- output: { type: 'error-text', value: 'Invalid input provided' },
324
- },
325
- ],
326
- },
327
- ]);
328
-
329
- expect(result).toMatchInlineSnapshot(`
330
- [
331
- {
332
- "content": "",
333
- "prefix": undefined,
334
- "role": "assistant",
335
- "tool_calls": [
336
- {
337
- "function": {
338
- "arguments": "{"query":"test"}",
339
- "name": "error-tool",
340
- },
341
- "id": "tool-call-id-4",
342
- "type": "function",
343
- },
344
- ],
345
- },
346
- {
347
- "content": "Invalid input provided",
348
- "name": "error-tool",
349
- "role": "tool",
350
- "tool_call_id": "tool-call-id-4",
351
- },
352
- ]
353
- `);
354
- });
355
- });
356
-
357
- describe('assistant messages', () => {
358
- it('should add prefix true to trailing assistant messages', () => {
359
- const result = convertToMistralChatMessages([
360
- {
361
- role: 'user',
362
- content: [{ type: 'text', text: 'Hello' }],
363
- },
364
- {
365
- role: 'assistant',
366
- content: [{ type: 'text', text: 'Hello!' }],
367
- },
368
- ]);
369
-
370
- expect(result).toMatchSnapshot();
371
- });
372
- });