feat(azure-ai): support Cohere Parse OCR - #39427
Conversation
|
PR #39427 labeled |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Greptile SummaryAdds Azure AI Cohere Parse OCR support, including model-aware adapter selection, provider request and response transforms, Python-path dispatch, model pricing metadata, and focused unit coverage Confidence Score: 5/5The PR appears safe to merge with no concrete correctness, security, or compatibility failures identified The adapter selection, provider wire translation, response normalization, Rust-path exclusion, metadata, and tests form a consistent Cohere Parse integration
|
| Filename | Overview |
|---|---|
| litellm/llms/azure_ai/ocr/cohere_parse_transformation.py | Implements Cohere Parse URL construction, input validation, request translation, and normalized page and usage responses |
| litellm/llms/azure_ai/ocr/common_utils.py | Selects the dedicated Cohere Parse adapter for the exact Azure catalog model |
| litellm/ocr/main.py | Bypasses the Mistral-only Rust OCR bridge for Cohere Parse requests |
| model_prices_and_context_window.json | Registers Cohere Parse OCR capabilities, limits, retirement date, and page pricing |
| tests/test_litellm/llms/azure_ai/test_cohere_parse_transformation.py | Covers routing, endpoint construction, authentication, validation, transformations, usage normalization, and metadata |
| tests/test_litellm/ocr/test_ocr_native_format.py | Verifies Cohere Parse requests remain on the compatible Python OCR path |
Reviews (1): Last reviewed commit: "feat(azure_ai): add Cohere Parse OCR sup..." | Re-trigger Greptile
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a developer cannot parse an image with an Azure Cohere Parse deployment
azure_ai/Cohere-parse-v5with an Azure endpointPOST https://litellm-domain/v1/ocrwith animage_urldata URIAfter: the same developer receives normalized OCR pages and billed-page usage
azure_ai/Cohere-parse-v5with an Azure endpointPOST https://litellm-domain/v1/ocrwith animage_urldata URIpagesandusage_info.pages_processedRelevant issues
Linear ticket
Sources
Validation notes
Cohere-parse-v5/v1/ocrrequest returned HTTP 200parse-v5.0returnedDeploymentNotFoundPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review)
Screenshots / Proof of Fix
The live requests used an image data URI because Parse currently accepts image input only
Before (4c51ca7)
After (10039d7)
POST https://<gateway>/v1/ocrused modelcohere-parse-v5and animage_urldata URIPOST https://<france-central-resource>/providers/cohere/v2/parseusedCohere-parse-v5POST https://<west-us-resource>.services.ai.azure.com/providers/cohere/v2/parseused the same payloadparse-v5.0returnedDeploymentNotFoundType
New Feature
Test
Caveats (if any)
Medium
Low
image_urlinputsdocument_urland PDF inputs fail before the provider callFinal Attestation