Setup

  1. Install Langtrace’s SDK and initialize the SDK in your code.

Note: You’ll need API keys from Langtrace and MistralAI. Sign up for Langtrace and/or MistralAI if you haven’t done so already.

Python
# Install the SDK
pip install -U langtrace-python-sdk mistralai
  1. Setup environment variables:
Shell
export LANGTRACE_API_KEY=YOUR_LANGTRACE_API_KEY
export MISTRAL_API_KEY=YOUR_MISTRAL_API_KEY

Usage

Generate a simple output with your deployment’s model:

You can now view and analyze your traces on the Langtrace dashboard. Here’s what you can expect:

  1. View all your Mistral AI traces in the main traces view:

  2. Dive deep into conversation details and responses:

  3. Analyze span timing and relationships in the trace visualization:

Want to see more supported methods? Check out the sample code in the Langtrace Mistral Python Example repository.