From 718b1d550c7b7724570a0d10c7e306d4b91f111b Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Mon, 22 Jun 2026 20:37:21 -0700 Subject: [PATCH] ocr: make rust_bridge a leaf (return raw dict, no litellm import) so the CodeQL autofix stops re-breaking it --- litellm/ocr/rust_bridge.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/litellm/ocr/rust_bridge.py b/litellm/ocr/rust_bridge.py index ff169472d40..c4104cd2b84 100644 --- a/litellm/ocr/rust_bridge.py +++ b/litellm/ocr/rust_bridge.py @@ -28,11 +28,15 @@ def rust_ocr( api_key: str | None, api_base: str | None, optional_params: dict, -) -> "OCRResponse": - """Run a Mistral OCR call end-to-end in Rust and wrap the result as ``OCRResponse``.""" - import litellm_python_bridge - from litellm.llms.base_llm.ocr.transformation import OCRResponse +) -> dict: + """Call the Rust bridge and return the raw OCR response dict. - return OCRResponse( - **litellm_python_bridge.ocr(model, document, api_key, api_base, optional_params) + Kept free of ``litellm`` imports so this module stays a leaf — the caller + (``litellm/ocr/main.py``) wraps the dict into an ``OCRResponse``. This avoids + the import edge CodeQL repeatedly flags (and auto-"fixes") as a cyclic import. + """ + import litellm_python_bridge + + return litellm_python_bridge.ocr( + model, document, api_key, api_base, optional_params )