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(vertex_ai/image_generation_handler.py): fix default sample count to be 1 - same as openai (#16403)

Krish Dholakiade897ce3897a
diff --git a/litellm/llms/vertex_ai/image_generation/image_generation_handler.py b/litellm/llms/vertex_ai/image_generation/image_generation_handler.py
index 4ffe557f1b6..04be4de8e32 100644
--- a/litellm/llms/vertex_ai/image_generation/image_generation_handler.py
+++ b/litellm/llms/vertex_ai/image_generation/image_generation_handler.py
@@ -45,17 +45,18 @@ class VertexImageGeneration(VertexLLM):
Transform the optional params to the format expected by the Vertex AI API.
For example, "aspect_ratio" is transformed to "aspectRatio".
"""
+ default_params = {
+ "sampleCount": 1,
+ }
if optional_params is None:
- return {
- "sampleCount": 1,
- }
+ return default_params
def snake_to_camel(snake_str: str) -> str:
"""Convert snake_case to camelCase"""
components = snake_str.split("_")
return components[0] + "".join(word.capitalize() for word in components[1:])
- transformed_params = {}
+ transformed_params = default_params.copy()
for key, value in optional_params.items():
if "_" in key:
camel_case_key = snake_to_camel(key)