From a4b49658881e1064f01066082286f93efd71dfad Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Mon, 22 Jun 2026 18:56:24 -0700 Subject: [PATCH] ocr: modernize rust_bridge typing (PEP 604, drop typing.Any/Dict) to satisfy strict-rule gate --- litellm/ocr/rust_bridge.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/litellm/ocr/rust_bridge.py b/litellm/ocr/rust_bridge.py index 89fdeb6810a..2b06714ba1e 100644 --- a/litellm/ocr/rust_bridge.py +++ b/litellm/ocr/rust_bridge.py @@ -6,7 +6,9 @@ then routes supported Mistral calls through the compiled ``litellm_python_bridge extension, which performs the whole OCR call (URL, headers, HTTP, parse) in Rust. """ -from typing import TYPE_CHECKING, Any, Dict, Optional +from __future__ import annotations + +from typing import TYPE_CHECKING if TYPE_CHECKING: from litellm.llms.base_llm.ocr.transformation import OCRResponse @@ -27,11 +29,11 @@ def rust_ocr_enabled() -> bool: def rust_ocr( model: str, - document: Dict[str, Any], - api_key: Optional[str], - api_base: Optional[str], - optional_params: Dict[str, Any], -) -> "OCRResponse": + document: dict, + 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