Skip to content

feat(ocr): add Vertex DeepSeek adapter and remove legacy OCR pipeline - #40509

Merged
yujonglee-berri merged 11 commits into
litellm_vertex_mistral_ocrfrom
litellm_vertex_deepseek_ocr
Sep 11, 2026
Merged

yujonglee-berri merged 11 commits into
litellm_vertex_mistral_ocrfrom
litellm_vertex_deepseek_ocr

Conversation

@yujonglee-berri

@yujonglee-berri yujonglee-berri commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Restack validation

Rebased onto #40507 (f1324b6be6). Current tip: a0605654d6

The seven-PR stack is based on litellm_internal_staging at 8a4fae0e17 and includes the additional fallback tests from #40502

All seven PRs pass the type discipline gate against their immediate parents. Rust formatting, workspace Clippy, workspace tests, core tests with bedrock-auth, gateway tests with server, and full-stack make check passed

The latest targeted Python run passes 60 tests, with 4 native-extension cases skipped

@greptile-apps

greptile-apps Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR consolidates OCR execution into litellm-core, removes the legacy AI-gateway OCR pipeline, and adds Vertex-hosted DeepSeek OCR support.

  • Adds typed DeepSeek request and response codecs plus a Vertex adapter.
  • Centralizes provider selection, authentication, URL construction, request execution, and response handling in the core OCR route.
  • Rejects gateway callbacks and guardrails explicitly until they are wired into the new path.
  • Preserves request provenance for credentials transported separately from the proxy body.
  • Removes obsolete gateway provider handlers and their legacy lifecycle tests.

Confidence Score: 5/5

The current tip appears safe to merge; no actionable new regression remains after the passthrough and credential-provenance fixes.

The latest changes correctly preserve request provenance for separately transported credentials without disabling credential fallback, and all previous Greptile root threads were manually resolved.

Important Files Changed

Filename Overview
litellm-rust/crates/core/src/ocr/adapters/vertex/deepseek.rs Implements Vertex authentication, endpoint construction, model namespacing, and DeepSeek OCR transformations through the core adapter interface.
litellm-rust/crates/core/src/ocr/registry.rs Extends OCR adapter resolution for Vertex DeepSeek while retaining specialized provider routing.
litellm-rust/crates/core/src/ocr/prepare.rs Centralizes typed parameter preparation, guardrail body handling, and shared HTTP request construction.
litellm-rust/crates/ai-gateway/src/ocr/mod.rs Replaces the legacy gateway-owned pipeline with delegation to the core OCR client and explicit rejection of unsupported host hooks.
litellm/rust_bridge/ocr.py Preserves proxy credential provenance when marshaling OCR calls into Rust.
tests/test_litellm/ocr/test_rust_bridge.py Adds regression coverage for credential fields transported outside the proxy request body.

Reviews (6): Last reviewed commit: "fix(ocr): preserve DeepSeek credential p..." | Re-trigger Greptile

@codecov

codecov Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@CLAassistant

CLAassistant commented Sep 10, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@yujonglee-berri
yujonglee-berri removed this pull request from stack #40505 September 10, 2026 03:47
@yujonglee-berri
yujonglee-berri changed the base branch from litellm_deepseek_ocr_format to litellm_vertex_mistral_ocr September 10, 2026 03:48
@yujonglee-berri yujonglee-berri changed the title feat(vertex_ai): add DeepSeek OCR integration feat(ocr): add Vertex DeepSeek adapter Sep 10, 2026
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from ecd1435 to 845ab3f Compare September 10, 2026 03:52
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from 845ab3f to a3e3e11 Compare September 10, 2026 03:55
@codspeed

codspeed Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_vertex_deepseek_ocr (ea0b510) with litellm_vertex_mistral_ocr (6823d2e)

Open in CodSpeed

@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from ea0b510 to b468ec4 Compare September 10, 2026 05:04
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from b468ec4 to a1b48d1 Compare September 10, 2026 05:21
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from a1b48d1 to 14392bc Compare September 10, 2026 05:37
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from 14392bc to 4afd7ee Compare September 10, 2026 05:44
@yujonglee-berri
yujonglee-berri removed this pull request from stack #40536 September 10, 2026 05:45
@yujonglee-berri
yujonglee-berri removed this pull request from stack #40550 September 11, 2026 15:28
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from a060565 to 026fa18 Compare September 11, 2026 17:39
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from 026fa18 to 186d378 Compare September 11, 2026 18:04
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from 186d378 to fcfcdd9 Compare September 11, 2026 18:09
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from fcfcdd9 to a609a0d Compare September 11, 2026 18:24
@yujonglee-berri
yujonglee-berri force-pushed the litellm_vertex_deepseek_ocr branch from a609a0d to 985b28a Compare September 11, 2026 18:44
@yujonglee-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review the current tip after corrected stack ancestry, Azure imports, and successful workspace Clippy verification

@yujonglee-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review current tip after lower-stack security and provider-option fixes plus successful all-features workspace Clippy

@yujonglee-berri

Copy link
Copy Markdown
Contributor Author

@greptileai Please review current tip 8c488bc after all lower-stack security and passthrough fixes

async fn core_ocr(request: OcrRequest<'_>) -> Result<Value, Error> {
validate_host_hooks(&request)?;
let client = OcrClient::new(crate::client::http_client().clone())?;
let core_request = decode_request(OcrWireRequest {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: OCR download policy bypass

The removed path read MAX_IMAGE_URL_DOWNLOAD_SIZE_MB and treated zero as disabling remote-document downloads. This wire request carries no download policy, so decode_request substitutes the core's fixed 50 MiB limit; an authenticated caller can still force outbound downloads and large in-memory base64 conversion when the operator configured a lower limit or disabled fetching. Pass the resolved setting into the core request and enforce it through OcrConnection::max_download_bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants