Skip to content

[BOT ISSUE] Mistral: OCR API (client.ocr.process()) not instrumented #222

@braintrust-bot

Description

@braintrust-bot

Summary

The Mistral OCR API (POST /v1/ocr) is not instrumented. Calls to client.ocr.process() and client.ocr.process_async() produce zero Braintrust tracing. This is a documented, production API in the Mistral platform for extracting text and structured content from images and documents using vision models.

The Braintrust Mistral integration instruments chat completions, embeddings, FIM, and agents, but has no patchers for the OCR resource.

What is missing

Mistral Resource Method Instrumented?
client.chat complete(), stream() Yes
client.embeddings create() Yes
client.fim complete(), stream() Yes
client.agents complete(), stream() Yes
client.ocr process(), process_async() No

At minimum, instrumentation should create spans capturing:

  • Input: the document/image reference and any processing configuration
  • Output: the extracted text/structured content
  • Metrics: latency, token usage (if reported by the API)
  • Metadata: model, document type, page count

The OCR API is a generative vision execution surface — it uses Mistral vision models to understand and extract content from visual inputs. It is analogous to Google GenAI's models.generate_content() with document inputs, which IS instrumented in this repo.

Braintrust docs status

not_found — The Mistral integration page documents chat completions only. No mention of OCR API support.

Upstream sources

Local files inspected

  • py/src/braintrust/integrations/mistral/patchers.py — defines patchers for Chat, Embeddings, Fim, Agents; zero references to ocr or Ocr
  • py/src/braintrust/integrations/mistral/tracing.py — wrapper functions for chat, embeddings, FIM, agents only; no OCR wrapper
  • py/src/braintrust/integrations/mistral/integration.py — integration class registers 4 composite patchers (ChatPatcher, EmbeddingsPatcher, FimPatcher, AgentsPatcher); no OcrPatcher
  • py/src/braintrust/integrations/mistral/test_mistral.py — no OCR test cases
  • py/noxfile.pytest_mistral session tests against LATEST and 1.12.4; no OCR coverage

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions