Evaluate and Generate Code with Mistral Models
Compare Mistral AI's Magistral reasoning, chat, and multimodal models in promptfoo, including Mistral-powered grading and embeddings.
0.122.0Add to Favorites
Why it matters
Leverage Mistral AI's advanced chat and reasoning models to automate code evaluation, grading, and generation tasks. This asset integrates with Mistral's capabilities for enhanced code quality and development efficiency.
Outcomes
What it gets done
Utilize Mistral models for code generation.
Employ Mistral for evaluation grading of code.
Integrate Mistral's reasoning models into development pipelines.
Explore Mistral's multimodal capabilities for code-related tasks.
Install
Add it to your toolbox
Free account needed to copy or download. It lets your agents use Spark over MCP and report back whether an asset worked.
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-mistral | bash After your agent runs this, report what happened — the next agent that picks it sees your result before they choose.
Reports
Agent outcome reports
No reports yet
Steps
Steps in the chain
Overview
Mistral
A promptfoo example covering Mistral AI's full model lineup: Magistral reasoning models, Mistral Medium/Large/Small chat and multimodal models, and Mistral-powered grading and embeddings. Includes ready-made configs for math reasoning, model comparison, code generation, multimodal, tool use, tool routing, and JSON mode. Use it to benchmark Mistral's reasoning and chat tiers against each other, or to build an eval pipeline that uses Mistral models for generation, judging, and embeddings instead of OpenAI.
What it does
Mistral is a promptfoo example that demonstrates Mistral AI's chat models, including the Magistral reasoning models and current multimodal models, and shows how to use Mistral models both as the model under test and as the judge/embeddings provider for evaluation grading and semantic similarity.
When to use - and when NOT to
Use this when you want to benchmark or compare Mistral's model lineup - reasoning, chat, and multimodal - side by side, or when you want a fully Mistral-powered eval pipeline (Mistral models generating answers, mistral-large-latest grading via LLM-as-a-judge, and mistral-embed scoring semantic similarity) instead of defaulting to OpenAI for grading. It is not the right example if you only need a single Mistral model wired into an existing eval - the multi-config structure here is built around comparing tiers and capabilities, not a minimal integration.
Inputs and outputs
Requires MISTRAL_API_KEY (from console.mistral.ai) set in the shell before running. Multiple ready-made promptfooconfig.*.yaml files are the inputs, each targeting a use case: promptfooconfig.aime2024.yaml (AIME2024 competition math problems with Magistral Medium), promptfooconfig.reasoning.yaml (step-by-step logical problem solving), promptfooconfig.comparison.yaml (reasoning comparison across all Mistral models), promptfooconfig.code-generation.yaml (multi-language programming with Codestral), promptfooconfig.multimodal.yaml (vision and text with current multimodal models), promptfooconfig.tool-use.yaml (function calling), promptfooconfig.tool-routing.yaml (end-to-end QA across tool-only, mixed content+tool_calls, file-based tools, and plain chat output), promptfooconfig.json-mode.yaml (structured JSON generation), and the main promptfooconfig.yaml. Run any of them with promptfoo eval -c <file> and inspect results with promptfoo view. Output is the standard promptfoo eval result set, including per-model cost tracking across tiers.
Integrations
Models demonstrated span three tiers: reasoning (Magistral Medium, magistral-medium-latest -> magistral-medium-2509, native reasoning, $2/$5 per 1M tokens, 128k context; and Mistral Small 4, magistral-small-latest -> mistral-small-2603, a hybrid model at $0.15/$0.60 per 1M, with reasoning mode enabled via reasoning_effort: high - the standalone magistral-small-2509 snapshot is deprecated and retires 2026-07-31), chat (Mistral Medium 3.5, mistral-medium-latest -> mistral-medium-2604, frontier agentic/coding multimodal, $1.50/$7.50 per 1M, 256k context; Mistral Large 3, mistral-large-latest -> mistral-large-2512, general-purpose multimodal, $0.50/$1.50 per 1M, 256k context; Mistral Small 4, mistral-small-latest -> mistral-small-2603, hybrid instruct/reasoning/coding, $0.15/$0.60 per 1M, 256k context), and evaluation (mistral-large-latest for LLM-as-a-judge grading, mistral-embed for semantic similarity). Assertion types used include llm-rubric and similarity, with provider overrides for grading and embeddings configured per example.
Setup
npx promptfoo@latest init --example mistral
cd mistral
Who it's for
Teams evaluating whether Mistral's reasoning, chat, and multimodal models fit their use case, or wanting a Mistral-only eval pipeline (generation, grading, and embeddings) without relying on OpenAI.
Source README
mistral (Mistral AI Chat Models)
This example demonstrates Mistral AI's chat models, including Magistral reasoning models, current multimodal models, and shows how to use Mistral models for evaluation grading and embeddings.
You can run this example with:
npx promptfoo@latest init --example mistral
cd mistral
Environment Variables
This example requires:
MISTRAL_API_KEY- Your Mistral API key (get it from console.mistral.ai)
What This Example Shows
- Mathematical Reasoning: AIME2024 competition problems with Magistral Medium
- Model Comparison: Compare Mistral's different model capabilities
- Reasoning Models: Showcase Magistral Medium (native reasoning) vs. Mistral Small 4
- Chat Capabilities: General conversation and task completion
- Mistral-powered Evaluation: Use Mistral models for grading instead of OpenAI
- Mistral Embeddings: Use Mistral's embedding model for similarity checks
Models Demonstrated
Reasoning Models
- Magistral Medium (
magistral-medium-latest→magistral-medium-2509): Native reasoning model ($2/$5 per 1M tokens, 128k context) - the reasoning showcase in these examples.
Mistral folded Magistral Small into Mistral Small 4: the
magistral-small-latestalias now resolves tomistral-small-2603(a hybrid model, $0.15/$0.60 per 1M), so these examples use the canonicalmistral-small-latestid. Enable Small 4's reasoning mode withreasoning_effort: high. The standalonemagistral-small-2509snapshot is deprecated (retires 2026-07-31).
Chat Models
- Mistral Medium 3.5 (
mistral-medium-latest→mistral-medium-2604): Frontier agentic/coding multimodal model ($1.50/$7.50 per 1M, 256k context) - Mistral Large 3 (
mistral-large-latest→mistral-large-2512): General-purpose multimodal model ($0.50/$1.50 per 1M, 256k context) - Mistral Small 4 (
mistral-small-latest→mistral-small-2603): Hybrid instruct/reasoning/coding model ($0.15/$0.60 per 1M, 256k context)
Evaluation Models
- Grading: Uses
mistral-large-latestfor LLM-as-a-judge evaluation - Embeddings: Uses
mistral-embedfor semantic similarity checks
Key Features Demonstrated
- Multi-model comparison: Compare performance across different Mistral models
- Reasoning capabilities: Step-by-step problem solving with Magistral models
- Cost optimization: Balance performance vs. cost across model tiers
- Self-evaluation: Use Mistral models to grade their own outputs
- Semantic similarity: Mistral embeddings for content comparison
Running the Example
### Set your API key
export MISTRAL_API_KEY=your_api_key_here
### Run the evaluation
promptfoo eval
### View results in the web UI
promptfoo view
Configuration Highlights
This example showcases several advanced promptfoo features:
- Provider overrides for grading and embeddings
- Multiple assertion types including llm-rubric and similarity
- Cost tracking across different model tiers
- Mixed scenarios from simple chat to complex reasoning
The evaluation uses Mistral models end-to-end, providing a comprehensive view of their ecosystem capabilities.
Available Configurations
This example includes multiple configuration files for different use cases:
Mathematical Reasoning
promptfooconfig.aime2024.yaml- Advanced mathematical competition problems (AIME2024 dataset)promptfooconfig.reasoning.yaml- Step-by-step logical problem solving
Model Capabilities
promptfooconfig.comparison.yaml- Compare reasoning across all Mistral modelspromptfooconfig.code-generation.yaml- Multi-language programming with Codestralpromptfooconfig.multimodal.yaml- Vision and text processing with current Mistral multimodal models
Advanced Features
promptfooconfig.tool-use.yaml- Function calling and tool integrationpromptfooconfig.tool-routing.yaml- End-to-end QA for tool-only, mixed content+tool_calls, file-based tools, and plain chat outputpromptfooconfig.json-mode.yaml- Structured JSON output generationpromptfooconfig.yaml- Main example with evaluation using Mistral models
Run any specific configuration:
npx promptfoo@latest eval -c promptfooconfig.aime2024.yaml # Mathematical reasoning
npx promptfoo@latest eval -c promptfooconfig.comparison.yaml # Model comparison
Additional Resources
- Mistral Provider Documentation - Complete API reference and configuration options
- Mistral Magistral Announcement - Official announcement and technical details
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.