{"record":{"id":"ad121b74fe510a5f","repo":"microsoft/semantic-kernel","slug":"the-settings-must-be-an-vertexaichatpromptexecutio","errorCode":null,"errorMessage":"The settings must be an VertexAIChatPromptExecutionSettings.","messagePattern":"The settings must be an VertexAIChatPromptExecutionSettings\\.","errorType":"exception","errorClass":"ServiceInvalidExecutionSettingsError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/google/vertex_ai/services/vertex_ai_chat_completion.py","lineNumber":187,"sourceCode":"\n        response: AsyncIterable[GenerationResponse] = await model.generate_content_async(\n            contents=self._prepare_chat_history_for_request(chat_history),\n            generation_config=settings.prepare_settings_dict(),\n            tools=settings.tools,\n            tool_config=settings.tool_config,\n            stream=True,\n        )\n\n        async for chunk in response:\n            yield [\n                self._create_streaming_chat_message_content(chunk, candidate, function_invoke_attempt)\n                for candidate in chunk.candidates\n            ]\n\n    @override\n    def _verify_function_choice_settings(self, settings: \"PromptExecutionSettings\") -> None:\n        if not isinstance(settings, VertexAIChatPromptExecutionSettings):\n            raise ServiceInvalidExecutionSettingsError(\"The settings must be an VertexAIChatPromptExecutionSettings.\")\n        if settings.candidate_count is not None and settings.candidate_count > 1:\n            raise ServiceInvalidExecutionSettingsError(\n                \"Auto-invocation of tool calls may only be used with a \"\n                \"VertexAIChatPromptExecutionSettings.candidate_count of 1.\"\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_choice_configuration\n\n    @override\n    def _reset_function_choice_settings(self, settings: \"PromptExecutionSettings\") -> None:\n        if hasattr(settings, \"tool_config\"):\n            settings.tool_config = None\n        if hasattr(settings, \"tools\"):\n            settings.tools = None","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/google/vertex_ai/services/vertex_ai_chat_completion.py#L169-L205","documentation":"Raised by VertexAIChatCompletion._verify_function_choice_settings when the PromptExecutionSettings passed for tool/function calling is not a VertexAIChatPromptExecutionSettings instance. Auto-invocation configuration is Vertex-specific, so the connector type-checks settings before applying function-choice behavior.","triggerScenarios":"Enabling function calling / tool invocation (e.g. FunctionChoiceBehavior.Auto) but supplying a generic PromptExecutionSettings or a settings object from a different connector (OpenAI, MistralAI) to a Vertex AI chat completion call.","commonSituations":"Reusing execution settings created for another provider across connectors. Passing a base PromptExecutionSettings instead of the Vertex-specific subclass when configuring kernel function invocation.","solutions":["Use VertexAIChatPromptExecutionSettings when calling VertexAIChatCompletion, especially with function calling enabled.","Let the service coerce settings by passing a dict or using get_prompt_execution_settings_from_settings, or instantiate the correct subclass directly.","Register the Vertex service under a dedicated service_id and request its matching settings class from the kernel."],"exampleFix":"# before\nsettings = PromptExecutionSettings()  # or OpenAIChatPromptExecutionSettings\n# after\nfrom semantic_kernel.connectors.ai.google.vertex_ai.vertex_ai_prompt_execution_settings import VertexAIChatPromptExecutionSettings\nsettings = VertexAIChatPromptExecutionSettings()","handlingStrategy":"type-guard","validationCode":"from semantic_kernel.connectors.ai.google.vertex_ai.vertex_ai_prompt_execution_settings import VertexAIChatPromptExecutionSettings\nassert isinstance(settings, VertexAIChatPromptExecutionSettings), 'Use VertexAIChatPromptExecutionSettings for Vertex AI function calling'","typeGuard":"def is_vertex_settings(settings) -> bool:\n    from semantic_kernel.connectors.ai.google.vertex_ai.vertex_ai_prompt_execution_settings import VertexAIChatPromptExecutionSettings\n    return isinstance(settings, VertexAIChatPromptExecutionSettings)","tryCatchPattern":null,"preventionTips":["Use the connector-specific settings subclass that matches the service.","Keep per-provider settings objects instead of sharing one across connectors.","When enabling function calling, double-check the settings class type."],"tags":["vertex-ai","settings","function-calling","type-check"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}