{"id":45698,"library":"openinference-instrumentation-mistralai","title":"OpenInference Mistral AI Instrumentation","description":"OpenInference instrumentor for Mistral AI Python SDK. Automatically traces Mistral AI calls (chat completions, embeddings, etc.) and exports spans in OpenInference format for observability with Arize AI, Phoenix, and other OpenTelemetry backends. Current version: 2.0.4. Requires Python >=3.9,<3.15. Release cadence: irregular, bundled with OpenInference monorepo.","status":"active","version":"2.0.4","language":"python","source_language":"en","source_url":"https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-mistralai","tags":["openinference","mistralai","observability","opentelemetry","tracing"],"install":[{"cmd":"pip install openinference-instrumentation-mistralai","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Base instrumentation utilities and OpenInference semantic conventions","package":"openinference-instrumentation","optional":false},{"reason":"Instrumented SDK; must be installed (usually pip install mistralai)","package":"mistralai","optional":false},{"reason":"OpenTelemetry API for span creation","package":"opentelemetry-api","optional":true}],"imports":[{"wrong":"from openinference_instrumentation_mistralai import MistralAIInstrumentor","symbol":"MistralAIInstrumentor","correct":"from openinference.instrumentation.mistralai import MistralAIInstrumentor"}],"quickstart":{"code":"import os\nfrom opentelemetry import trace\nfrom opentelemetry.sdk.trace import TracerProvider\nfrom opentelemetry.sdk.trace.export import SimpleSpanProcessor\nfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter\nfrom openinference_instrumentation_mistralai import MistralAIInstrumentor\n\n# Set up OpenTelemetry (example with OTLP HTTP exporter)\nprovider = TracerProvider()\nprovider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint=\"https://api.arize.com/v1/traces\")))\ntrace.set_tracer_provider(provider)\n\n# Instrument MistralAI\nMistralAIInstrumentor().instrument()\n\n# Now use MistralAI as usual\nfrom mistralai import Mistral\nclient = Mistral(api_key=os.environ.get(\"MISTRAL_API_KEY\", \"\"))\nresponse = client.chat.complete(model=\"mistral-small-latest\", messages=[{\"role\": \"user\", \"content\": \"Hello\"}])\nprint(response.choices[0].message.content)","lang":"python","description":"Basic setup with OTLP exporter. Replace endpoint with your observability backend."},"warnings":[{"fix":"Update import to: from openinference_instrumentation_mistralai import MistralAIInstrumentor","message":"Import path changed in v2.0: use underscore pattern (openinference_instrumentation_mistralai) instead of dotted path (openinference.instrumentation.mistralai). Old imports will fail with ModuleNotFoundError.","severity":"breaking","affected_versions":"<2.0"},{"fix":"Ensure MistralAIInstrumentor().instrument() is called before any import of mistralai, or at least before creating a client.","message":"Instrumentation only works if MistralAI SDK is imported AFTER calling instrument(). If you import mistralai before instrument(), no spans will be captured.","severity":"gotcha","affected_versions":"all"},{"fix":"Pin opentelemetry-api >=1.0,<2.0 and opentelemetry-sdk >=1.0,<2.0.","message":"Version 2.x uses OpenTelemetry SDK 1.x. If your application uses a different version of opentelemetry-api/opentelemetry-sdk, you may encounter compatibility issues.","severity":"gotcha","affected_versions":">=2.0"},{"fix":"Upgrade to Python >=3.9.","message":"Support for Python 3.8 is deprecated; the package requires Python >=3.9. If you are still on Python 3.8, upgrade or pin to an older version (e.g., 1.x).","severity":"deprecated","affected_versions":">=2.0"}],"env_vars":null,"search_vec":"'2.0.4':39 '3.15':43 '3.9':42 'ai':3,9,15,31 'ariz':30 'automat':12 'backend':36 'bundl':47 'cadenc':45 'call':16 'chat':17 'complet':18 'current':37 'embed':19 'etc':20 'export':22 'format':26 'instrument':4 'instrumentor':6 'irregular':46 'mistral':2,8,14 'mistralai':52 'monorepo':50 'observ':28,53 'openinfer':1,5,25,49,51 'opentelemetri':35,54 'phoenix':32 'python':10,41 'releas':44 'requir':40 'sdk':11 'span':23 'trace':13,55 'version':38","created_at":"2026-06-07T12:56:17.072169+00:00","updated_at":"2026-06-07T12:56:17.072169+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-mistralai","github":"https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-mistralai","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}