BerriAI/litellm · error · OCIError
Tool `function` must be a dictionary
Error message
Tool `function` must be a dictionary
What it means
Error "Tool `function` must be a dictionary" thrown in BerriAI/litellm.
Source
Thrown at litellm/llms/oci/chat/generic.py:226
# ---------------------------------------------------------------------------
# Tool definition adaptation
# ---------------------------------------------------------------------------
def adapt_tool_definition_to_oci_standard(tools: list[dict], vendor: OCIVendors) -> list[OCIToolDefinition]:
"""Convert OpenAI-format tool definitions to OCI GENERIC format.
Resolves ``$ref``/``$defs`` and ``anyOf`` that the OCI endpoint rejects.
"""
new_tools: Final = []
for tool in tools:
if tool["type"] != "function":
raise OCIError(status_code=400, message="OCI only supports function tools")
tool_function = tool.get("function")
if not isinstance(tool_function, dict):
raise OCIError(status_code=400, message="Tool `function` must be a dictionary")
raw_params = tool_function.get("parameters", {})
resolved_params = sanitize_oci_schema(resolve_oci_schema_anyof(resolve_oci_schema_refs(raw_params)))
new_tools.append(
OCIToolDefinition(
type="FUNCTION",
name=tool_function.get("name"),
description=tool_function.get("description", ""),
parameters=resolved_params,
)
)
return new_tools
def _normalize_oci_finish_reason(raw: str | None) -> str | None:
"""Map an OCI-specific finish reason to its OpenAI-standard equivalent.View on GitHub (pinned to 6c2dcb801b)
Solutions
- Pass tool 'function' as a dictionary.
When it happens
Trigger: Thrown at litellm/llms/oci/chat/generic.py:226 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/26bbf2353d97ca58.
Report an issue: GitHub.