{"record":{"id":"2e8e7a432f882175","repo":"microsoft/autogen","slug":"extra-create-args-are-invalid-extra-create-args","errorCode":null,"errorMessage":"Extra create args are invalid: {extra_create_args_keys - create_kwargs}","messagePattern":"Extra create args are invalid: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py","lineNumber":371,"sourceCode":"\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)\n\n        self._validate_model_info(messages, tools, json_output, create_args)\n\n        azure_messages_nested = [to_azure_message(msg) for msg in messages]\n        azure_messages = [item for sublist in azure_messages_nested for item in sublist]\n\n        task: Task[ChatCompletions]\n\n        if len(tools) > 0:\n            if isinstance(tool_choice, Tool):\n                create_args[\"tool_choice\"] = ChatCompletionsNamedToolChoice(\n                    function=ChatCompletionsNamedToolChoiceFunction(name=tool_choice.name)\n                )\n            else:","sourceCodeStart":353,"sourceCodeEnd":389,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py#L353-L389","documentation":"Raised at the top of AzureAIChatCompletionClient.create() when extra_create_args contains keys not in the module-level create_kwargs whitelist (the set of parameters ChatCompletionsClient accepts, minus model_info). The error message lists the offending keys (set difference), so you can see exactly which argument names are not recognized.","triggerScenarios":"Calling create(..., extra_create_args={'azure_endpoint': ..., 'deployment_name': ...}) or vendor-specific options like 'response_format_type', 'seed' (if not whitelisted), 'top_p' spelled differently than in create_kwargs.","commonSituations":"Porting kwargs from the raw azure-ai-inference SDK or the Azure OpenAI SDK; passing OpenAI-style parameter names; version drift where newer SDK params are not yet in autogen-ext's create_kwargs set.","solutions":["Rename the keys to those in create_kwargs (inspect autogen_ext.models.azure._azure_ai_client.create_kwargs for the exact allowed set)","Remove arguments that belong to client construction (endpoint, credential, model) from extra_create_args — they go in the constructor","If a legitimate new SDK param is missing from the whitelist, upgrade autogen-ext or raise an upstream issue"],"exampleFix":"# before\nawait client.create(msgs, extra_create_args={\"azure_endpoint\": ep, \"temperature\": 0.2})\n\n# after\nawait client.create(msgs, extra_create_args={\"temperature\": 0.2})\n# endpoint/credential belong to the constructor, not extra_create_args","handlingStrategy":"validation","validationCode":"from autogen_ext.models.azure._azure_ai_client import create_kwargs\n\nextra = {k: v for k, v in extra.items() if k in create_kwargs}\nbad = set(extra) - create_kwargs  # should be empty before calling create()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter shared kwargs dicts through create_kwargs before passing them","Constructor options (endpoint/credential/model) never belong in extra_create_args","Pin autogen-ext and the azure SDK together in lockstep"],"tags":["azure","extra-create-args","argument-validation","whitelist"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}