mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
ocr: lazily import rust bridge inside ocr() to break the import cycle the CodeQL autofix mangled
This commit is contained in:
parent
54577a691e
commit
3188f93be0
1 changed files with 4 additions and 2 deletions
|
|
@ -39,8 +39,6 @@ async def aocr(
|
|||
extra_headers: Optional[Dict[str, Any]] = None,
|
||||
**kwargs,
|
||||
) -> OCRResponse:
|
||||
from litellm.ocr.rust_bridge import rust_ocr, rust_ocr_enabled
|
||||
|
||||
"""
|
||||
Async OCR function.
|
||||
|
||||
|
|
@ -264,6 +262,10 @@ def ocr(
|
|||
api_base = dynamic_api_base
|
||||
|
||||
# Optional Rust path: hand the whole Mistral OCR call to the Rust bridge.
|
||||
# Imported lazily to avoid a module-level import cycle (CodeQL flags the
|
||||
# litellm.ocr.main -> litellm.ocr.rust_bridge edge during package init).
|
||||
from litellm.ocr.rust_bridge import rust_ocr, rust_ocr_enabled
|
||||
|
||||
if custom_llm_provider == "mistral" and rust_ocr_enabled():
|
||||
return rust_ocr(model, document, api_key, api_base, kwargs)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue