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 predictions image generation response

Ishaan Jaff5d1fcc545b07
diff --git a/litellm/llms/vertex_httpx.py b/litellm/llms/vertex_httpx.py
index ce6a31d7bda..b927306133e 100644
--- a/litellm/llms/vertex_httpx.py
+++ b/litellm/llms/vertex_httpx.py
@@ -1499,6 +1499,14 @@ class VertexLLM(BaseLLM):
"""
_json_response = response.json()
+
+ if "predictions" not in _json_response:
+ raise litellm.InternalServerError(
+ message=f"image generation response does not contain 'predictions', got {_json_response}",
+ llm_provider="vertex_ai",
+ model=model,
+ )
+
_predictions = _json_response["predictions"]
_response_data: List[Image] = []