BerriAI/litellm · error · ValueError
Expected 'predictions' to be a list, got {type(_predictions)
Error message
Expected 'predictions' to be a list, got {type(_predictions)} What it means
Type guard on the BGE response: 'predictions' exists but is not a list (e.g. a dict or string), so it cannot be iterated per input text to build embedding rows. The actual type is included in the message.
Source
Thrown at litellm/llms/vertex_ai/vertex_embeddings/bge.py:148
Args:
response: The raw response from Vertex AI
model: The model name
model_response: The EmbeddingResponse object to populate
Returns:
EmbeddingResponse: The transformed response in OpenAI format
Raises:
KeyError: If response doesn't contain 'predictions'
ValueError: If predictions is not a list or contains invalid data
"""
if "predictions" not in response:
raise KeyError("Response missing 'predictions' field")
_predictions: Final = response["predictions"]
if not isinstance(_predictions, list):
raise ValueError(f"Expected 'predictions' to be a list, got {type(_predictions)}")
embedding_response: Final = []
# BGE models don't return token counts, so we estimate or set to 0
input_tokens: Final = 0
for idx, embedding_values in enumerate(_predictions):
if not isinstance(embedding_values, list):
raise ValueError(f"Expected embedding at index {idx} to be a list, got {type(embedding_values)}")
embedding_response.append(
{
"object": "embedding",
"index": idx,
"embedding": embedding_values,
}
)
model_response.object = "list"View on GitHub (pinned to 77b7c6c40c)
Solutions
- Check the raw response — 'predictions' should be a list of embeddings; a different type indicates an unexpected endpoint response.
- Verify you are calling the correct deployed endpoint for the BGE model with the right request schema.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at litellm/llms/vertex_ai/vertex_embeddings/bge.py:148 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/3b39f591fe5ad964.
Report an issue: GitHub.