feat: add LiteLLM Rust workspace with Mistral OCR bridge - #31032
Closed
ishaan-berri wants to merge 1 commit into
Closed
feat: add LiteLLM Rust workspace with Mistral OCR bridge#31032ishaan-berri wants to merge 1 commit into
ishaan-berri wants to merge 1 commit into
Conversation
Contributor
Contributor
Author
Contributor
Author
|
Closing this codex-branch PR in favor of #31033 from litellm_hotfix_rust_mistral_ocr. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
litellm-rust/workspace with only the crates needed for the first bridge:core,providers, andpython-bridge.core/src/ocr/owns OCR shared types and theOcrProviderConfigtemplate trait.providers/src/mistral/ocr/transformation.rsmirrorslitellm/llms/mistral/ocr/transformation.py.providers/src/ocr.rsowns Rust-side OCR provider/operation dispatch.ocr(payload), and delegates OCR routing to Rust.litellm/rust_bridge/as the Python-side bridge package with an explicit OCR provider rollout enum and Python fallback behavior.litellm/ocr/main.pysmall: after normal provider resolution, it askslitellm.rust_bridge.ocrfor a Rust-backed config; disabled, unavailable, or unsupported Rust paths return the existing Python config unchanged.cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings, andcargo test --workspaceon Rust changes.Verification
uv run black litellm/rust_bridge litellm/ocr/main.py tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_rust_bridge.pyuv run ruff check litellm/rust_bridge litellm/ocr/main.py tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_rust_bridge.pyuv run pytest tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_transformation.py tests/test_litellm/llms/mistral/ocr/test_mistral_ocr_rust_bridge.py -qcd litellm-rust && cargo fmt --checkcd litellm-rust && cargo clippy --workspace --all-targets -- -D warningscd litellm-rust && cargo test --workspaceScope
This PR keeps the rollout narrow: Mistral OCR only, route-level Python hook, Python fallback for every disabled/unavailable Rust path. Future OCR providers should add
providers/src/<provider>/ocr/transformation.rsand register the provider in the Rust OCR dispatcher plus the Python rollout enum.