Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: test_gemini_image_generation_async_stream

Ishaan Jaff3fc2198d27dd
diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
index 178e340f191..6cdde8ea4b1 100644
--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
@@ -1278,10 +1278,10 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
"audio"
] = audio_response
chat_completion_message["content"] = None # OpenAI spec
- elif image_response is not None:
+ if image_response is not None:
# Handle image response - combine with text content into structured format
cast(Dict[str, Any], chat_completion_message)["image"] = image_response
- elif content is not None:
+ if content is not None:
chat_completion_message["content"] = content
if reasoning_content is not None:
diff --git a/tests/llm_translation/test_gemini.py b/tests/llm_translation/test_gemini.py
index db601d3c374..15ee7505edb 100644
--- a/tests/llm_translation/test_gemini.py
+++ b/tests/llm_translation/test_gemini.py
@@ -591,9 +591,9 @@ async def test_gemini_image_generation_async():
IMAGE_URL = response.choices[0].message.image
print("IMAGE_URL: ", IMAGE_URL)
- assert CONTENT is not None
- assert IMAGE_URL is not None
- assert IMAGE_URL["url"] is not None
+ assert CONTENT is not None, "CONTENT is not None"
+ assert IMAGE_URL is not None, "IMAGE_URL is not None"
+ assert IMAGE_URL["url"] is not None, "IMAGE_URL['url'] is not None"
assert IMAGE_URL["url"].startswith("data:image/png;base64,")