From c7c71b95ad908880b5cc684247817ec0b3bac968 Mon Sep 17 00:00:00 2001 From: Yujong Lee Date: Tue, 15 Sep 2026 04:39:28 +0000 Subject: [PATCH] fix(rust-bridge): narrow OCR input_sources values to the native InputSource variants Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/rust_bridge/_native.pyi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litellm/rust_bridge/_native.pyi b/litellm/rust_bridge/_native.pyi index 4c1033aee79..e62c85f4599 100644 --- a/litellm/rust_bridge/_native.pyi +++ b/litellm/rust_bridge/_native.pyi @@ -1,10 +1,12 @@ from asyncio import Future from collections.abc import Coroutine, Mapping, Sequence -from typing import Never, final +from typing import Literal, Never, TypeAlias, final from litellm.llms.base_llm.ocr.transformation import OCRResponse from litellm.rust_bridge.ocr import LiteLLMOcrRequest +_InputSource: TypeAlias = Literal["request", "deployment", "environment"] + class RustBridgeDeclined(Exception): ... class RustUpstreamError(Exception): ... @@ -16,7 +18,7 @@ def ocr( custom_llm_provider: str | None = None, extra_headers: Mapping[str, object] | None = None, optional_params: Mapping[str, object] | None = None, - input_sources: Mapping[str, str] | None = None, + input_sources: Mapping[str, _InputSource] | None = None, timeout_seconds: float | None = None, ) -> dict[str, object]: ... def aocr( @@ -27,7 +29,7 @@ def aocr( custom_llm_provider: str | None = None, extra_headers: Mapping[str, object] | None = None, optional_params: Mapping[str, object] | None = None, - input_sources: Mapping[str, str] | None = None, + input_sources: Mapping[str, _InputSource] | None = None, timeout_seconds: float | None = None, ) -> Future[dict[str, object]]: ...