BerriAI/litellm · error · BaseLLMException
Invalid response format: missing 'predictions' field
Error message
Invalid response format: missing 'predictions' field
What it means
Guard in _unwrap_predictions_response: the Vertex Gemma response JSON lacks the 'predictions' wrapper that should contain the OpenAI-compatible completion, so there is nothing to unwrap and the parent transform cannot proceed.
Source
Thrown at litellm/llms/vertex_ai/vertex_gemma_models/transformation.py:124
{
"@requestFormat": "chatCompletions",
**openai_request,
}
]
}
def _unwrap_predictions_response(
self,
response_json: dict[str, Any],
) -> dict[str, Any]:
"""
Unwrap the Vertex Gemma predictions format to OpenAI format.
Vertex Gemma wraps the OpenAI-compatible response in a 'predictions' field.
This method extracts it so the parent class can process it normally.
"""
if "predictions" not in response_json:
raise BaseLLMException(
status_code=422,
message="Invalid response format: missing 'predictions' field",
)
return response_json["predictions"]
@staticmethod
def _sync_post(
client: HTTPHandler | httpx.Client | None,
api_base: str,
headers: dict[str, str], # mutable-ok: forwarded to post(headers: dict | None)
request_data: dict[str, Any], # mutable-ok: forwarded to post(json: dict | ...)
timeout: float | httpx.Timeout | None,
) -> httpx.Response:
if isinstance(client, HTTPHandler):
return client.post(
url=api_base,
headers=headers,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Inspect the raw response; missing 'predictions' usually means the endpoint returned an error payload.
- Verify the request matches the Gemma endpoint's expected schema (instances/parameters) and retry.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/llms/vertex_ai/vertex_gemma_models/transformation.py:124 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/f71d42a6889c9330.
Report an issue: GitHub.