Metadata-Version: 2.4
Name: respan-instrumentation-mistralai
Version: 0.1.0
Summary: Respan instrumentation plugin for Mistral AI
License: Apache 2.0
Author: Respan
Author-email: team@respan.ai
Requires-Python: >=3.11,<3.14
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: mistralai (>=2.0.0)
Requires-Dist: openinference-instrumentation-mistralai (>=2.0.0)
Requires-Dist: opentelemetry-semantic-conventions-ai (>=0.4.1)
Requires-Dist: respan-instrumentation-openinference (>=1.2.2)
Requires-Dist: respan-sdk (>=2.6.1)
Requires-Dist: respan-tracing (>=2.17.0,<3.0.0)
Description-Content-Type: text/markdown

# 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

```bash
pip install respan-ai respan-instrumentation-mistralai mistralai
```

## Usage

```python
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.

