BerriAI/litellm · error · OCIError
response_format type 'json_schema' requires a 'json_schema'
Error message
response_format type 'json_schema' requires a 'json_schema' object
What it means
Error "response_format type 'json_schema' requires a 'json_schema' object" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/oci/chat/transformation.py:207
rf_type: Final = str(rf["type"]).lower()
raw_schema: Final = rf.get("json_schema")
json_schema: Final = raw_schema if isinstance(raw_schema, dict) else None
if rf_type == "text":
selected_params["responseFormat"] = {"type": "TEXT"}
return
if vendor == OCIVendors.COHERE:
# OCI Cohere has no JSON_SCHEMA type; a schema rides on JSON_OBJECT.
payload: Final[dict[str, Any]] = {"type": "JSON_OBJECT"}
if json_schema is not None and json_schema.get("schema") is not None:
payload["schema"] = json_schema["schema"]
selected_params["responseFormat"] = payload
return
if rf_type == "json_schema":
if json_schema is None:
raise OCIError(
status_code=400,
message="response_format type 'json_schema' requires a 'json_schema' object",
)
# OCI's ResponseJsonSchema accepts only name/description/schema/isStrict.
# OpenAI sends `strict` instead of `isStrict`; forwarding it (or any
# other extra key) makes OCI reject the whole request with HTTP 400.
oci_schema: Final[dict[str, Any]] = {"name": json_schema.get("name") or "response"}
if json_schema.get("description") is not None:
oci_schema["description"] = json_schema["description"]
if json_schema.get("schema") is not None:
oci_schema["schema"] = json_schema["schema"]
if json_schema.get("strict") is not None:
oci_schema["isStrict"] = json_schema["strict"]
selected_params["responseFormat"] = {
"type": "JSON_SCHEMA",
"jsonSchema": oci_schema,
}
returnView on GitHub (pinned to 6c2dcb801b)
Solutions
- Include a 'json_schema' object when response_format type is 'json_schema'.
When it happens
Trigger: Thrown at litellm/llms/oci/chat/transformation.py:207 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/e9755e5a23b19dea.
Report an issue: GitHub.