Skip to content

[Bug] Tabular SK analysis: multi-endpoint DeploymentNotFound 404 and Python 3.13 Optional[str] type error #891

@vivche

Description

@vivche

Two related issues were identified and resolved in this release while diagnosing why tabular SK analysis was falling back to "schema context instead" when querying an Excel file (NIST SP-800-53) using a multi-endpoint model (gpt-5.1).


Issue 1 — Tabular SK Analysis: DeploymentNotFound 404 with Multi-Endpoint Models

Issue

When a user selected a model via the multi-endpoint model feature (e.g. a gpt-5.1 deployment hosted on a different Azure OpenAI endpoint than the default), the Semantic Kernel tabular analysis would silently fail with:

[Tabular SK Analysis] Attempt 1 synthesis failed after tool execution setup:
NotFoundError("Error code: 404 - {'error': {'code': 'DeploymentNotFound',
'message': 'The API deployment for this resource does not exist...'}}")

The analysis then fell back to returning only schema/preview context, producing degraded responses with no actual data analysis.

Root Cause

run_tabular_sk_analysis always built its AzureChatCompletion Semantic Kernel service using settings.get('azure_openai_gpt_endpoint') — the default/legacy endpoint stored in app settings.

When the main chat route resolved a multi-endpoint model, it unpacked:

gpt_client, gpt_model, gpt_provider, gpt_endpoint, gpt_auth, gpt_api_version = multi_endpoint_config

The resolved gpt_model (gpt-5.1) was passed to the tabular analysis, but gpt_endpoint and gpt_auth were not — so SK tried to call gpt-5.1 at the wrong (legacy) endpoint, which returned a 404.

Issue 2 — Tabular SK Plugin: FunctionExecutionException for Optional[str] Parameters on Python 3.13

Issue

After the endpoint fix allowed SK to successfully reach the model, tool invocations immediately failed with:

semantic_kernel.exceptions.function_exceptions.FunctionExecutionException:
Parameter sheet_name is expected to be parsed to typing.Optional[str] but is not.

TypeError: Cannot instantiate typing.Union

The same error appeared for sheet_index, source_sheet_index, and target_sheet_index parameters across multiple kernel functions.

Root Cause

Semantic Kernel's _parse_parameter (in kernel_function_from_method.py) coerces LLM-provided string arguments by calling param_type(value). When param_type is Optional[str] (which is Union[str, None]), Python 3.13 raises TypeError: Cannot instantiate typing.Union — SK cannot instantiate the Union type itself.

The affected parameters were typed as Annotated[Optional[str], "description"] in the @kernel_function decorated methods of TabularProcessingPlugin. SK successfully registered these functions but failed at invocation time when the LLM passed a value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Pending Evaluation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions