{"record":{"id":"a0c2048c40ad593b","repo":"BerriAI/litellm","slug":"oci-only-supports-function-tool-calls","errorCode":null,"errorMessage":"OCI only supports function tool calls","messagePattern":"OCI only supports function tool calls","errorType":"validation","errorClass":"OCIError","httpStatus":400,"severity":"error","filePath":"litellm/llms/oci/chat/generic.py","lineNumber":121,"sourceCode":"                )\n            new_content.append(OCIImageContentPart(imageUrl=OCIImageUrl(url=image_url)))\n\n    return OCIMessage(\n        role=open_ai_to_generic_oci_role_map[role],\n        content=new_content,\n        toolCalls=None,\n        toolCallId=None,\n    )\n\n\ndef adapt_messages_to_generic_oci_standard_tool_call(role: str, tool_calls: list) -> OCIMessage:\n    \"\"\"Convert an assistant tool-call message to OCI format.\"\"\"\n    tool_calls_formatted: Final = []\n    for tool_call in tool_calls:\n        if not isinstance(tool_call, dict):\n            raise OCIError(status_code=400, message=\"Each tool call must be a dictionary\")\n        if tool_call.get(\"type\") != \"function\":\n            raise OCIError(status_code=400, message=\"OCI only supports function tool calls\")\n\n        tool_call_id = tool_call.get(\"id\")\n        if not isinstance(tool_call_id, str):\n            raise OCIError(status_code=400, message=\"Tool call `id` must be a string\")\n\n        tool_function = tool_call.get(\"function\")\n        if not isinstance(tool_function, dict):\n            raise OCIError(status_code=400, message=\"Tool call `function` must be a dictionary\")\n\n        function_name = tool_function.get(\"name\")\n        if not isinstance(function_name, str):\n            raise OCIError(status_code=400, message=\"Tool call `function.name` must be a string\")\n\n        arguments = tool_call[\"function\"].get(\"arguments\", \"{}\")\n        if not isinstance(arguments, str):\n            raise OCIError(\n                status_code=400,\n                message=\"Tool call `function.arguments` must be a JSON string\",","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/oci/chat/generic.py#L103-L139","documentation":"The OCI GENERIC inference API only supports function-type tool calls. During adaptation, any tool call whose 'type' field is not exactly 'function' raises OCIError(400) 'OCI only supports function tool calls'. This rejects future/alternate OpenAI tool call kinds (e.g. 'custom_function', 'code_interpreter') before the request is sent.","triggerScenarios":"Sending an assistant history message containing tool_calls with type 'custom_function' or any non-'function' value to an oci/ GENERIC model; round-tripping responses from providers that emit other tool call types.","commonSituations":"Porting an agent framework that defines custom tool call types; replaying a conversation captured on another provider; typos like 'Function' (case-sensitive comparison) or 'functions'.","solutions":["Set 'type':'function' (exact lowercase) on every tool call you send to OCI.","Filter or rewrite non-function tool calls from history before routing the conversation to oci/ models.","Keep alternate tool-call kinds on a provider that supports them."],"exampleFix":"# before\n{'id':'c1','type':'custom_function','function':{...}}\n\n# after\n{'id':'c1','type':'function','function':{'name':'get_weather','arguments':'{}'}}","handlingStrategy":"validation","validationCode":"for msg in messages:\n    for tc in msg.get('tool_calls') or []:\n        if tc.get('type') != 'function':\n            tc['type'] = 'function'  # or drop/reject per your policy","typeGuard":"def is_function_tool_call(tc: object) -> bool:\n    return isinstance(tc, dict) and tc.get('type') == 'function'","tryCatchPattern":"try:\n    litellm.completion(model='oci/...', messages=msgs)\nexcept OCIError as e:\n    if 'only supports function tool calls' in str(e):\n        msgs = [m for m in msgs if keeps_function_calls_only(m)]\n    raise","preventionTips":["Treat 'type' as case-sensitive: always lowercase 'function'.","Route conversations containing custom tool call kinds away from OCI GENERIC models."],"tags":["oci","tool-calls","unsupported-feature","input-validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}