Skip to main content

Overview

Mistral AI provides powerful open-source and proprietary models including Mistral Large, Mixtral, and specialized coding models.

Installation

Basic Usage

Constructor Options

string
required
Mistral model name
string
Mistral API key (defaults to MISTRAL_API_KEY env variable)
number
Sampling temperature
number
Maximum tokens in response
number
default:1
Nucleus sampling

Supported Models

Proprietary Models

  • mistral-large-latest: Most capable model
  • mistral-medium-latest: Balanced performance
  • mistral-small-latest: Fast and efficient

Open Models

  • open-mixtral-8x7b: Mixtral 8x7B MoE
  • open-mixtral-8x22b: Mixtral 8x22B MoE
  • open-mistral-7b: Mistral 7B
  • open-mistral-nemo: Mistral Nemo 12B

Specialized Models

  • codestral-latest: Code generation
  • mistral-embed: Embeddings

Streaming

Function Calling

Codestral

Specialized model for code generation:

Mistral Embeddings

Configuration

Environment Variables

Get API key: Mistral AI Console

Global Settings

With LlamaIndex

Model Selection Guide

Best Practices

  1. Use appropriate model: Balance cost, speed, and capability
  2. Leverage Codestral: Best-in-class code generation
  3. Monitor API usage: Track costs in console
  4. Stream responses: Better UX for long outputs
  5. Use function calling: Reliable tool integration

See Also