fix(ocr): add missing Mistral OCR params to allowlist#25858
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds four previously missing Mistral OCR API parameters — Confidence Score: 5/5Safe to merge — minimal, targeted allowlist addition with comprehensive mock tests and no side-effects on other code paths. All changes are a straightforward additive fix to a string list plus docstring updates. Tests cover all three pipeline stages (allowlist, mapping, request body), are fully local with no real API calls, and existing test assertions are unchanged in behavior (only Black-reformatted). No custom rules are violated. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/llms/mistral/ocr/transformation.py | Adds 4 missing params to get_supported_ocr_params() allowlist and updates the docstring; no logic changes elsewhere. |
| tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py | Adds three new test classes covering the full param pipeline (allowlist, mapping, request body); existing test only reformatted by Black with no behavioral change. |
Sequence Diagram
sequenceDiagram
participant Caller as litellm.ocr()
participant Pipeline as OCR Pipeline
participant Config as MistralOCRConfig
participant Mistral as Mistral API
Caller->>Pipeline: ocr(model, document, table_format="html", id="req-123", ...)
Pipeline->>Config: get_supported_ocr_params(model)
Config-->>Pipeline: ["pages", ..., "table_format", "confidence_scores_granularity", "document_annotation_prompt", "id"]
Note over Pipeline: kwargs filtered against allowlist
Pipeline->>Config: map_ocr_params(non_default_params, optional_params, model)
Config-->>Pipeline: {table_format: "html", id: "req-123", ...}
Pipeline->>Config: transform_ocr_request(model, document, optional_params, headers)
Config-->>Pipeline: OCRRequestData(data={model, document, table_format, id, ...})
Pipeline->>Mistral: POST /v1/ocr {model, document, table_format="html", id="req-123", ...}
Mistral-->>Pipeline: OCR response
Reviews (1): Last reviewed commit: "fix(ocr): add missing Mistral OCR params..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@michelligabriele — could you add a screenshot or short video showing that this change works as expected? The before/after text explanation is helpful, but a visual demo (e.g., showing the OCR params being passed through correctly) really helps reviewers verify the fix quickly. Thanks! |
cd92b04
into
BerriAI:litellm_internal_staging
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
CI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Screenshots / Proof of Fix
table_format,confidence_scores_granularity,document_annotation_prompt, andidare documented Mistral OCR API parameters that were missing fromMistralOCRConfig.get_supported_ocr_params(). Because the OCR pipeline uses this allowlist to filterkwargs, these params were silently dropped before reaching the Mistral API.Before: passing
table_format="html"tolitellm.ocr()→ param silently dropped, Mistral defaults to markdown tablesAfter: param passes through the allowlist → included in the request body → Mistral returns HTML tables as requested
Type
🐛 Bug Fix
Changes
MistralOCRConfig.get_supported_ocr_params():document_annotation_prompt,table_format,confidence_scores_granularity,id