BerriAI/litellm · error · TypeError
Unsupported response_format type
Error message
Unsupported response_format type - {response_format} What it means
Error "Unsupported response_format type - {response_format}" thrown in BerriAI/litellm.
Solutions
- Use a supported response_format type (e.g. {'type':'json_object'} or {'type':'text'}).
When it happens
Trigger: Thrown at litellm/llms/base_llm/base_utils.py:190 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/36d1cda0937fdbe5.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/base_llm/base_utils.py:190
response_format: type[BaseModel] | dict | None,
ref_template: str | None = None,
) -> dict | None:
"""
Re-implementation of openai's 'type_to_response_format_param' function
Used for converting pydantic object to api schema.
"""
if response_format is None:
return None
if isinstance(response_format, dict):
return _dict_to_response_format_helper(response_format, ref_template)
# type checkers don't narrow the negation of a `TypeGuard` as it isn't
# a safe default behaviour but we know that at this point the `response_format`
# can only be a `type`
if not _parsing._completions.is_basemodel_type(response_format):
raise TypeError(f"Unsupported response_format type - {response_format}")
if ref_template is not None:
schema = response_format.model_json_schema(ref_template=ref_template)
else:
schema = _pydantic.to_strict_json_schema(response_format)
return {
"type": "json_schema",
"json_schema": {
"schema": schema,
"name": response_format.__name__,
"strict": True,
},
}
def map_developer_role_to_system_role(
messages: list[AllMessageValues],View on GitHub (pinned to 77b7c6c40c)