@ai-sdk/mistral 4.0.54 → 4.0.55
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 +11 -0
- package/dist/index.d.ts +108 -103
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1068 -1361
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/map-mistral-finish-reason.ts +2 -0
- package/src/mistral-chat-language-model.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @ai-sdk/mistral
|
|
2
2
|
|
|
3
|
+
## 4.0.55
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c636bb4: fix(mistral): map provider error finish reasons to error
|
|
8
|
+
- ede5b89: chore: migrate package builds from tsup to tsdown
|
|
9
|
+
- 5fa97cd: fix(mistral): preserve JSON schemas when structured outputs are disabled
|
|
10
|
+
- Updated dependencies [ede5b89]
|
|
11
|
+
- @ai-sdk/provider@4.0.20
|
|
12
|
+
- @ai-sdk/provider-utils@5.0.52
|
|
13
|
+
|
|
3
14
|
## 4.0.54
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,128 +1,133 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { EmbeddingModelV4, LanguageModelV4, ProviderV4, SpeechModelV4, TranscriptionModelV4 } from "@ai-sdk/provider";
|
|
2
|
+
import { FetchFunction, InferSchema } from "@ai-sdk/provider-utils";
|
|
3
|
+
import { z } from "zod/v4";
|
|
4
|
+
//#region src/mistral-chat-language-model-options.d.ts
|
|
6
5
|
type MistralChatModelId = 'codestral-2508' | 'codestral-latest' | 'glm-5-2' | 'labs-leanstral-1-5' | 'labs-leanstral-1-5-1' | 'magistral-medium-latest' | 'magistral-small-latest' | 'ministral-14b-2512' | 'ministral-14b-latest' | 'ministral-3b-2512' | 'ministral-3b-latest' | 'ministral-8b-2512' | 'ministral-8b-latest' | 'mistral-code-fim-latest' | 'mistral-code-latest' | 'mistral-large-latest' | 'mistral-large-2512' | 'mistral-medium' | 'mistral-medium-latest' | 'mistral-medium-2604' | 'mistral-medium-3' | 'mistral-medium-3-5' | 'mistral-medium-3.5' | 'mistral-small-2603' | 'mistral-small-latest' | 'mistral-vibe-cli-fast' | 'mistral-vibe-cli-latest' | 'mistral-vibe-cli-with-tools' | 'voxtral-small-2507' | 'voxtral-small-latest' | 'zai-glm-5-2' | (string & {});
|
|
7
6
|
declare const mistralLanguageModelChatOptions: z.ZodObject<{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
safePrompt: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
+
documentImageLimit: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
documentPageLimit: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
structuredOutputs: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
strictJsonSchema: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
parallelToolCalls: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
promptCacheKey: z.ZodOptional<z.ZodString>;
|
|
14
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
high: "high";
|
|
16
|
+
none: "none";
|
|
17
|
+
}>>;
|
|
19
18
|
}, z.core.$strip>;
|
|
20
19
|
type MistralLanguageModelChatOptions = z.infer<typeof mistralLanguageModelChatOptions>;
|
|
21
|
-
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/mistral-embedding-model-options.d.ts
|
|
22
22
|
type MistralEmbeddingModelId = 'mistral-embed' | 'mistral-embed-2312' | 'codestral-embed' | 'codestral-embed-2505' | (string & {});
|
|
23
23
|
declare const mistralEmbeddingModelOptions: z.ZodObject<{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
25
|
+
outputDimension: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
outputDtype: z.ZodOptional<z.ZodEnum<{
|
|
27
|
+
float: "float";
|
|
28
|
+
int8: "int8";
|
|
29
|
+
uint8: "uint8";
|
|
30
|
+
binary: "binary";
|
|
31
|
+
ubinary: "ubinary";
|
|
32
|
+
}>>;
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
type MistralEmbeddingModelOptions = z.infer<typeof mistralEmbeddingModelOptions>;
|
|
35
|
-
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/mistral-speech-model-options.d.ts
|
|
36
37
|
type MistralSpeechModelId = 'voxtral-mini-tts-2603' | 'voxtral-mini-tts-latest' | (string & {});
|
|
37
38
|
declare const mistralSpeechModelOptions: z.ZodObject<{
|
|
38
|
-
|
|
39
|
+
refAudio: z.ZodOptional<z.ZodString>;
|
|
39
40
|
}, z.core.$strip>;
|
|
40
41
|
type MistralSpeechModelOptions = z.infer<typeof mistralSpeechModelOptions>;
|
|
41
|
-
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/mistral-transcription-model-options.d.ts
|
|
42
44
|
type MistralTranscriptionModelId = 'voxtral-mini-2602' | 'voxtral-mini-latest' | (string & {});
|
|
43
|
-
declare const mistralTranscriptionModelOptions:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
declare const mistralTranscriptionModelOptions: import("@ai-sdk/provider-utils").LazySchema<{
|
|
46
|
+
language?: string | undefined;
|
|
47
|
+
temperature?: number | undefined;
|
|
48
|
+
timestampGranularities?: ("segment" | "word")[] | undefined;
|
|
49
|
+
diarize?: boolean | undefined;
|
|
50
|
+
contextBias?: string[] | undefined;
|
|
49
51
|
}>;
|
|
50
52
|
type MistralTranscriptionModelOptions = InferSchema<typeof mistralTranscriptionModelOptions>;
|
|
51
|
-
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/mistral-provider.d.ts
|
|
52
55
|
interface MistralProvider extends ProviderV4 {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
56
|
+
(modelId: MistralChatModelId): LanguageModelV4;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a model for text generation.
|
|
59
|
+
*/
|
|
60
|
+
languageModel(modelId: MistralChatModelId): LanguageModelV4;
|
|
61
|
+
/**
|
|
62
|
+
* Creates a model for text generation.
|
|
63
|
+
*/
|
|
64
|
+
chat(modelId: MistralChatModelId): LanguageModelV4;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a model for text embeddings.
|
|
67
|
+
*/
|
|
68
|
+
embedding(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a model for text embeddings.
|
|
71
|
+
*/
|
|
72
|
+
embeddingModel: (modelId: MistralEmbeddingModelId) => EmbeddingModelV4;
|
|
73
|
+
/**
|
|
74
|
+
* Creates a model for speech generation (text-to-speech).
|
|
75
|
+
*/
|
|
76
|
+
speech(modelId: MistralSpeechModelId): SpeechModelV4;
|
|
77
|
+
/**
|
|
78
|
+
* Creates a model for speech generation (text-to-speech).
|
|
79
|
+
*/
|
|
80
|
+
speechModel(modelId: MistralSpeechModelId): SpeechModelV4;
|
|
81
|
+
/**
|
|
82
|
+
* Creates a model for audio transcription.
|
|
83
|
+
*/
|
|
84
|
+
transcription(modelId: MistralTranscriptionModelId): TranscriptionModelV4;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a model for audio transcription.
|
|
87
|
+
*/
|
|
88
|
+
transcriptionModel(modelId: MistralTranscriptionModelId): TranscriptionModelV4;
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated Use `embedding` instead.
|
|
91
|
+
*/
|
|
92
|
+
textEmbedding(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Use `embeddingModel` instead.
|
|
95
|
+
*/
|
|
96
|
+
textEmbeddingModel(modelId: MistralEmbeddingModelId): EmbeddingModelV4;
|
|
94
97
|
}
|
|
95
98
|
interface MistralProviderSettings {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
101
|
+
* The default prefix is `https://api.mistral.ai/v1`.
|
|
102
|
+
*/
|
|
103
|
+
baseURL?: string;
|
|
104
|
+
/**
|
|
105
|
+
* API key that is being send using the `Authorization` header.
|
|
106
|
+
* It defaults to the `MISTRAL_API_KEY` environment variable.
|
|
107
|
+
*/
|
|
108
|
+
apiKey?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Custom headers to include in the requests.
|
|
111
|
+
*/
|
|
112
|
+
headers?: Record<string, string>;
|
|
113
|
+
/**
|
|
114
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
115
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
116
|
+
*/
|
|
117
|
+
fetch?: FetchFunction;
|
|
118
|
+
generateId?: () => string;
|
|
116
119
|
}
|
|
117
120
|
/**
|
|
118
121
|
* Create a Mistral AI provider instance.
|
|
119
122
|
*/
|
|
120
|
-
declare function createMistral(options?: MistralProviderSettings): MistralProvider;
|
|
123
|
+
export declare function createMistral(options?: MistralProviderSettings): MistralProvider;
|
|
121
124
|
/**
|
|
122
125
|
* Default Mistral provider instance.
|
|
123
126
|
*/
|
|
124
|
-
declare const mistral: MistralProvider;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
export declare const mistral: MistralProvider;
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/version.d.ts
|
|
130
|
+
export declare const VERSION: string;
|
|
131
|
+
//#endregion
|
|
132
|
+
export type { MistralEmbeddingModelOptions, MistralLanguageModelChatOptions, MistralLanguageModelChatOptions as MistralLanguageModelOptions, MistralProvider, MistralProviderSettings, MistralSpeechModelId, MistralSpeechModelOptions, MistralTranscriptionModelId, MistralTranscriptionModelOptions };
|
|
133
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/mistral-chat-language-model-options.ts","../src/mistral-embedding-model-options.ts","../src/mistral-speech-model-options.ts","../src/mistral-transcription-model-options.ts","../src/mistral-provider.ts","../src/version.ts"],"mappings":";;;;KAGY;cAkCC,iCAA+B,EAAA;;;;;;;;;;;;GA8C1C,EAAA,KAAA;KAEU,kCAAkC,EAAE,aACvC;;;KCpFG;cAOC,8BAA4B,EAAA;;;;;;;;;;GAiBvC,EAAA,KAAA;KAEU,+BAA+B,EAAE,aACpC;;;KC3BG;cAKC,2BAAyB,EAAA;;GAOpC,EAAA,KAAA;KAEU,4BAA4B,EAAE,aACjC;;;KCVG;cAMC,mEAAgC;;;;;;;KAkDjC,mCAAmC,mBACtC;;;UCxCQ,wBAAwB;GACtC,SAAS,qBAAqB;;;;EAK/B,cAAc,SAAS,qBAAqB;;;;EAK5C,KAAK,SAAS,qBAAqB;;;;EAKnC,UAAU,SAAS,0BAA0B;;;;EAK7C,iBAAiB,SAAS,4BAA4B;;;;EAKtD,OAAO,SAAS,uBAAuB;;;;EAKvC,YAAY,SAAS,uBAAuB;;;;EAK5C,cAAc,SAAS,8BAA8B;;;;EAKrD,mBACE,SAAS,8BACR;;;;EAKH,cAAc,SAAS,0BAA0B;;;;EAKjD,mBAAmB,SAAS,0BAA0B;;UAGvC;;;;;EAKf;;;;;EAMA;;;;EAKA,UAAU;;;;;EAMV,QAAQ;EAER;;;;;wBAMc,cACd,UAAS,0BACR;;;;qBAkFU,SAAO;;;qBChMP"}
|