BerriAI/litellm · error · PredibaseError
'completion_response' is not a dictionary - {completion_resp
Error message
'completion_response' is not a dictionary - {completion_response} What it means
Shape guard in the Predibase response transformation: the parsed completion_response is not a dict (e.g. a list or string), so the code cannot look up 'generated_text', and the whole payload is included in the error for inspection.
Source
Thrown at litellm/llms/predibase/chat/transformation.py:157
) -> ModelResponse:
logging_obj.post_call(
input=messages,
api_key=api_key or "",
original_response=raw_response.text,
additional_args={"complete_input_dict": request_data},
)
try:
completion_response: Final = raw_response.json()
except Exception:
raise PredibaseError(message=raw_response.text, status_code=422)
if "error" in completion_response:
raise PredibaseError(
message=str(completion_response["error"]),
status_code=raw_response.status_code,
)
elif not isinstance(completion_response, dict):
raise PredibaseError(
status_code=422,
message=f"'completion_response' is not a dictionary - {completion_response}",
)
elif "generated_text" not in completion_response:
raise PredibaseError(
status_code=422,
message=f"'generated_text' is not a key response dictionary - {completion_response}",
)
if len(completion_response["generated_text"]) > 0:
model_response.choices[0].message.content = self.output_parser(completion_response["generated_text"])
if "details" in completion_response and "tokens" in completion_response["details"]:
model_response.choices[0].finish_reason = map_finish_reason(completion_response["details"]["finish_reason"])
sum_logprob = 0
for token in completion_response["details"]["tokens"]:
if token["logprob"] is not None:
sum_logprob += token["logprob"]View on GitHub (pinned to 77b7c6c40c)
Solutions
- Ensure the Predibase endpoint returns a JSON object; a non-dict response indicates a proxy or endpoint misconfiguration.
- Verify api_base points to the correct Predibase deployment URL.
Example fix
# confirm api_base returns JSON: curl the endpoint and check the payload type.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Triggered when the Predibase completion response is not a dictionary, e.g. the API returned an unexpected payload shape.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/b0faaedf2f88b276.
Report an issue: GitHub.