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]

test: update tests

Krrish Dholakia4b8f2dc051b5
diff --git a/litellm/types/utils.py b/litellm/types/utils.py
index 1dabeee9010..8487e4bef6d 100644
--- a/litellm/types/utils.py
+++ b/litellm/types/utils.py
@@ -742,7 +742,7 @@ class Delta(OpenAIObject):
else:
del self.annotations
- if images is not None:
+ if images is not None and len(images) > 0:
self.images = images
else:
del self.images
diff --git a/tests/llm_translation/test_gemini.py b/tests/llm_translation/test_gemini.py
index 215a7f35ea6..aa4b6bd07c9 100644
--- a/tests/llm_translation/test_gemini.py
+++ b/tests/llm_translation/test_gemini.py
@@ -625,10 +625,11 @@ async def test_gemini_image_generation_async_stream():
async for chunk in response:
print("CHUNK: ", chunk)
if (
- hasattr(chunk.choices[0].delta, "image")
- and chunk.choices[0].delta.image is not None
+ hasattr(chunk.choices[0].delta, "images")
+ and chunk.choices[0].delta.images is not None
+ and len(chunk.choices[0].delta.images) > 0
):
- model_response_image = chunk.choices[0].delta.image
+ model_response_image = chunk.choices[0].delta.images[0]
print("MODEL_RESPONSE_IMAGE: ", model_response_image)
assert model_response_image is not None
assert model_response_image["url"].startswith("data:image/png;base64,")