new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

mistral/capabilities

14 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Mistral document OCR support

Mistral chat models support document OCR for PDF files. You can optionally set image and page limits using the documentImageLimit and documentPageLimit provider options.

Mistral configurable reasoning

Some Mistral models support configurable reasoning via the top-level `reasoning` setting with values 'high' and 'none'. This controls the reasoning effort level during generation.

Mistral structured outputs example

Example using Mistral language models for structured outputs: import { mistral } from '@ai-sdk/mistral'; import { generateText, Output } from 'ai'; import { z } from 'zod'; const result = await generateText({ model: mistral('mistral-large-latest'), output: Output.object({ schema: z.object({ recipe: z.object({ name: z.string(), ingredients: z.array(z.string()), instructions: z.array(z.string()), }), }), }), prompt: 'Generate a simple pasta recipe.', }); console.log(JSON.stringify(result.output, null, 2));

Mistral generateSpeech example

Example using Mistral speech models: import { mistral } from '@ai-sdk/mistral'; import { generateSpeech } from 'ai'; const result = await generateSpeech({ model: mistral.speech('voxtral-mini-tts-2603'), text: 'Hello from the AI SDK!', voice: 'en_paul_neutral', outputFormat: 'mp3', }); const audio = result.audio.uint8Array;

Mistral generateSpeech voice cloning example

Example using Mistral speech models with voice cloning: import { readFile } from 'node:fs/promises'; import { mistral, type MistralSpeechModelOptions } from '@ai-sdk/mistral'; import { generateSpeech } from 'ai'; const referenceAudio = await readFile('./reference.mp3'); const result = await generateSpeech({ model: mistral.speech('voxtral-mini-tts-2603'), text: 'Hello from the AI SDK!', providerOptions: { mistral: { refAudio: referenceAudio.toString('base64'), } satisfies MistralSpeechModelOptions, }, });

Mistral embed example

Example using Mistral embedding models: import { mistral } from '@ai-sdk/mistral'; import { embed } from 'ai'; const { embedding } = await embed({ model: mistral.embedding('codestral-embed-2505'), value: 'function add(a: number, b: number) { return a + b; }', });

Mistral transcription result metadata

The normalized Mistral transcription result includes transcript text, language, timed segments, and duration. Mistral token and prompt-audio usage is available under result.providerMetadata.mistral.usage. Segment scores and speaker IDs from diarization are available under result.providerMetadata.mistral.segments.

Mistral speech model voice cloning

Mistral speech models support one-off voice cloning with base64-encoded reference audio passed through `providerOptions.mistral.refAudio` using `MistralSpeechModelOptions`. When refAudio is provided, it takes precedence over the voice parameter. Reference audio is redacted from request metadata and API call errors.

Mistral speech model output formats

Mistral speech models support mp3, wav, pcm, flac, and opus output formats, with mp3 as the default. The instructions, speed, and language settings are not supported and produce warnings when provided.

Mistral generateText example

Example using Mistral language models with generateText: import { mistral } from '@ai-sdk/mistral'; import { generateText } from 'ai'; const { text } = await generateText({ model: mistral('mistral-large-latest'), prompt: 'Write a vegetarian lasagna recipe for 4 people.', });

Mistral transcription example

Example using Mistral transcription models: import { mistral, type MistralTranscriptionModelOptions } from '@ai-sdk/mistral'; import { transcribe } from 'ai'; import { readFile } from 'node:fs/promises'; const result = await transcribe({ model: mistral.transcription('voxtral-mini-latest'), audio: await readFile('audio.mp3'), providerOptions: { mistral: { timestampGranularities: ['segment'], diarize: true, contextBias: ['Vercel', 'AI_SDK'], } satisfies MistralTranscriptionModelOptions, }, });

Mistral embed with provider options example

Example using Mistral embedding models with provider options: import { mistral, type MistralEmbeddingModelOptions } from '@ai-sdk/mistral'; import { embed } from 'ai'; const { embedding } = await embed({ model: mistral.embedding('mistral-embed'), value: 'sunny day at the beach', providerOptions: { mistral: { metadata: { source: 'knowledge-base' }, outputDimension: 1024, outputDtype: 'float', } satisfies MistralEmbeddingModelOptions, }, });

Mistral configurable reasoning example

Example using configurable reasoning with Mistral models: import { mistral } from '@ai-sdk/mistral'; import { generateText } from 'ai'; const result = await generateText({ model: mistral('mistral-small-latest'), reasoning: 'high', prompt: 'What is 15 * 24?', }); console.log('REASONING:', result.reasoningText); console.log('ANSWER:', result.text);

Mistral document OCR example

Example using Mistral document OCR: import { mistral, type MistralLanguageModelChatOptions } from '@ai-sdk/mistral'; import { generateText } from 'ai'; const result = await generateText({ model: mistral('mistral-small-latest'), messages: [{ role: 'user', content: [{ type: 'text', text: 'What is an embedding model according to this document?' }, { type: 'file', data: new URL('https://github.com/vercel/ai/blob/main/examples/ai-functions/data/ai.pdf?raw=true'), mediaType: 'application/pdf', }], }], providerOptions: { mistral: { documentImageLimit: 8, documentPageLimit: 64, } satisfies MistralLanguageModelChatOptions, }, });

Give your agent this brain