{"record":{"id":"76e423eb36c25ace","repo":"microsoft/semantic-kernel","slug":"the-settings-must-be-an-azureaiinferencechatprompt","errorCode":null,"errorMessage":"The settings must be an AzureAIInferenceChatPromptExecutionSettings.","messagePattern":"The settings must be an AzureAIInferenceChatPromptExecutionSettings\\.","errorType":"exception","errorClass":"ServiceInvalidExecutionSettingsError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/azure_ai_inference/services/azure_ai_inference_chat_completion.py","lineNumber":200,"sourceCode":"                model=self.ai_model_id,\n                messages=self._prepare_chat_history_for_request(chat_history),\n                model_extras=settings.extra_parameters,\n                **settings_dict,\n            )\n\n        async for chunk in response:\n            if len(chunk.choices) == 0:\n                continue\n            chunk_metadata = self._get_metadata_from_response(chunk)\n            yield [\n                self._create_streaming_chat_message_content(chunk, choice, chunk_metadata, function_invoke_attempt)\n                for choice in chunk.choices\n            ]\n\n    @override\n    def _verify_function_choice_settings(self, settings: \"PromptExecutionSettings\") -> None:\n        if not isinstance(settings, AzureAIInferenceChatPromptExecutionSettings):\n            raise ServiceInvalidExecutionSettingsError(\n                \"The settings must be an AzureAIInferenceChatPromptExecutionSettings.\"\n            )\n        if settings.extra_parameters is not None and settings.extra_parameters.get(\"n\", 1) > 1:\n            # Currently only OpenAI models allow multiple completions but the Azure AI Inference service\n            # does not expose the functionality directly. If users want to have more than 1 responses, they\n            # need to configure `extra_parameters` with a key of \"n\" and a value greater than 1.\n            raise ServiceInvalidExecutionSettingsError(\n                \"Auto invocation of tool calls may only be used with a single completion.\"\n            )\n\n    @override\n    def _update_function_choice_settings_callback(\n        self,\n    ) -> Callable[[\"FunctionCallChoiceConfiguration\", \"PromptExecutionSettings\", FunctionChoiceType], None]:\n        return update_settings_from_function_call_configuration\n\n    @override\n    def _reset_function_choice_settings(self, settings: \"PromptExecutionSettings\") -> None:","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/azure_ai_inference/services/azure_ai_inference_chat_completion.py#L182-L218","documentation":"Raised in _verify_function_choice_settings when the settings object passed to the Azure AI Inference chat completion service is not an AzureAIInferenceChatPromptExecutionSettings instance. The connector's function-choice/tool-call configuration logic is specific to that settings subclass, so a generic PromptExecutionSettings or a different connector's settings cannot be used for auto-invocation setup.","triggerScenarios":"Passing a generic PromptExecutionSettings, an OpenAIChatPromptExecutionSettings, or any other settings type to an AzureAIInferenceChatCompletion method that triggers function-choice verification (i.e. when tools/auto-invocation are configured).","commonSituations":"Sharing a single settings object across connectors from different vendors; constructing settings via a factory that returns the base type; swapping the underlying connector without updating the settings class.","solutions":["Use AzureAIInferenceChatPromptExecutionSettings for the Azure AI Inference chat completion service.","Build settings per-connector rather than reusing one across vendors.","If calling the base API directly, ensure the correct subclass is instantiated for the service in use."],"exampleFix":"# before\nfrom semantic_kernel.connectors.ai.prompt_execution_settings import PromptExecutionSettings\nsettings = PromptExecutionSettings(service_id=\"azure\")\n\n# after\nfrom semantic_kernel.connectors.ai.azure_ai_inference import AzureAIInferenceChatPromptExecutionSettings\nsettings = AzureAIInferenceChatPromptExecutionSettings(service_id=\"azure\")","handlingStrategy":"type-guard","validationCode":"from semantic_kernel.connectors.ai.azure_ai_inference import AzureAIInferenceChatPromptExecutionSettings\n\nassert isinstance(settings, AzureAIInferenceChatPromptExecutionSettings), \\\n    \"Use AzureAIInferenceChatPromptExecutionSettings for the Azure AI Inference chat service\"","typeGuard":"from semantic_kernel.connectors.ai.azure_ai_inference import AzureAIInferenceChatPromptExecutionSettings\n\ndef is_azure_ai_settings(settings) -> bool:\n    return isinstance(settings, AzureAIInferenceChatPromptExecutionSettings)","tryCatchPattern":"from semantic_kernel.exceptions import ServiceInvalidExecutionSettingsError\ntry:\n    service._verify_function_choice_settings(settings)\nexcept ServiceInvalidExecutionSettingsError:\n    settings = AzureAIInferenceChatPromptExecutionSettings(**settings.model_dump())","preventionTips":["Build settings per-connector; don't share across vendors.","Instantiate the specific subclass matching the service.","Validate the settings type in a factory before dispatch."],"tags":["azure-ai-inference","settings","function-calling","type-mismatch","python"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}