{"record":{"id":"001dcfad8c731e2b","repo":"microsoft/autogen","slug":"model-does-not-support-function-calling-001dcf","errorCode":null,"errorMessage":"Model does not support function calling","messagePattern":"Model does not support function calling","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py","lineNumber":357,"sourceCode":"                if isinstance(message, UserMessage):\n                    if isinstance(message.content, list) and any(isinstance(x, Image) for x in message.content):\n                        raise ValueError(\"Model does not support vision and image was provided\")\n\n        if json_output is not None:\n            if self.model_info[\"json_output\"] is False and json_output is True:\n                raise ValueError(\"Model does not support JSON output\")\n\n            if isinstance(json_output, type):\n                # TODO: we should support this in the future.\n                raise ValueError(\"Structured output is not currently supported for AzureAIChatCompletionClient\")\n\n            if json_output is True and \"response_format\" not in create_args:\n                create_args[\"response_format\"] = \"json_object\"\n\n        if self.model_info[\"json_output\"] is False and json_output is True:\n            raise ValueError(\"Model does not support JSON output\")\n        if self.model_info[\"function_calling\"] is False and len(tools) > 0:\n            raise ValueError(\"Model does not support function calling\")\n\n    async def create(\n        self,\n        messages: Sequence[LLMMessage],\n        *,\n        tools: Sequence[Tool | ToolSchema] = [],\n        tool_choice: Tool | Literal[\"auto\", \"required\", \"none\"] = \"auto\",\n        json_output: Optional[bool | type[BaseModel]] = None,\n        extra_create_args: Mapping[str, Any] = {},\n        cancellation_token: Optional[CancellationToken] = None,\n    ) -> CreateResult:\n        extra_create_args_keys = set(extra_create_args.keys())\n        if not create_kwargs.issuperset(extra_create_args_keys):\n            raise ValueError(f\"Extra create args are invalid: {extra_create_args_keys - create_kwargs}\")\n\n        # Copy the create args and overwrite anything in extra_create_args\n        create_args = self._create_args.copy()\n        create_args.update(extra_create_args)","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py#L339-L375","documentation":"Raised by AzureAIChatCompletionClient._validate_model_info when self.model_info['function_calling'] is False and the tools sequence passed to create()/create_stream() is non-empty. The client prevents sending tool definitions to a model declared without tool-calling support.","triggerScenarios":"Passing tools=[Tool(...)] or tool schemas to a model whose model_info has function_calling=False; registering tools on a RoundRobinGroupChat/agent that uses such a client.","commonSituations":"model_info copied from a template default with function_calling=False (e.g. embedding or small text models) while the code registers tools; older open models on Foundry that lack function calling; capability dict hand-written and the flag forgotten.","solutions":["Set function_calling=True in model_info if the deployment supports tool calling","Remove tools / unregister tool handlers for models without function calling","Verify against the model's Foundry model card that tool use is supported before declaring it"],"exampleFix":"# before\nmodel_info = ModelInfo(family=\"gpt-4o\", vision=True, function_calling=False,\n                      json_output=True, structured_output=False)\nawait client.create(msgs, tools=[my_tool])\n\n# after\nmodel_info = ModelInfo(family=\"gpt-4o\", vision=True, function_calling=True,\n                      json_output=True, structured_output=False)\nawait client.create(msgs, tools=[my_tool])","handlingStrategy":"validation","validationCode":"if tools and client.model_info[\"function_calling\"] is False:\n    tools = []  # or raise: model declared without tool support","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set function_calling=True in model_info only for tool-capable deployments","Register tools conditionally based on client.model_info['function_calling']","Test agent teams with the exact deployed model family"],"tags":["azure","function-calling","tools","model-info"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}