The SDK automatically handles streaming responses and captures the complete output:
stream = client.chat_stream( model="mistral-large-latest", messages=[{"role": "user", "content": "Tell me a story"}])for chunk in stream: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="")
const stream = await mistral.chatStream({ model: "mistral-large-latest", messages: [{ role: "user", content: "Tell me a story" }]});for await (const chunk of stream) { if (chunk.choices[0]?.delta?.content) { process.stdout.write(chunk.choices[0].delta.content); }}
Embedding operations are also automatically instrumented:
embeddings = client.embeddings( model="mistral-embed", input=["The quick brown fox jumps over the lazy dog"])print(embeddings.data[0].embedding)
const embeddings = await mistral.embeddings({ model: "mistral-embed", input: ["The quick brown fox jumps over the lazy dog"]});console.log(embeddings.data[0].embedding);
Control which integrations are enabled using the instruments or blockInstruments configuration:
from netra import Netrafrom netra.instrumentation.instruments import InstrumentSet# Only enable Mistral instrumentationNetra.init( headers=f"x-api-key={os.environ.get('NETRA_API_KEY')}", instruments={InstrumentSet.MISTRALAI})# Or block specific instrumentationsNetra.init( headers=f"x-api-key={os.environ.get('NETRA_API_KEY')}", block_instruments={InstrumentSet.HTTPX})
import { Netra, NetraInstruments } from "netra-sdk";// Only enable Mistral instrumentationawait Netra.init({ headers: `x-api-key=${process.env.NETRA_API_KEY}`, instruments: new Set([NetraInstruments.MISTRALAI])});// Or block specific instrumentationsawait Netra.init({ headers: `x-api-key=${process.env.NETRA_API_KEY}`, blockInstruments: new Set([NetraInstruments.HTTP])});