fix transform_retrieve_file_response

This commit is contained in:
Ishaan Jaffer 2026-01-31 11:16:22 -08:00
parent 05552b5194
commit 08271a8b28
2 changed files with 7 additions and 4 deletions

View file

@ -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", ""),

View file

@ -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()