{"record":{"id":"6df2b893c7855a8a","repo":"BerriAI/litellm","slug":"generated-text-is-not-a-key-response-dictionary","errorCode":null,"errorMessage":"'generated_text' is not a key response dictionary - {completion_response}","messagePattern":"'generated_text' is not a key response dictionary - (.+?)","errorType":"exception","errorClass":"PredibaseError","httpStatus":422,"severity":"error","filePath":"litellm/llms/predibase/chat/transformation.py","lineNumber":162,"sourceCode":"            additional_args={\"complete_input_dict\": request_data},\n        )\n        try:\n            completion_response: Final = raw_response.json()\n        except Exception:\n            raise PredibaseError(message=raw_response.text, status_code=422)\n\n        if \"error\" in completion_response:\n            raise PredibaseError(\n                message=str(completion_response[\"error\"]),\n                status_code=raw_response.status_code,\n            )\n        elif not isinstance(completion_response, dict):\n            raise PredibaseError(\n                status_code=422,\n                message=f\"'completion_response' is not a dictionary - {completion_response}\",\n            )\n        elif \"generated_text\" not in completion_response:\n            raise PredibaseError(\n                status_code=422,\n                message=f\"'generated_text' is not a key response dictionary - {completion_response}\",\n            )\n\n        if len(completion_response[\"generated_text\"]) > 0:\n            model_response.choices[0].message.content = self.output_parser(completion_response[\"generated_text\"])\n\n        if \"details\" in completion_response and \"tokens\" in completion_response[\"details\"]:\n            model_response.choices[0].finish_reason = map_finish_reason(completion_response[\"details\"][\"finish_reason\"])\n            sum_logprob = 0\n            for token in completion_response[\"details\"][\"tokens\"]:\n                if token[\"logprob\"] is not None:\n                    sum_logprob += token[\"logprob\"]\n            setattr(\n                model_response.choices[0].message,\n                \"_logprob\",\n                sum_logprob,  # [TODO] move this to using the actual logprobs\n            )","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/predibase/chat/transformation.py#L144-L180","documentation":"Shape guard in the Predibase response transformation: the payload is a dict but lacks the 'generated_text' key that the completions contract expects, so no completion text can be extracted and the payload is surfaced verbatim.","triggerScenarios":"Triggered when the Predibase completion response dictionary lacks the 'generated_text' key.","commonSituations":"See trigger scenarios.","solutions":["The response dict lacks 'generated_text'; check the Predibase model output schema.","Use a Predibase deployment whose completion endpoint returns generated_text."],"exampleFix":"# verify the deployment's response format matches the expected completion schema.","handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}