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]

image gen catch when predictions not in json response

Ishaan Jaffe17e959c6265
diff --git a/litellm/llms/vertex_httpx.py b/litellm/llms/vertex_httpx.py
index fa6308bef7e..8ab60b197b2 100644
--- a/litellm/llms/vertex_httpx.py
+++ b/litellm/llms/vertex_httpx.py
@@ -1352,6 +1352,12 @@ 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] = []