-
-
Notifications
You must be signed in to change notification settings - Fork 11k
feat: package Rust OCR bridge in LiteLLM wheel #31267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ishaan-berri
merged 6 commits into
litellm_internal_staging
from
litellm_hotfix_rust_pip_binary
Jun 25, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
20010c5
feat: package rust ocr bridge in litellm wheel
ishaan-berri 1f54303
Install Rust in Windows CircleCI job
ishaan-berri 8a32978
Address Rust wheel review feedback
ishaan-berri dbbe63f
Pin Windows rustup installer hash
ishaan-berri b637879
Retry flaky CircleCI job
ishaan-berri ad4dff1
Fix OSV langgraph checkpoint finding
ishaan-berri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ RUN apk add --no-cache \ | |
| gcc \ | ||
| python3 \ | ||
| python3-dev \ | ||
| rust \ | ||
| openssl \ | ||
| openssl-dev \ | ||
| nodejs \ | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ RUN for i in 1 2 3; do \ | |
| python3 \ | ||
| python3-dev \ | ||
| gcc \ | ||
| rust \ | ||
| bash \ | ||
| coreutils \ | ||
| curl \ | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| fn main() { | ||
| if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") { | ||
| println!("cargo:rustc-cdylib-link-arg=-undefined"); | ||
| println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); | ||
| } | ||
| } |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| """LiteLLM Rust bridge package.""" | ||
|
|
||
| from litellm.rust_bridge.loader import ( | ||
| get_native_bridge, | ||
| native_bridge_available, | ||
| ) | ||
|
|
||
| __all__ = ["get_native_bridge", "native_bridge_available"] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| """Loader for the packaged LiteLLM Rust extension.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from types import ModuleType | ||
|
|
||
| _BRIDGE_SENTINEL = object() | ||
| _cached_bridge: ModuleType | None | object = _BRIDGE_SENTINEL | ||
|
|
||
|
|
||
| def get_native_bridge() -> ModuleType | None: | ||
| """Return the packaged Rust extension, or ``None`` when unavailable.""" | ||
| global _cached_bridge | ||
| if _cached_bridge is not _BRIDGE_SENTINEL: | ||
| return _cached_bridge if isinstance(_cached_bridge, ModuleType) else None | ||
|
|
||
| try: | ||
| from litellm.rust_bridge import _native | ||
| except ImportError: | ||
| _cached_bridge = None | ||
| return None | ||
| _cached_bridge = _native | ||
| return _native | ||
|
|
||
|
|
||
| def native_bridge_available() -> bool: | ||
| """Whether the packaged Rust extension is importable.""" | ||
| return get_native_bridge() is not None | ||
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.