@ai-sdk/mistral 4.0.76 → 4.0.78
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.js +227 -65
- package/dist/index.js.map +1 -1
- package/docs/20-mistral.mdx +20 -3
- package/package.json +2 -2
- package/src/convert-to-mistral-chat-messages.ts +16 -2
- package/src/convert-to-mistral-conversation-inputs.ts +14 -5
- package/src/mistral-chat-language-model.ts +7 -39
- package/src/mistral-conversation-language-model.ts +8 -26
- package/src/mistral-model-catalog.ts +401 -0
- package/src/mistral-speech-model.ts +4 -2
- package/src/mistral-transcription-model.ts +3 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ai-sdk/mistral
|
|
2
2
|
|
|
3
|
+
## 4.0.78
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4ae6986: fix(mistral): preserve string tool call arguments and safely serialize BigInt and circular structures in tool calls and outputs
|
|
8
|
+
- Updated dependencies [51ca5b7]
|
|
9
|
+
- Updated dependencies [dc6f1c3]
|
|
10
|
+
- Updated dependencies [4ae6986]
|
|
11
|
+
- @ai-sdk/provider-utils@5.0.73
|
|
12
|
+
|
|
13
|
+
## 4.0.77
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 19cb252: Centralize Mistral model capabilities and provider option support in a model catalog shared by request preparation and generated documentation, preserving Chat and Conversations reasoning policies and legacy transcription restrictions.
|
|
18
|
+
|
|
3
19
|
## 4.0.76
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InvalidArgumentError, NoSuchModelError, TooManyEmbeddingValuesForCallError, UnsupportedFunctionalityError } from "@ai-sdk/provider";
|
|
2
|
-
import { StreamingToolCallTracker, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, convertBase64ToUint8Array, convertToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createLanguageModelResponseMetadata as getResponseMetadata, createNullLanguageModelUsage, createProviderExecutedToolFactory, createToolNameMapping, generateId, getTopLevelMediaType, injectJsonInstructionIntoMessages, isCustomReasoning, lazySchema, loadApiKey, mapReasoningToProviderEffort, mediaTypeToExtension, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, resolve, resolveFullMediaType, resolveWith, serializeModelOptions, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
2
|
+
import { StreamingToolCallTracker, WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, convertBase64ToUint8Array, convertToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createLanguageModelResponseMetadata as getResponseMetadata, createNullLanguageModelUsage, createProviderExecutedToolFactory, createToolNameMapping, generateId, getTopLevelMediaType, injectJsonInstructionIntoMessages, isCustomReasoning, lazySchema, loadApiKey, mapReasoningToProviderEffort, mediaTypeToExtension, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, resolve, resolveFullMediaType, resolveWith, secureJsonParse, serializeModelOptions, stringifyWithBigIntAndCycles, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
3
3
|
import { z } from "zod/v4";
|
|
4
4
|
//#region src/convert-mistral-usage.ts
|
|
5
5
|
const mistralPromptTokensDetailsSchema = z.object({
|
|
@@ -47,6 +47,15 @@ function formatFileUrl({ part }) {
|
|
|
47
47
|
if (part.data.type === "data") return `data:${resolveFullMediaType({ part })};base64,${convertToBase64(part.data.data)}`;
|
|
48
48
|
throw new UnsupportedFunctionalityError({ functionality: `file part data type ${part.data.type}` });
|
|
49
49
|
}
|
|
50
|
+
function serializeMistralToolCallArguments(input) {
|
|
51
|
+
if (typeof input === "string") try {
|
|
52
|
+
secureJsonParse(input);
|
|
53
|
+
return input;
|
|
54
|
+
} catch {
|
|
55
|
+
return JSON.stringify(input);
|
|
56
|
+
}
|
|
57
|
+
return stringifyWithBigIntAndCycles(input);
|
|
58
|
+
}
|
|
50
59
|
function convertToMistralChatMessages(prompt) {
|
|
51
60
|
const messages = [];
|
|
52
61
|
for (let i = 0; i < prompt.length; i++) {
|
|
@@ -109,7 +118,7 @@ function convertToMistralChatMessages(prompt) {
|
|
|
109
118
|
type: "function",
|
|
110
119
|
function: {
|
|
111
120
|
name: part.toolName,
|
|
112
|
-
arguments:
|
|
121
|
+
arguments: serializeMistralToolCallArguments(part.input)
|
|
113
122
|
}
|
|
114
123
|
});
|
|
115
124
|
break;
|
|
@@ -149,7 +158,7 @@ function convertToMistralChatMessages(prompt) {
|
|
|
149
158
|
break;
|
|
150
159
|
case "content":
|
|
151
160
|
case "json":
|
|
152
|
-
case "error-json": contentValue =
|
|
161
|
+
case "error-json": contentValue = stringifyWithBigIntAndCycles(output.value);
|
|
153
162
|
}
|
|
154
163
|
messages.push({
|
|
155
164
|
role: "tool",
|
|
@@ -292,7 +301,49 @@ function prepareTools({ tools, toolChoice }) {
|
|
|
292
301
|
}
|
|
293
302
|
}
|
|
294
303
|
//#endregion
|
|
295
|
-
//#region src/mistral-
|
|
304
|
+
//#region src/mistral-model-catalog.ts
|
|
305
|
+
const mistralProviderOptions = {
|
|
306
|
+
language: {
|
|
307
|
+
safePrompt: { description: "Inject a safety prompt. Chat API only." },
|
|
308
|
+
documentImageLimit: { description: "Maximum document images. Chat API only." },
|
|
309
|
+
documentPageLimit: { description: "Maximum document pages. Chat API only." },
|
|
310
|
+
structuredOutputs: { description: "Whether to send a JSON response schema." },
|
|
311
|
+
strictJsonSchema: { description: "Whether to use strict JSON schema validation." },
|
|
312
|
+
parallelToolCalls: { description: "Allow parallel function calls. Chat API only." },
|
|
313
|
+
promptCacheKey: { description: "Cache affinity key. Chat API only." },
|
|
314
|
+
reasoningEffort: { description: "Reasoning effort for configurable reasoning models." }
|
|
315
|
+
},
|
|
316
|
+
embedding: {
|
|
317
|
+
metadata: { description: "Metadata attached to the embedding request." },
|
|
318
|
+
outputDimension: { description: "Output embedding dimensions." },
|
|
319
|
+
outputDtype: { description: "Output embedding data type." }
|
|
320
|
+
},
|
|
321
|
+
transcription: {
|
|
322
|
+
language: { description: "Language of the audio." },
|
|
323
|
+
returnLanguage: { description: "Return the detected language." },
|
|
324
|
+
temperature: { description: "Sampling temperature." },
|
|
325
|
+
timestampGranularities: { description: "Timestamp granularities to return." },
|
|
326
|
+
diarize: { description: "Identify speakers in the transcription." },
|
|
327
|
+
contextBias: { description: "Vocabulary and context to guide transcription." }
|
|
328
|
+
},
|
|
329
|
+
speech: {
|
|
330
|
+
refAudio: { description: "Reference audio for voice cloning, overriding voice." },
|
|
331
|
+
expressiveness: { description: "Speech expressiveness, from 1 to 5." },
|
|
332
|
+
phonemeHints: { description: "Pronunciation hints as IPA phonemes." }
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
const documentedLanguageModels = {
|
|
336
|
+
"labs-leanstral-1-5": true,
|
|
337
|
+
"magistral-medium-latest": true,
|
|
338
|
+
"magistral-small-latest": true,
|
|
339
|
+
"ministral-14b-latest": true,
|
|
340
|
+
"ministral-8b-latest": true,
|
|
341
|
+
"mistral-large-latest": true,
|
|
342
|
+
"mistral-medium-latest": true,
|
|
343
|
+
"mistral-small-latest": true,
|
|
344
|
+
"voxtral-small-latest": false,
|
|
345
|
+
"zai-glm-5-2": false
|
|
346
|
+
};
|
|
296
347
|
const modelsWithoutReasoningEffort = /* @__PURE__ */ new Set([
|
|
297
348
|
"codestral-2508",
|
|
298
349
|
"codestral-latest",
|
|
@@ -315,6 +366,159 @@ const modelsWithLowHighMaxReasoningEffort = /* @__PURE__ */ new Set([
|
|
|
315
366
|
"zai-glm-5-3-flash",
|
|
316
367
|
"zai-glm-latest"
|
|
317
368
|
]);
|
|
369
|
+
const reasoningEffortModelIds = /* @__PURE__ */ new Set([
|
|
370
|
+
"glm-5-2",
|
|
371
|
+
"labs-leanstral-1-5",
|
|
372
|
+
"labs-leanstral-1-5-1",
|
|
373
|
+
"magistral-medium-latest",
|
|
374
|
+
"magistral-small-latest",
|
|
375
|
+
"mistral-large-4",
|
|
376
|
+
"mistral-large-4-0",
|
|
377
|
+
"mistral-medium",
|
|
378
|
+
"mistral-medium-2604",
|
|
379
|
+
"mistral-medium-3",
|
|
380
|
+
"mistral-medium-3-5",
|
|
381
|
+
"mistral-medium-3.5",
|
|
382
|
+
"mistral-medium-latest",
|
|
383
|
+
"mistral-small-2603",
|
|
384
|
+
"mistral-small-latest",
|
|
385
|
+
"mistral-vibe-cli-fast",
|
|
386
|
+
"mistral-vibe-cli-latest",
|
|
387
|
+
"mistral-vibe-cli-with-tools",
|
|
388
|
+
"zai-glm-5-2"
|
|
389
|
+
]);
|
|
390
|
+
function reasoningCapabilities(efforts) {
|
|
391
|
+
return {
|
|
392
|
+
support: efforts.length > 0,
|
|
393
|
+
efforts
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
function createLanguageModelEntry(modelId, image) {
|
|
397
|
+
const reasoning = reasoningCapabilities(modelsWithoutReasoningEffort.has(modelId) ? [] : modelsWithLowHighMaxReasoningEffort.has(modelId) ? [
|
|
398
|
+
"low",
|
|
399
|
+
"high",
|
|
400
|
+
"max"
|
|
401
|
+
] : ["none", "high"]);
|
|
402
|
+
const conversationReasoning = reasoningCapabilities(reasoningEffortModelIds.has(modelId) ? ["none", "high"] : []);
|
|
403
|
+
const chatOnly = { condition: "Only supported on the Chat API." };
|
|
404
|
+
return {
|
|
405
|
+
capabilities: { language: {
|
|
406
|
+
inputs: {
|
|
407
|
+
image: image ?? "unknown",
|
|
408
|
+
audio: "unknown"
|
|
409
|
+
},
|
|
410
|
+
objectGeneration: image != null ? true : "unknown",
|
|
411
|
+
tools: {
|
|
412
|
+
usage: image != null ? true : "unknown",
|
|
413
|
+
streaming: image != null ? true : "unknown"
|
|
414
|
+
},
|
|
415
|
+
reasoning,
|
|
416
|
+
sampling: {
|
|
417
|
+
temperature: "unknown",
|
|
418
|
+
topP: "unknown",
|
|
419
|
+
logprobs: false
|
|
420
|
+
},
|
|
421
|
+
endpoints: { conversation: { reasoning: conversationReasoning } }
|
|
422
|
+
} },
|
|
423
|
+
providerOptions: { language: declareProviderOptions(mistralProviderOptions.language, image != null ? true : "unknown", {
|
|
424
|
+
safePrompt: chatOnly,
|
|
425
|
+
documentImageLimit: chatOnly,
|
|
426
|
+
documentPageLimit: chatOnly,
|
|
427
|
+
parallelToolCalls: chatOnly,
|
|
428
|
+
promptCacheKey: chatOnly,
|
|
429
|
+
reasoningEffort: reasoning.support && !conversationReasoning.support ? chatOnly : reasoning.support
|
|
430
|
+
}) }
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function createTranscriptionModelEntry(modelId, declared) {
|
|
434
|
+
const languageWithTimestamps = ![
|
|
435
|
+
"voxtral-mini-2507",
|
|
436
|
+
"voxtral-mini-2602",
|
|
437
|
+
"voxtral-mini-latest"
|
|
438
|
+
].includes(modelId);
|
|
439
|
+
const support = declared ? true : "unknown";
|
|
440
|
+
return {
|
|
441
|
+
capabilities: { transcription: {
|
|
442
|
+
transcription: support,
|
|
443
|
+
streaming: false,
|
|
444
|
+
duration: support,
|
|
445
|
+
segments: support,
|
|
446
|
+
language: support,
|
|
447
|
+
languageWithTimestamps,
|
|
448
|
+
timestamps: support,
|
|
449
|
+
diarization: support,
|
|
450
|
+
contextBias: support
|
|
451
|
+
} },
|
|
452
|
+
providerOptions: { transcription: declareProviderOptions(mistralProviderOptions.transcription, support, {
|
|
453
|
+
returnLanguage: { condition: "Only supported when language is not pinned." },
|
|
454
|
+
timestampGranularities: languageWithTimestamps ? support : { condition: "Only supported when language is not pinned." }
|
|
455
|
+
}) }
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
function createSpeechModelEntry(declared) {
|
|
459
|
+
const support = declared ? true : "unknown";
|
|
460
|
+
return {
|
|
461
|
+
capabilities: { speech: {
|
|
462
|
+
instructions: false,
|
|
463
|
+
savedVoices: support,
|
|
464
|
+
referenceAudio: support,
|
|
465
|
+
nonStreaming: true,
|
|
466
|
+
outputFormats: [
|
|
467
|
+
"pcm",
|
|
468
|
+
"wav",
|
|
469
|
+
"mp3",
|
|
470
|
+
"flac",
|
|
471
|
+
"opus"
|
|
472
|
+
]
|
|
473
|
+
} },
|
|
474
|
+
providerOptions: { speech: declareProviderOptions(mistralProviderOptions.speech, support, {}) }
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
function createEmbeddingModelEntry(defaultDimensions, customDimensions) {
|
|
478
|
+
return {
|
|
479
|
+
capabilities: { embedding: {
|
|
480
|
+
defaultDimensions,
|
|
481
|
+
customDimensions
|
|
482
|
+
} },
|
|
483
|
+
providerOptions: { embedding: declareProviderOptions(mistralProviderOptions.embedding, true, {
|
|
484
|
+
outputDimension: customDimensions,
|
|
485
|
+
outputDtype: customDimensions
|
|
486
|
+
}) }
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
const mistralModelCatalog = {
|
|
490
|
+
...Object.fromEntries(Object.entries(documentedLanguageModels).map(([modelId, image]) => [modelId, createLanguageModelEntry(modelId, image)])),
|
|
491
|
+
"voxtral-mini-transcribe-3-0": createTranscriptionModelEntry("voxtral-mini-transcribe-3-0", true),
|
|
492
|
+
"voxtral-small-transcribe-3-0": createTranscriptionModelEntry("voxtral-small-transcribe-3-0", true),
|
|
493
|
+
"voxtral-mini-latest": createTranscriptionModelEntry("voxtral-mini-latest", true),
|
|
494
|
+
"voxtral-mini-tts-3-0": createSpeechModelEntry(true),
|
|
495
|
+
"voxtral-mini-tts-2603": createSpeechModelEntry(true),
|
|
496
|
+
"mistral-embed": createEmbeddingModelEntry(1024, false),
|
|
497
|
+
"codestral-embed": createEmbeddingModelEntry(1536, true)
|
|
498
|
+
};
|
|
499
|
+
function findModelEntry(modelId) {
|
|
500
|
+
return Object.prototype.hasOwnProperty.call(mistralModelCatalog, modelId) ? mistralModelCatalog[modelId] : void 0;
|
|
501
|
+
}
|
|
502
|
+
function getMistralLanguageModelEntry(modelId) {
|
|
503
|
+
const entry = findModelEntry(modelId);
|
|
504
|
+
return entry?.capabilities.language != null && entry.providerOptions?.language != null ? {
|
|
505
|
+
capabilities: { language: entry.capabilities.language },
|
|
506
|
+
providerOptions: { language: entry.providerOptions.language }
|
|
507
|
+
} : createLanguageModelEntry(modelId);
|
|
508
|
+
}
|
|
509
|
+
function getMistralTranscriptionModelEntry(modelId) {
|
|
510
|
+
const capabilities = findModelEntry(modelId)?.capabilities.transcription;
|
|
511
|
+
return capabilities != null ? { capabilities: { transcription: capabilities } } : createTranscriptionModelEntry(modelId, false);
|
|
512
|
+
}
|
|
513
|
+
function getMistralSpeechModelEntry(modelId) {
|
|
514
|
+
const capabilities = findModelEntry(modelId)?.capabilities.speech;
|
|
515
|
+
return capabilities != null ? { capabilities: { speech: capabilities } } : createSpeechModelEntry(false);
|
|
516
|
+
}
|
|
517
|
+
function declareProviderOptions(definitions, support, exceptions) {
|
|
518
|
+
return Object.fromEntries(Object.keys(definitions).map((option) => [option, exceptions[option] ?? support]));
|
|
519
|
+
}
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/mistral-chat-language-model.ts
|
|
318
522
|
var MistralChatLanguageModel = class MistralChatLanguageModel {
|
|
319
523
|
static [WORKFLOW_SERIALIZE](model) {
|
|
320
524
|
return serializeModelOptions({
|
|
@@ -346,24 +550,15 @@ var MistralChatLanguageModel = class MistralChatLanguageModel {
|
|
|
346
550
|
type: "unsupported",
|
|
347
551
|
feature: "topK"
|
|
348
552
|
});
|
|
349
|
-
const
|
|
553
|
+
const { reasoning: reasoningCapabilities } = getMistralLanguageModelEntry(this.modelId).capabilities.language;
|
|
350
554
|
let resolvedReasoningEffort;
|
|
351
|
-
if (
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
high: "high",
|
|
359
|
-
max: "max"
|
|
360
|
-
} : {
|
|
361
|
-
none: "none",
|
|
362
|
-
high: "high"
|
|
363
|
-
},
|
|
364
|
-
warnings
|
|
365
|
-
});
|
|
366
|
-
} else if (isCustomReasoning(reasoning)) warnings.push({
|
|
555
|
+
if (reasoningCapabilities.support) resolvedReasoningEffort = mapReasoningToProviderEffort({
|
|
556
|
+
reasoning,
|
|
557
|
+
providerOptionsEffort: options.reasoningEffort,
|
|
558
|
+
effortMap: Object.fromEntries(reasoningCapabilities.efforts.map((effort) => [effort, effort])),
|
|
559
|
+
warnings
|
|
560
|
+
});
|
|
561
|
+
else if (isCustomReasoning(reasoning)) warnings.push({
|
|
367
562
|
type: "unsupported",
|
|
368
563
|
feature: "reasoning",
|
|
369
564
|
details: "This model does not support reasoning configuration."
|
|
@@ -711,7 +906,7 @@ function convertToMistralConversationInputs(prompt, toolNameMapping) {
|
|
|
711
906
|
inputs.push({
|
|
712
907
|
type: "function.result",
|
|
713
908
|
tool_call_id: part.toolCallId,
|
|
714
|
-
result: typeof result === "string" ? result :
|
|
909
|
+
result: typeof result === "string" ? result : stringifyWithBigIntAndCycles(result)
|
|
715
910
|
});
|
|
716
911
|
return;
|
|
717
912
|
}
|
|
@@ -776,14 +971,14 @@ function convertToMistralConversationInputs(prompt, toolNameMapping) {
|
|
|
776
971
|
type: "function.call",
|
|
777
972
|
tool_call_id: part.toolCallId,
|
|
778
973
|
name: typeof name === "string" ? name : toolNameMapping.toProviderToolName(part.toolName),
|
|
779
|
-
arguments: typeof args?.arguments === "string" ? args.arguments :
|
|
974
|
+
arguments: typeof args?.arguments === "string" ? args.arguments : serializeMistralToolCallArguments(part.input)
|
|
780
975
|
});
|
|
781
976
|
executions.add(part.toolCallId);
|
|
782
977
|
} else inputs.push({
|
|
783
978
|
type: "function.call",
|
|
784
979
|
tool_call_id: part.toolCallId,
|
|
785
980
|
name: part.toolName,
|
|
786
|
-
arguments:
|
|
981
|
+
arguments: serializeMistralToolCallArguments(part.input)
|
|
787
982
|
});
|
|
788
983
|
break;
|
|
789
984
|
case "tool-result":
|
|
@@ -875,27 +1070,6 @@ function prepareConversationTools({ tools, toolChoice }) {
|
|
|
875
1070
|
}
|
|
876
1071
|
//#endregion
|
|
877
1072
|
//#region src/mistral-conversation-language-model.ts
|
|
878
|
-
const reasoningEffortModelIds = /* @__PURE__ */ new Set([
|
|
879
|
-
"glm-5-2",
|
|
880
|
-
"labs-leanstral-1-5",
|
|
881
|
-
"labs-leanstral-1-5-1",
|
|
882
|
-
"magistral-medium-latest",
|
|
883
|
-
"magistral-small-latest",
|
|
884
|
-
"mistral-large-4",
|
|
885
|
-
"mistral-large-4-0",
|
|
886
|
-
"mistral-medium",
|
|
887
|
-
"mistral-medium-2604",
|
|
888
|
-
"mistral-medium-3",
|
|
889
|
-
"mistral-medium-3-5",
|
|
890
|
-
"mistral-medium-3.5",
|
|
891
|
-
"mistral-medium-latest",
|
|
892
|
-
"mistral-small-2603",
|
|
893
|
-
"mistral-small-latest",
|
|
894
|
-
"mistral-vibe-cli-fast",
|
|
895
|
-
"mistral-vibe-cli-latest",
|
|
896
|
-
"mistral-vibe-cli-with-tools",
|
|
897
|
-
"zai-glm-5-2"
|
|
898
|
-
]);
|
|
899
1073
|
var MistralConversationLanguageModel = class MistralConversationLanguageModel {
|
|
900
1074
|
static [WORKFLOW_SERIALIZE](model) {
|
|
901
1075
|
return serializeModelOptions({
|
|
@@ -927,15 +1101,12 @@ var MistralConversationLanguageModel = class MistralConversationLanguageModel {
|
|
|
927
1101
|
type: "unsupported",
|
|
928
1102
|
feature: "topK"
|
|
929
1103
|
});
|
|
930
|
-
const
|
|
1104
|
+
const { reasoning: reasoningCapabilities } = getMistralLanguageModelEntry(this.modelId).capabilities.language.endpoints.conversation;
|
|
931
1105
|
let resolvedReasoningEffort;
|
|
932
|
-
if (
|
|
1106
|
+
if (reasoningCapabilities.support) resolvedReasoningEffort = mapReasoningToProviderEffort({
|
|
933
1107
|
reasoning,
|
|
934
1108
|
providerOptionsEffort: options.reasoningEffort,
|
|
935
|
-
effortMap:
|
|
936
|
-
none: "none",
|
|
937
|
-
high: "high"
|
|
938
|
-
},
|
|
1109
|
+
effortMap: Object.fromEntries(reasoningCapabilities.efforts.map((effort) => [effort, effort])),
|
|
939
1110
|
warnings
|
|
940
1111
|
});
|
|
941
1112
|
else if (isCustomReasoning(reasoning)) warnings.push({
|
|
@@ -1532,20 +1703,15 @@ var MistralSpeechModel = class MistralSpeechModel {
|
|
|
1532
1703
|
providerOptions,
|
|
1533
1704
|
schema: mistralSpeechModelOptions
|
|
1534
1705
|
});
|
|
1706
|
+
const { speech } = getMistralSpeechModelEntry(this.modelId).capabilities;
|
|
1535
1707
|
let responseFormat = "mp3";
|
|
1536
|
-
if (
|
|
1537
|
-
"pcm",
|
|
1538
|
-
"wav",
|
|
1539
|
-
"mp3",
|
|
1540
|
-
"flac",
|
|
1541
|
-
"opus"
|
|
1542
|
-
].includes(outputFormat)) responseFormat = outputFormat;
|
|
1708
|
+
if (speech.outputFormats.includes(outputFormat)) responseFormat = outputFormat;
|
|
1543
1709
|
else warnings.push({
|
|
1544
1710
|
type: "unsupported",
|
|
1545
1711
|
feature: "outputFormat",
|
|
1546
1712
|
details: `Unsupported output format: ${outputFormat}. Using mp3 instead.`
|
|
1547
1713
|
});
|
|
1548
|
-
if (instructions != null) warnings.push({
|
|
1714
|
+
if (speech.instructions === false && instructions != null) warnings.push({
|
|
1549
1715
|
type: "unsupported",
|
|
1550
1716
|
feature: "instructions",
|
|
1551
1717
|
details: "Mistral speech models do not support the `instructions` option. Use a reference audio clip to guide delivery."
|
|
@@ -1672,11 +1838,7 @@ var MistralTranscriptionModel = class MistralTranscriptionModel {
|
|
|
1672
1838
|
providerOptions,
|
|
1673
1839
|
schema: mistralTranscriptionModelOptions
|
|
1674
1840
|
});
|
|
1675
|
-
if (
|
|
1676
|
-
"voxtral-mini-2507",
|
|
1677
|
-
"voxtral-mini-2602",
|
|
1678
|
-
"voxtral-mini-latest"
|
|
1679
|
-
].includes(this.modelId) && mistralOptions?.language != null && mistralOptions.timestampGranularities != null) throw new InvalidArgumentError({
|
|
1841
|
+
if (!getMistralTranscriptionModelEntry(this.modelId).capabilities.transcription.languageWithTimestamps && mistralOptions?.language != null && mistralOptions.timestampGranularities != null) throw new InvalidArgumentError({
|
|
1680
1842
|
argument: "providerOptions",
|
|
1681
1843
|
message: "providerOptions.mistral.language cannot be combined with providerOptions.mistral.timestampGranularities"
|
|
1682
1844
|
});
|
|
@@ -1782,7 +1944,7 @@ const mistralTranscriptionResponseSchema = lazySchema(() => zodSchema(z.object({
|
|
|
1782
1944
|
})));
|
|
1783
1945
|
//#endregion
|
|
1784
1946
|
//#region src/version.ts
|
|
1785
|
-
const VERSION = "4.0.
|
|
1947
|
+
const VERSION = "4.0.78";
|
|
1786
1948
|
//#endregion
|
|
1787
1949
|
//#region src/tool/web-search.ts
|
|
1788
1950
|
const inputSchema = lazySchema(() => zodSchema(z.object({ arguments: z.string() })));
|