@ai-sdk/mistral 3.0.73 → 3.0.75
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 +16 -0
- package/dist/index.d.mts +16 -19
- package/dist/index.d.ts +16 -19
- package/dist/index.js +163 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -106
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/mistral-chat-language-model.ts +102 -85
- package/src/mistral-chat-options.ts +46 -37
- package/src/mistral-embedding-model.ts +10 -4
- package/src/mistral-error.ts +18 -9
- package/src/mistral-speech-model-options.ts +18 -9
- package/src/mistral-speech-model.ts +9 -3
package/dist/index.mjs
CHANGED
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
InvalidResponseDataError
|
|
14
14
|
} from "@ai-sdk/provider";
|
|
15
15
|
import {
|
|
16
|
+
lazySchema as lazySchema3,
|
|
17
|
+
zodSchema as zodSchema3,
|
|
16
18
|
combineHeaders,
|
|
17
19
|
createEventSourceResponseHandler,
|
|
18
20
|
createJsonResponseHandler,
|
|
@@ -253,54 +255,70 @@ function mapMistralFinishReason(finishReason) {
|
|
|
253
255
|
}
|
|
254
256
|
|
|
255
257
|
// src/mistral-chat-options.ts
|
|
258
|
+
import {
|
|
259
|
+
lazySchema,
|
|
260
|
+
zodSchema
|
|
261
|
+
} from "@ai-sdk/provider-utils";
|
|
256
262
|
import { z as z2 } from "zod/v4";
|
|
257
|
-
var mistralLanguageModelOptions =
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
263
|
+
var mistralLanguageModelOptions = lazySchema(
|
|
264
|
+
() => zodSchema(
|
|
265
|
+
z2.object({
|
|
266
|
+
/**
|
|
267
|
+
* Whether to inject a safety prompt before all conversations.
|
|
268
|
+
*
|
|
269
|
+
* Defaults to `false`.
|
|
270
|
+
*/
|
|
271
|
+
safePrompt: z2.boolean().optional(),
|
|
272
|
+
documentImageLimit: z2.number().optional(),
|
|
273
|
+
documentPageLimit: z2.number().optional(),
|
|
274
|
+
/**
|
|
275
|
+
* Whether to use structured outputs.
|
|
276
|
+
*
|
|
277
|
+
* @default true
|
|
278
|
+
*/
|
|
279
|
+
structuredOutputs: z2.boolean().optional(),
|
|
280
|
+
/**
|
|
281
|
+
* Whether to use strict JSON schema validation.
|
|
282
|
+
*
|
|
283
|
+
* @default false
|
|
284
|
+
*/
|
|
285
|
+
strictJsonSchema: z2.boolean().optional(),
|
|
286
|
+
/**
|
|
287
|
+
* Whether to enable parallel function calling during tool use.
|
|
288
|
+
* When set to false, the model will use at most one tool per response.
|
|
289
|
+
*
|
|
290
|
+
* @default true
|
|
291
|
+
*/
|
|
292
|
+
parallelToolCalls: z2.boolean().optional(),
|
|
293
|
+
/**
|
|
294
|
+
* Controls the reasoning effort for models that support adjustable reasoning.
|
|
295
|
+
*
|
|
296
|
+
* - `'high'`: Enable reasoning
|
|
297
|
+
* - `'none'`: Disable reasoning
|
|
298
|
+
*/
|
|
299
|
+
reasoningEffort: z2.enum(["high", "none"]).optional()
|
|
300
|
+
})
|
|
301
|
+
)
|
|
302
|
+
);
|
|
293
303
|
|
|
294
304
|
// src/mistral-error.ts
|
|
295
|
-
import {
|
|
305
|
+
import {
|
|
306
|
+
lazySchema as lazySchema2,
|
|
307
|
+
zodSchema as zodSchema2,
|
|
308
|
+
createJsonErrorResponseHandler
|
|
309
|
+
} from "@ai-sdk/provider-utils";
|
|
296
310
|
import { z as z3 } from "zod/v4";
|
|
297
|
-
var mistralErrorDataSchema =
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
var mistralErrorDataSchema = lazySchema2(
|
|
312
|
+
() => zodSchema2(
|
|
313
|
+
z3.object({
|
|
314
|
+
object: z3.literal("error"),
|
|
315
|
+
message: z3.string(),
|
|
316
|
+
type: z3.string(),
|
|
317
|
+
param: z3.string().nullable(),
|
|
318
|
+
code: z3.string().nullable()
|
|
319
|
+
})
|
|
320
|
+
)
|
|
321
|
+
);
|
|
304
322
|
var mistralFailedResponseHandler = createJsonErrorResponseHandler({
|
|
305
323
|
errorSchema: mistralErrorDataSchema,
|
|
306
324
|
errorToMessage: (data) => data.message
|
|
@@ -750,7 +768,7 @@ function extractTextContent(content) {
|
|
|
750
768
|
}
|
|
751
769
|
return textContent.length ? textContent.join("") : void 0;
|
|
752
770
|
}
|
|
753
|
-
var mistralContentSchema = z4.union([
|
|
771
|
+
var mistralContentSchema = () => z4.union([
|
|
754
772
|
z4.string(),
|
|
755
773
|
z4.array(
|
|
756
774
|
z4.discriminatedUnion("type", [
|
|
@@ -784,61 +802,74 @@ var mistralContentSchema = z4.union([
|
|
|
784
802
|
])
|
|
785
803
|
)
|
|
786
804
|
]).nullish();
|
|
787
|
-
var mistralChatResponseSchema =
|
|
788
|
-
|
|
789
|
-
created: z4.number().nullish(),
|
|
790
|
-
model: z4.string().nullish(),
|
|
791
|
-
choices: z4.array(
|
|
805
|
+
var mistralChatResponseSchema = lazySchema3(
|
|
806
|
+
() => zodSchema3(
|
|
792
807
|
z4.object({
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
808
|
+
id: z4.string().nullish(),
|
|
809
|
+
created: z4.number().nullish(),
|
|
810
|
+
model: z4.string().nullish(),
|
|
811
|
+
choices: z4.array(
|
|
812
|
+
z4.object({
|
|
813
|
+
message: z4.object({
|
|
814
|
+
role: z4.literal("assistant"),
|
|
815
|
+
content: mistralContentSchema(),
|
|
816
|
+
tool_calls: z4.array(
|
|
817
|
+
z4.object({
|
|
818
|
+
id: z4.string(),
|
|
819
|
+
function: z4.object({
|
|
820
|
+
name: z4.string(),
|
|
821
|
+
arguments: z4.string()
|
|
822
|
+
})
|
|
823
|
+
})
|
|
824
|
+
).nullish()
|
|
825
|
+
}),
|
|
826
|
+
index: z4.number(),
|
|
827
|
+
finish_reason: z4.string().nullish()
|
|
828
|
+
})
|
|
829
|
+
),
|
|
830
|
+
object: z4.literal("chat.completion"),
|
|
831
|
+
usage: mistralUsageSchema
|
|
805
832
|
})
|
|
806
|
-
)
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
var mistralChatChunkSchema = z4.object({
|
|
811
|
-
id: z4.string().nullish(),
|
|
812
|
-
created: z4.number().nullish(),
|
|
813
|
-
model: z4.string().nullish(),
|
|
814
|
-
choices: z4.array(
|
|
833
|
+
)
|
|
834
|
+
);
|
|
835
|
+
var mistralChatChunkSchema = lazySchema3(
|
|
836
|
+
() => zodSchema3(
|
|
815
837
|
z4.object({
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
838
|
+
id: z4.string().nullish(),
|
|
839
|
+
created: z4.number().nullish(),
|
|
840
|
+
model: z4.string().nullish(),
|
|
841
|
+
choices: z4.array(
|
|
842
|
+
z4.object({
|
|
843
|
+
delta: z4.object({
|
|
844
|
+
role: z4.enum(["assistant"]).optional(),
|
|
845
|
+
content: mistralContentSchema(),
|
|
846
|
+
tool_calls: z4.array(
|
|
847
|
+
z4.object({
|
|
848
|
+
index: z4.number().nullish(),
|
|
849
|
+
id: z4.string().nullish(),
|
|
850
|
+
function: z4.object({
|
|
851
|
+
name: z4.string().nullish(),
|
|
852
|
+
arguments: z4.string().nullish()
|
|
853
|
+
})
|
|
854
|
+
})
|
|
855
|
+
).nullish()
|
|
856
|
+
}),
|
|
857
|
+
finish_reason: z4.string().nullish(),
|
|
858
|
+
index: z4.number()
|
|
859
|
+
})
|
|
860
|
+
),
|
|
861
|
+
usage: mistralUsageSchema.nullish()
|
|
832
862
|
})
|
|
833
|
-
)
|
|
834
|
-
|
|
835
|
-
});
|
|
863
|
+
)
|
|
864
|
+
);
|
|
836
865
|
|
|
837
866
|
// src/mistral-embedding-model.ts
|
|
838
867
|
import {
|
|
839
868
|
TooManyEmbeddingValuesForCallError
|
|
840
869
|
} from "@ai-sdk/provider";
|
|
841
870
|
import {
|
|
871
|
+
lazySchema as lazySchema4,
|
|
872
|
+
zodSchema as zodSchema4,
|
|
842
873
|
combineHeaders as combineHeaders2,
|
|
843
874
|
createJsonResponseHandler as createJsonResponseHandler2,
|
|
844
875
|
postJsonToApi as postJsonToApi2
|
|
@@ -895,13 +926,19 @@ var MistralEmbeddingModel = class {
|
|
|
895
926
|
};
|
|
896
927
|
}
|
|
897
928
|
};
|
|
898
|
-
var MistralTextEmbeddingResponseSchema =
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
})
|
|
929
|
+
var MistralTextEmbeddingResponseSchema = lazySchema4(
|
|
930
|
+
() => zodSchema4(
|
|
931
|
+
z5.object({
|
|
932
|
+
data: z5.array(z5.object({ embedding: z5.array(z5.number()) })),
|
|
933
|
+
usage: z5.object({ prompt_tokens: z5.number() }).nullish()
|
|
934
|
+
})
|
|
935
|
+
)
|
|
936
|
+
);
|
|
902
937
|
|
|
903
938
|
// src/mistral-speech-model.ts
|
|
904
939
|
import {
|
|
940
|
+
lazySchema as lazySchema6,
|
|
941
|
+
zodSchema as zodSchema6,
|
|
905
942
|
combineHeaders as combineHeaders3,
|
|
906
943
|
createJsonResponseHandler as createJsonResponseHandler3,
|
|
907
944
|
parseProviderOptions as parseProviderOptions2,
|
|
@@ -910,15 +947,23 @@ import {
|
|
|
910
947
|
import { z as z7 } from "zod/v4";
|
|
911
948
|
|
|
912
949
|
// src/mistral-speech-model-options.ts
|
|
950
|
+
import {
|
|
951
|
+
lazySchema as lazySchema5,
|
|
952
|
+
zodSchema as zodSchema5
|
|
953
|
+
} from "@ai-sdk/provider-utils";
|
|
913
954
|
import { z as z6 } from "zod/v4";
|
|
914
|
-
var mistralSpeechModelOptions =
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
955
|
+
var mistralSpeechModelOptions = lazySchema5(
|
|
956
|
+
() => zodSchema5(
|
|
957
|
+
z6.object({
|
|
958
|
+
/**
|
|
959
|
+
* Base64-encoded reference audio for one-off voice cloning.
|
|
960
|
+
*
|
|
961
|
+
* When provided, this takes precedence over the standard `voice` option.
|
|
962
|
+
*/
|
|
963
|
+
refAudio: z6.string().min(1).optional()
|
|
964
|
+
})
|
|
965
|
+
)
|
|
966
|
+
);
|
|
922
967
|
|
|
923
968
|
// src/mistral-speech-model.ts
|
|
924
969
|
var MistralSpeechModel = class {
|
|
@@ -1032,12 +1077,16 @@ var MistralSpeechModel = class {
|
|
|
1032
1077
|
};
|
|
1033
1078
|
}
|
|
1034
1079
|
};
|
|
1035
|
-
var mistralSpeechResponseSchema =
|
|
1036
|
-
|
|
1037
|
-
|
|
1080
|
+
var mistralSpeechResponseSchema = lazySchema6(
|
|
1081
|
+
() => zodSchema6(
|
|
1082
|
+
z7.object({
|
|
1083
|
+
audio_data: z7.string()
|
|
1084
|
+
})
|
|
1085
|
+
)
|
|
1086
|
+
);
|
|
1038
1087
|
|
|
1039
1088
|
// src/version.ts
|
|
1040
|
-
var VERSION = true ? "3.0.
|
|
1089
|
+
var VERSION = true ? "3.0.75" : "0.0.0-test";
|
|
1041
1090
|
|
|
1042
1091
|
// src/mistral-provider.ts
|
|
1043
1092
|
function createMistral(options = {}) {
|