From 08271a8b281d6d0afe3c3f65c440af88f719c83a Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Sat, 31 Jan 2026 11:16:22 -0800 Subject: [PATCH] fix transform_retrieve_file_response --- litellm/llms/gemini/files/transformation.py | 6 ++++-- litellm/proxy/common_utils/cache_coordinator.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/litellm/llms/gemini/files/transformation.py b/litellm/llms/gemini/files/transformation.py index 861f7bd2f2b..37f1376c2b1 100644 --- a/litellm/llms/gemini/files/transformation.py +++ b/litellm/llms/gemini/files/transformation.py @@ -238,11 +238,13 @@ class GoogleAIStudioFilesHandler(GeminiModelInfo, BaseFilesConfig): # Map Gemini state to OpenAI status gemini_state = response_json.get("state", "STATE_UNSPECIFIED") - status: Literal["uploaded", "processed", "error"] = "uploaded" # Default + # Explicitly type status as the Literal union if gemini_state == "ACTIVE": - status = "processed" + status: Literal["uploaded", "processed", "error"] = "processed" elif gemini_state == "FAILED": status = "error" + else: + status = "uploaded" return OpenAIFileObject( id=response_json.get("uri", ""), diff --git a/litellm/proxy/common_utils/cache_coordinator.py b/litellm/proxy/common_utils/cache_coordinator.py index 9b07def125b..4eceb83af5f 100644 --- a/litellm/proxy/common_utils/cache_coordinator.py +++ b/litellm/proxy/common_utils/cache_coordinator.py @@ -94,7 +94,7 @@ class EventDrivenCacheCoordinator: verbose_proxy_logger.debug( "%s Signal received, reading from cache", self._log_prefix ) - value = await cache.async_get_cache(key=cache_key) + value: Optional[T] = await cache.async_get_cache(key=cache_key) if value is not None and self._log_prefix: verbose_proxy_logger.debug( "%s Cache filled by other request, value: %s", @@ -186,6 +186,7 @@ class EventDrivenCacheCoordinator: ) try: - return await self._load_and_cache(cache_key, cache, load_fn) + result = await self._load_and_cache(cache_key, cache, load_fn) + return result finally: await self._signal_done()