Skip to main content

Respan instrumentation plugin for Mistral AI

Project description

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.

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.

Project details


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.0.tar.gz (3.3 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.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_mistralai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 640d6be3cbcd33468c5f586d523f0c0b458c8ce654fe069c933f68a76726eb14
MD5 5c63236a05dc53594d5a6833f4706a57
BLAKE2b-256 61fb139a9a3a718afa456113db62f984ecbb27deb05f2fc7c3fa3648879643db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for respan_instrumentation_mistralai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12f3560e2134e51cc2eb5cc22d04f465d90f18f58ecbb244e14c38b04b128883
MD5 cec7d3e32caa02ef8a8f94634d2a89d8
BLAKE2b-256 e86dc1a32a773617c63c5a5acb4e0148363a15e78a383ddad9f849395a16a685

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page