@ai-sdk/mistral 4.0.86 → 4.0.87
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 +6 -0
- package/dist/index.d.ts +144 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +56 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/mistral-chat-language-model-options.ts +2 -39
- package/src/mistral-embedding-model-options.ts +2 -4
- package/src/mistral-model-catalog.ts +95 -26
- package/src/mistral-speech-model-options.ts +2 -6
- package/src/mistral-transcription-model-options.ts +2 -10
package/package.json
CHANGED
|
@@ -1,46 +1,9 @@
|
|
|
1
1
|
import { lazySchema, zodSchema } from '@ai-sdk/provider-utils';
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
|
+
import type { MistralModelIds } from './mistral-model-catalog';
|
|
3
4
|
|
|
4
5
|
// https://docs.mistral.ai/models
|
|
5
|
-
export type MistralChatModelId =
|
|
6
|
-
| 'codestral-2508'
|
|
7
|
-
| 'codestral-latest'
|
|
8
|
-
| 'glm-5-2'
|
|
9
|
-
| 'labs-leanstral-1-5'
|
|
10
|
-
| 'labs-leanstral-1-5-1'
|
|
11
|
-
| 'magistral-medium-latest'
|
|
12
|
-
| 'magistral-small-latest'
|
|
13
|
-
| 'ministral-14b-2512'
|
|
14
|
-
| 'ministral-14b-latest'
|
|
15
|
-
| 'ministral-3b-2512'
|
|
16
|
-
| 'ministral-3b-latest'
|
|
17
|
-
| 'ministral-8b-2512'
|
|
18
|
-
| 'ministral-8b-latest'
|
|
19
|
-
| 'mistral-code-fim-latest'
|
|
20
|
-
| 'mistral-code-latest'
|
|
21
|
-
| 'mistral-large-4'
|
|
22
|
-
| 'mistral-large-4-0'
|
|
23
|
-
| 'mistral-large-latest'
|
|
24
|
-
| 'mistral-large-2512'
|
|
25
|
-
| 'mistral-medium'
|
|
26
|
-
| 'mistral-medium-latest'
|
|
27
|
-
| 'mistral-medium-2604'
|
|
28
|
-
| 'mistral-medium-3'
|
|
29
|
-
| 'mistral-medium-3-5'
|
|
30
|
-
| 'mistral-medium-3.5'
|
|
31
|
-
| 'mistral-small-2603'
|
|
32
|
-
| 'mistral-small-latest'
|
|
33
|
-
| 'mistral-vibe-cli-fast'
|
|
34
|
-
| 'mistral-vibe-cli-latest'
|
|
35
|
-
| 'mistral-vibe-cli-with-tools'
|
|
36
|
-
| 'voxtral-small-2507'
|
|
37
|
-
| 'voxtral-small-latest'
|
|
38
|
-
| 'zai-glm-5'
|
|
39
|
-
| 'zai-glm-5-2'
|
|
40
|
-
| 'zai-glm-5-3'
|
|
41
|
-
| 'zai-glm-5-3-flash'
|
|
42
|
-
| 'zai-glm-latest'
|
|
43
|
-
| (string & {});
|
|
6
|
+
export type MistralChatModelId = MistralModelIds['language'] | (string & {});
|
|
44
7
|
|
|
45
8
|
export const mistralLanguageModelChatOptions = () =>
|
|
46
9
|
z.object({
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
+
import type { MistralModelIds } from './mistral-model-catalog';
|
|
2
3
|
|
|
3
4
|
export type MistralEmbeddingModelId =
|
|
4
|
-
| '
|
|
5
|
-
| 'mistral-embed-2312'
|
|
6
|
-
| 'codestral-embed'
|
|
7
|
-
| 'codestral-embed-2505'
|
|
5
|
+
| MistralModelIds['embedding']
|
|
8
6
|
| (string & {});
|
|
9
7
|
|
|
10
8
|
export const mistralEmbeddingModelOptions = z.object({
|
|
@@ -135,7 +135,7 @@ type MistralModelEntry = ModelEntry & {
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
// Preserve the provider page's documented model set and image-input exceptions.
|
|
138
|
-
const
|
|
138
|
+
const languageModelDefinitions = {
|
|
139
139
|
'labs-leanstral-1-5': true,
|
|
140
140
|
'magistral-medium-latest': true,
|
|
141
141
|
'magistral-small-latest': true,
|
|
@@ -146,7 +146,35 @@ const documentedLanguageModels: Record<string, boolean> = {
|
|
|
146
146
|
'mistral-small-latest': true,
|
|
147
147
|
'voxtral-small-latest': false,
|
|
148
148
|
'zai-glm-5-2': false,
|
|
149
|
-
|
|
149
|
+
// Known IDs without declared capabilities retain the custom-model fallback.
|
|
150
|
+
'codestral-2508': undefined,
|
|
151
|
+
'codestral-latest': undefined,
|
|
152
|
+
'glm-5-2': undefined,
|
|
153
|
+
'labs-leanstral-1-5-1': undefined,
|
|
154
|
+
'ministral-14b-2512': undefined,
|
|
155
|
+
'ministral-3b-2512': undefined,
|
|
156
|
+
'ministral-3b-latest': undefined,
|
|
157
|
+
'ministral-8b-2512': undefined,
|
|
158
|
+
'mistral-code-fim-latest': undefined,
|
|
159
|
+
'mistral-code-latest': undefined,
|
|
160
|
+
'mistral-large-2512': undefined,
|
|
161
|
+
'mistral-large-4': undefined,
|
|
162
|
+
'mistral-large-4-0': undefined,
|
|
163
|
+
'mistral-medium': undefined,
|
|
164
|
+
'mistral-medium-2604': undefined,
|
|
165
|
+
'mistral-medium-3': undefined,
|
|
166
|
+
'mistral-medium-3-5': undefined,
|
|
167
|
+
'mistral-medium-3.5': undefined,
|
|
168
|
+
'mistral-small-2603': undefined,
|
|
169
|
+
'mistral-vibe-cli-fast': undefined,
|
|
170
|
+
'mistral-vibe-cli-latest': undefined,
|
|
171
|
+
'mistral-vibe-cli-with-tools': undefined,
|
|
172
|
+
'voxtral-small-2507': undefined,
|
|
173
|
+
'zai-glm-5': undefined,
|
|
174
|
+
'zai-glm-5-3': undefined,
|
|
175
|
+
'zai-glm-5-3-flash': undefined,
|
|
176
|
+
'zai-glm-latest': undefined,
|
|
177
|
+
} satisfies Record<string, boolean | undefined>;
|
|
150
178
|
|
|
151
179
|
// Known non-reasoning models from https://api.mistral.ai/v1/models
|
|
152
180
|
// (2026-10-06). Unknown IDs inherit current reasoning configuration support.
|
|
@@ -348,32 +376,65 @@ function createEmbeddingModelEntry(
|
|
|
348
376
|
};
|
|
349
377
|
}
|
|
350
378
|
|
|
379
|
+
const mistralEmbeddingModelEntries = {
|
|
380
|
+
'mistral-embed': createEmbeddingModelEntry(1024, false),
|
|
381
|
+
// https://docs.mistral.ai/studio/knowledge-rag/embeddings/code_embeddings
|
|
382
|
+
'codestral-embed': createEmbeddingModelEntry(1536, true),
|
|
383
|
+
// Known IDs without declared capabilities retain the custom-model fallback.
|
|
384
|
+
'codestral-embed-2505': undefined,
|
|
385
|
+
'mistral-embed-2312': undefined,
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
const mistralSpeechModelEntries = {
|
|
389
|
+
'voxtral-mini-tts-3-0': createSpeechModelEntry(true),
|
|
390
|
+
'voxtral-mini-tts-2603': createSpeechModelEntry(true),
|
|
391
|
+
// Known IDs without declared capabilities retain the custom-model fallback.
|
|
392
|
+
'voxtral-mini-tts-3': undefined,
|
|
393
|
+
'voxtral-mini-tts-latest': undefined,
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
const mistralTranscriptionModelEntries = {
|
|
397
|
+
'voxtral-mini-transcribe-3-0': createTranscriptionModelEntry(
|
|
398
|
+
'voxtral-mini-transcribe-3-0',
|
|
399
|
+
true,
|
|
400
|
+
),
|
|
401
|
+
'voxtral-small-transcribe-3-0': createTranscriptionModelEntry(
|
|
402
|
+
'voxtral-small-transcribe-3-0',
|
|
403
|
+
true,
|
|
404
|
+
),
|
|
405
|
+
'voxtral-mini-latest': createTranscriptionModelEntry(
|
|
406
|
+
'voxtral-mini-latest',
|
|
407
|
+
true,
|
|
408
|
+
),
|
|
409
|
+
// Known IDs without declared capabilities retain the custom-model fallback.
|
|
410
|
+
'voxtral-mini-2602': undefined,
|
|
411
|
+
'voxtral-mini-transcribe-3': undefined,
|
|
412
|
+
'voxtral-mini-transcribe-latest': undefined,
|
|
413
|
+
'voxtral-mini-transcribe-realtime-3': undefined,
|
|
414
|
+
'voxtral-mini-transcribe-realtime-3-0': undefined,
|
|
415
|
+
'voxtral-small-transcribe-3': undefined,
|
|
416
|
+
'voxtral-small-transcribe-latest': undefined,
|
|
417
|
+
};
|
|
418
|
+
|
|
351
419
|
export const mistralModelCatalog: Readonly<Record<string, MistralModelEntry>> =
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
Object.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
),
|
|
367
|
-
|
|
368
|
-
'voxtral-mini-latest',
|
|
369
|
-
true,
|
|
420
|
+
Object.fromEntries(
|
|
421
|
+
Object.entries({
|
|
422
|
+
...Object.fromEntries(
|
|
423
|
+
Object.entries(languageModelDefinitions)
|
|
424
|
+
.filter(([, definition]) => definition != null)
|
|
425
|
+
.map(([modelId, image]) => [
|
|
426
|
+
modelId,
|
|
427
|
+
createLanguageModelEntry(modelId, image),
|
|
428
|
+
]),
|
|
429
|
+
),
|
|
430
|
+
...mistralTranscriptionModelEntries,
|
|
431
|
+
...mistralSpeechModelEntries,
|
|
432
|
+
|
|
433
|
+
...mistralEmbeddingModelEntries,
|
|
434
|
+
}).flatMap(([modelId, entry]) =>
|
|
435
|
+
entry != null ? [[modelId, entry] as const] : [],
|
|
370
436
|
),
|
|
371
|
-
|
|
372
|
-
'voxtral-mini-tts-2603': createSpeechModelEntry(true),
|
|
373
|
-
'mistral-embed': createEmbeddingModelEntry(1024, false),
|
|
374
|
-
// https://docs.mistral.ai/studio/knowledge-rag/embeddings/code_embeddings
|
|
375
|
-
'codestral-embed': createEmbeddingModelEntry(1536, true),
|
|
376
|
-
};
|
|
437
|
+
);
|
|
377
438
|
|
|
378
439
|
function findModelEntry(modelId: string) {
|
|
379
440
|
return Object.prototype.hasOwnProperty.call(mistralModelCatalog, modelId)
|
|
@@ -420,3 +481,11 @@ function declareProviderOptions<Option extends string>(
|
|
|
420
481
|
]),
|
|
421
482
|
) as Record<Option, ModelCapability>;
|
|
422
483
|
}
|
|
484
|
+
|
|
485
|
+
/** Known model IDs, derived from the declarations used to build the catalog. */
|
|
486
|
+
export type MistralModelIds = {
|
|
487
|
+
language: keyof typeof languageModelDefinitions;
|
|
488
|
+
embedding: keyof typeof mistralEmbeddingModelEntries;
|
|
489
|
+
speech: keyof typeof mistralSpeechModelEntries;
|
|
490
|
+
transcription: keyof typeof mistralTranscriptionModelEntries;
|
|
491
|
+
};
|
|
@@ -4,13 +4,9 @@ import {
|
|
|
4
4
|
type InferSchema,
|
|
5
5
|
} from '@ai-sdk/provider-utils';
|
|
6
6
|
import { z } from 'zod/v4';
|
|
7
|
+
import type { MistralModelIds } from './mistral-model-catalog';
|
|
7
8
|
|
|
8
|
-
export type MistralSpeechModelId =
|
|
9
|
-
| 'voxtral-mini-tts-2603'
|
|
10
|
-
| 'voxtral-mini-tts-3-0'
|
|
11
|
-
| 'voxtral-mini-tts-3'
|
|
12
|
-
| 'voxtral-mini-tts-latest'
|
|
13
|
-
| (string & {});
|
|
9
|
+
export type MistralSpeechModelId = MistralModelIds['speech'] | (string & {});
|
|
14
10
|
|
|
15
11
|
export const mistralSpeechModelOptions = lazySchema(() =>
|
|
16
12
|
zodSchema(
|
|
@@ -4,18 +4,10 @@ import {
|
|
|
4
4
|
type InferSchema,
|
|
5
5
|
} from '@ai-sdk/provider-utils';
|
|
6
6
|
import { z } from 'zod/v4';
|
|
7
|
+
import type { MistralModelIds } from './mistral-model-catalog';
|
|
7
8
|
|
|
8
9
|
export type MistralTranscriptionModelId =
|
|
9
|
-
| '
|
|
10
|
-
| 'voxtral-mini-latest'
|
|
11
|
-
| 'voxtral-mini-transcribe-3-0'
|
|
12
|
-
| 'voxtral-mini-transcribe-3'
|
|
13
|
-
| 'voxtral-mini-transcribe-latest'
|
|
14
|
-
| 'voxtral-small-transcribe-3-0'
|
|
15
|
-
| 'voxtral-small-transcribe-3'
|
|
16
|
-
| 'voxtral-small-transcribe-latest'
|
|
17
|
-
| 'voxtral-mini-transcribe-realtime-3'
|
|
18
|
-
| 'voxtral-mini-transcribe-realtime-3-0'
|
|
10
|
+
| MistralModelIds['transcription']
|
|
19
11
|
| (string & {});
|
|
20
12
|
|
|
21
13
|
// https://docs.mistral.ai/api/endpoint/audio/transcriptions
|