Skip to main content

Respan Mistral AI instrumentation

Trace the official mistralai Python SDK with Respan.

This package wraps openinference-instrumentation-mistralai and registers Respan's OpenInference translator so Mistral AI spans are emitted with the canonical traceloop.*, gen_ai.*, llm.*, and respan.* fields expected by the Respan OTLP pipeline. It covers synchronous and asynchronous chat, streaming content and usage, request tool definitions, current-turn tool calls, precise provider error status, and interrupted-stream finalization. Duplicate native Mistral SDK spans are suppressed only for the SDK's own instrumentation scope. Tested dependency support starts at mistralai==2.9.3 and openinference-instrumentation-mistralai==2.0.6.

Install

pip install respan-ai respan-instrumentation-mistralai mistralai

Usage

import os

from mistralai.client import Mistral
from respan import Respan
from respan_instrumentation_mistralai import MistralAIInstrumentor

respan = Respan(
    api_key=os.environ["RESPAN_API_KEY"],
    instrumentations=[MistralAIInstrumentor()],
)

with Mistral(api_key=os.environ["MISTRAL_API_KEY"]) as client:
    response = client.chat.complete(
        model="mistral-large-latest",
        messages=[
            {
                "role": "user",
                "content": "Reply with one concise sentence about tracing.",
            }
        ],
    )
    print(response.choices[0].message.content)

respan.flush()
respan.shutdown()

Any keyword arguments passed to MistralAIInstrumentor(...) are forwarded to the underlying OpenInference instrumentor. Multiple Respan Mistral instrumentor instances share one OpenInference delegate and one normalization processor; the final owner deactivates them. Shared instances must use identical keyword arguments. An activation with different arguments is rejected and remains inactive rather than silently inheriting another instance's configuration.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_instrumentation_mistralai-0.1.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file respan_instrumentation_mistralai-0.1.1.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_mistralai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4b8099d1c0426cd57a317314f369eff38d57730058dea6147e3874e76a8373ac
MD5 604021955f14420a3627b4fc3fdbe752
BLAKE2b-256 a6d7ecec381957894548b12ff924961916d97f33d2200bde87e1d4f20334e61e

See more details on using hashes here.

File details

Details for the file respan_instrumentation_mistralai-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_mistralai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5cd71452d57b0f5d4d113d0bab85093e3aa599c252edbfff7e5cb34fc367500
MD5 fe1e24d0b1b6433fc66e2b7001bdb27e
BLAKE2b-256 c2a934ba8f7712e76fdd7a3c6f50fdb46e63902ac7b79d93b02fd8ee68592018

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page