microsoft/semantic-kernel · error · ServiceInvalidExecutionSettingsError

The settings must be an VertexAIChatPromptExecutionSettings.

Error message

The settings must be an VertexAIChatPromptExecutionSettings.

What it means

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.

Source

Thrown at python/semantic_kernel/connectors/ai/google/vertex_ai/services/vertex_ai_chat_completion.py:187

        response: AsyncIterable[GenerationResponse] = await model.generate_content_async(
            contents=self._prepare_chat_history_for_request(chat_history),
            generation_config=settings.prepare_settings_dict(),
            tools=settings.tools,
            tool_config=settings.tool_config,
            stream=True,
        )

        async for chunk in response:
            yield [
                self._create_streaming_chat_message_content(chunk, candidate, function_invoke_attempt)
                for candidate in chunk.candidates
            ]

    @override
    def _verify_function_choice_settings(self, settings: "PromptExecutionSettings") -> None:
        if not isinstance(settings, VertexAIChatPromptExecutionSettings):
            raise ServiceInvalidExecutionSettingsError("The settings must be an VertexAIChatPromptExecutionSettings.")
        if settings.candidate_count is not None and settings.candidate_count > 1:
            raise ServiceInvalidExecutionSettingsError(
                "Auto-invocation of tool calls may only be used with a "
                "VertexAIChatPromptExecutionSettings.candidate_count of 1."
            )

    @override
    def _update_function_choice_settings_callback(
        self,
    ) -> Callable[["FunctionCallChoiceConfiguration", "PromptExecutionSettings", FunctionChoiceType], None]:
        return update_settings_from_function_choice_configuration

    @override
    def _reset_function_choice_settings(self, settings: "PromptExecutionSettings") -> None:
        if hasattr(settings, "tool_config"):
            settings.tool_config = None
        if hasattr(settings, "tools"):
            settings.tools = None

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Use VertexAIChatPromptExecutionSettings when calling VertexAIChatCompletion, especially with function calling enabled.
  2. Let the service coerce settings by passing a dict or using get_prompt_execution_settings_from_settings, or instantiate the correct subclass directly.
  3. Register the Vertex service under a dedicated service_id and request its matching settings class from the kernel.

Example fix

# before
settings = PromptExecutionSettings()  # or OpenAIChatPromptExecutionSettings
# after
from semantic_kernel.connectors.ai.google.vertex_ai.vertex_ai_prompt_execution_settings import VertexAIChatPromptExecutionSettings
settings = VertexAIChatPromptExecutionSettings()
Defensive patterns

Strategy: type-guard

Validate before calling

from semantic_kernel.connectors.ai.google.vertex_ai.vertex_ai_prompt_execution_settings import VertexAIChatPromptExecutionSettings
assert isinstance(settings, VertexAIChatPromptExecutionSettings), 'Use VertexAIChatPromptExecutionSettings for Vertex AI function calling'

Type guard

def is_vertex_settings(settings) -> bool:
    from semantic_kernel.connectors.ai.google.vertex_ai.vertex_ai_prompt_execution_settings import VertexAIChatPromptExecutionSettings
    return isinstance(settings, VertexAIChatPromptExecutionSettings)

Prevention

When it happens

Trigger: 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.

Common situations: Reusing execution settings created for another provider across connectors. Passing a base PromptExecutionSettings instead of the Vertex-specific subclass when configuring kernel function invocation.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/ad121b74fe510a5f. Report an issue: GitHub.