Skip to content

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

Open
vivche wants to merge 8 commits intomicrosoft:Developmentfrom
vivche:fix/tabular-sk-multiendpoint-py313-optional
Open

fix: Tabular SK analysis: multi-endpoint DeploymentNotFound 404 and Python 3.13 Optional[str] type error (#891)#892
vivche wants to merge 8 commits intomicrosoft:Developmentfrom
vivche:fix/tabular-sk-multiendpoint-py313-optional

Conversation

@vivche
Copy link
Copy Markdown
Contributor

@vivche vivche commented May 8, 2026

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

Branch: fix/tabular-sk-multiendpoint-py313-optionalDevelopment

Closes #891


Summary

Two related bugs were identified and fixed while diagnosing why tabular SK analysis silently degraded to schema-only responses when querying an Excel file (NIST SP-800-53) using a gpt-5.1 model configured via the multi-endpoint feature.


Fix 1 — DeploymentNotFound 404 with multi-endpoint models (v0.241.008)

Problem

run_tabular_sk_analysis always built its Semantic Kernel AzureChatCompletion service from the default app-settings endpoint (azure_openai_gpt_endpoint). When the active chat model was resolved through the multi-endpoint feature, only the model name was forwarded to the tabular analysis — the resolved endpoint URL and auth credentials were dropped. SK then attempted to call the multi-endpoint deployment at the wrong endpoint, receiving a 404, and silently fell back to returning schema context only.

Fix

Added four optional override parameters to run_tabular_sk_analysis and run_tabular_analysis_with_multi_file_support:

Parameter Purpose
gpt_endpoint Resolved endpoint URL for the active model
gpt_api_version_override API version for the active endpoint
gpt_auth Auth config dict (type, api_key, tenant_id, etc.)
gpt_provider Provider type for scope resolution (aoai, aifoundry, etc.)

When gpt_auth and gpt_endpoint are provided, SK builds AzureChatCompletion from the resolved credentials instead of the legacy defaults. All three auth types are handled (api_key, service_principal, managed_identity). All four call sites in route_backend_chats.py (two non-streaming, two streaming) were updated to pass the overrides when multi_endpoint_config is active.


Fix 2 — FunctionExecutionException for Optional[str] params on Python 3.13 (v0.241.009)

Problem

After the endpoint fix allowed SK to reach the correct model, tool calls immediately failed with:

FunctionExecutionException: Parameter sheet_name is expected to be parsed to
typing.Optional[str] but is not.
TypeError: Cannot instantiate typing.Union

Semantic Kernel's _parse_parameter coerces LLM arguments by calling param_type(value). On Python 3.13, Optional[str] (= Union[str, None]) is not callable — raising TypeError: Cannot instantiate typing.Union. Affected parameters: sheet_name, sheet_index, source_sheet_index, target_sheet_index across 12 kernel functions.

Fix

Changed all affected Annotated[Optional[str], ...] parameter annotations to Annotated[str, ...]. Default values remain = None and all internal helpers already treat None/"" as "not provided", so runtime behaviour is unchanged when the LLM omits the parameter.


Files changed

File Change
application/single_app/route_backend_chats.py Multi-endpoint endpoint/auth pass-through for tabular SK analysis
application/single_app/semantic_kernel_plugins/tabular_processing_plugin.py Optional[str]str in all kernel function Annotated params
docs/explanation/fixes/v0.241.008/TABULAR_SK_MULTIENDPOINT_AND_PY313_OPTIONAL_FIX.md Fix documentation
application/single_app/config.py Version bumped to 0.241.008

Testing

  • Tested against gpt-5.1 on a separate Azure OpenAI endpoint with a 1189-row NIST SP-800-53 Excel file.
  • Fix 1 confirmed: tabular SK analysis now reaches the correct endpoint and returns actual data rows instead of schema-only fallback.
  • Fix 2 confirmed: sheet_name/sheet_index tool calls succeed on Python 3.13 with no FunctionExecutionException.

Chen, Vivien added 8 commits March 4, 2026 23:28
…ntent

- Rename all spec files to use sample_ prefix for consistency
- Convert asset spec files from .json to .yaml format
- Sync spec content (security, components, paths) with Cosmos DB source of truth
- Replace hardcoded dev222288 instance URL with YOUR-INSTANCE placeholder
- Add missing sysparm_input_display_value param to incident update operation
- Expand updateIncident requestBody with full field set and descriptions
- Alphabetize Incident and Asset schema properties across all specs
- Update SERVICENOW_ASSET_MANAGEMENT_SETUP.md links to new filenames/paths
…agent prompts

- Replace passive 'extract the INSTANCE part' guidance with explicit step-by-step
  instructions for deriving the real instance subdomain from the plugin base URL
- Add SELF-CHECK rule: never output 'INSTANCE', 'YOUR-INSTANCE', or 'yourinstance'
  as placeholder text in any displayed URL
- Rewrite HOW TO EXTRACT section to use generic [instance-name] pattern (template-friendly)
  with dev222288 kept only as a concrete example
- Apply consistent wording to both servicenow_agent_instructions.txt and
  servicenow_kb_management_agent_instructions.txt
… stats queries

- Switch all stats date filters from sys_created_on to opened_at to match portal counts
- Add YEAR QUERY RULE: named year always uses YYYY-MM-DD range, never 'This year'
- Add two-call pattern for breakdowns: grand total + grouped (handles null-category records)
- Replace ASCII bar chart with markdown table (avoids rendering as solid black boxes)
- Add (No category) row handling for blank groupby_value responses
- Enforce exact table structure: single Total row, no split totals
- Fix text search to always query both short_description AND description fields
- Update OpenAPI spec to match: opened_at for stats, dual-field text search, sysparm_count required=true
- Add FIELD RULE explaining opened_at vs sys_created_on distinction
Fix 1: run_tabular_sk_analysis always used the default Azure OpenAI endpoint
from app settings, causing DeploymentNotFound 404 when the active chat model
was resolved via the multi-endpoint feature. Added gpt_endpoint,
gpt_api_version_override, gpt_auth, and gpt_provider override parameters to
run_tabular_sk_analysis and run_tabular_analysis_with_multi_file_support, and
updated all four call sites to pass multi-endpoint credentials when active.

Fix 2: Semantic Kernel's KernelArguments type-coercion on Python 3.13 raises
FunctionExecutionException for Optional[str] parameters typed as
'typing.Optional[str]'. Updated all Optional[str] kernel function parameters
in tabular_processing_plugin.py to use 'str | None' union syntax which is
natively supported in Python 3.13.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant