Mistral Wrapper
Wrap your Mistral client to automatically trace every chat.complete() call.
Installation
pip install twosignal[mistral]Usage
from twosignal import TwoSignal
from twosignal.wrappers.mistral import wrap_mistral
from mistralai import Mistral
ts = TwoSignal()
client = wrap_mistral(Mistral(api_key="your-key"))
response = client.chat.complete(
model="mistral-large-latest",
messages=[{"role": "user", "content": "Hello"}],
)What Gets Captured
| Field | Description |
|---|---|
model | Model name (e.g., mistral-large-latest) |
input | Input messages array |
output | Response content |
usage.prompt_tokens | Input token count |
usage.completion_tokens | Output token count |
cost | Estimated cost in USD |
Async
Both chat.complete and chat.complete_async are wrapped automatically.