Skip to main content
Article·mistral.ai
llmautomationmachine-learningprompt-engineeringai-agents

Mistral Large 2

Mistral Large 2 is a new flagship LLM with advanced multilingual and strong coding capabilities. It enables practitioners to streamline development, generate code, and build sophisticated AI solutions across diverse linguistic contexts.

beginner15 min5 steps
The play
  1. Obtain Mistral AI API Key
    Sign up on the Mistral AI platform and generate an API key. This key is essential for programmatically accessing the Mistral Large 2 model.
  2. Install Mistral AI Client Library
    Open your terminal or command prompt and install the official Python client library using pip. This library simplifies interaction with the Mistral API.
  3. Initialize Client and Send First Prompt
    Use your API key to initialize the Mistral client and send a basic text generation request. Replace 'YOUR_MISTRAL_API_KEY' with your actual key and 'mistral-large-2402' with the correct model identifier.
  4. Test Multilingual Capabilities
    Modify your prompt to generate content in a non-English language to observe Mistral Large 2's multilingual proficiency.
  5. Generate Code Snippets
    Provide a prompt requesting a code snippet (e.g., a Python function) to evaluate the model's coding generation abilities.
Starter code
from mistralai.client import MistralClient
from mistralai.models.chat_completion import ChatMessage

api_key = "YOUR_MISTRAL_API_KEY" # Replace with your actual API key
client = MistralClient(api_key=api_key)

chat_response = client.chat(
    model="mistral-large-2402", # Use the correct model identifier
    messages=[ChatMessage(role="user", content="What is the capital of France?")]
)

print(chat_response.choices[0].message.content)
Source
Mistral Large 2 — Action Pack