{"record":{"id":"6ae5f7a9f2181125","repo":"BerriAI/litellm","slug":"azure-does-not-support-tool-choice-for-api-vers","errorCode":null,"errorMessage":"Azure does not support 'tool_choice', for api_version={api_version}. Bump your API version to '2023-12-01-preview' or later. This parameter requires 'api_version=\"2023-12-01-preview\"' or later. Azure API Reference: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions","messagePattern":"Azure does not support 'tool_choice', for api_version=(.+?)\\. Bump your API version to '2023-12-01-preview' or later\\. This parameter requires 'api_version=\"2023-12-01-preview\"' or later\\. Azure API Reference: https://learn\\.microsoft\\.com/en-us/azure/ai-services/openai/reference#chat-completions","errorType":"http","errorClass":"UnsupportedParamsError","httpStatus":400,"severity":"error","filePath":"litellm/llms/azure/chat/gpt_transformation.py","lineNumber":193,"sourceCode":"            if param == \"tool_choice\":\n                \"\"\"\n                This parameter requires API version 2023-12-01-preview or later\n\n                tool_choice='required' is not supported as of 2024-05-01-preview\n                \"\"\"\n                ## check if api version supports this param ##\n                if api_version_year is None or api_version_month is None or api_version_day is None:\n                    optional_params[\"tool_choice\"] = value\n                else:\n                    if (\n                        api_version_year < \"2023\"\n                        or (api_version_year == \"2023\" and api_version_month < \"12\")\n                        or (api_version_year == \"2023\" and api_version_month == \"12\" and api_version_day < \"01\")\n                    ):\n                        if litellm.drop_params is True or (drop_params is not None and drop_params is True):\n                            pass\n                        else:\n                            raise UnsupportedParamsError(\n                                status_code=400,\n                                message=f\"\"\"Azure does not support 'tool_choice', for api_version={api_version}. Bump your API version to '2023-12-01-preview' or later. This parameter requires 'api_version=\"2023-12-01-preview\"' or later. Azure API Reference: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions\"\"\",\n                            )\n                    elif value == \"required\" and (\n                        api_version_year == \"2024\" and api_version_month <= \"05\"\n                    ):  ## check if tool_choice value is supported ##\n                        if litellm.drop_params is True or (drop_params is not None and drop_params is True):\n                            pass\n                        else:\n                            raise UnsupportedParamsError(\n                                status_code=400,\n                                message=f\"Azure does not support '{value}' as a {param} param, for api_version={api_version}. To drop 'tool_choice=required' for calls with this Azure API version, set `litellm.drop_params=True` or for proxy:\\n\\n`litellm_settings:\\n drop_params: true`\\nAzure API Reference: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions\",\n                            )\n                    else:\n                        optional_params[\"tool_choice\"] = value\n            elif param == \"response_format\" and isinstance(value, dict):\n                _is_response_format_supported_model = self._is_response_format_supported_model(model)\n","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/azure/chat/gpt_transformation.py#L175-L211","documentation":"Error \"Azure does not support 'tool_choice', for api_version={api_version}. Bump your API version to '2023-12-01-preview' or later. This parameter requires 'api_version=\"2023-12-01-preview\"' or later. Azure API Reference: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure/chat/gpt_transformation.py:193 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Bump api_version to 2023-12-01-preview or later to use tool_choice."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}