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
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: Tabular SK analysis: multi-endpoint DeploymentNotFound 404 and Python 3.13 Optional[str] type error (#891)
Branch:
fix/tabular-sk-multiendpoint-py313-optional→DevelopmentCloses #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.1model configured via the multi-endpoint feature.Fix 1 — DeploymentNotFound 404 with multi-endpoint models (v0.241.008)
Problem
run_tabular_sk_analysisalways built its Semantic KernelAzureChatCompletionservice 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_analysisandrun_tabular_analysis_with_multi_file_support:gpt_endpointgpt_api_version_overridegpt_authtype,api_key,tenant_id, etc.)gpt_provideraoai,aifoundry, etc.)When
gpt_authandgpt_endpointare provided, SK buildsAzureChatCompletionfrom the resolved credentials instead of the legacy defaults. All three auth types are handled (api_key,service_principal,managed_identity). All four call sites inroute_backend_chats.py(two non-streaming, two streaming) were updated to pass the overrides whenmulti_endpoint_configis active.Fix 2 —
FunctionExecutionExceptionforOptional[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:
Semantic Kernel's
_parse_parametercoerces LLM arguments by callingparam_type(value). On Python 3.13,Optional[str](=Union[str, None]) is not callable — raisingTypeError: Cannot instantiate typing.Union. Affected parameters:sheet_name,sheet_index,source_sheet_index,target_sheet_indexacross 12 kernel functions.Fix
Changed all affected
Annotated[Optional[str], ...]parameter annotations toAnnotated[str, ...]. Default values remain= Noneand all internal helpers already treatNone/""as "not provided", so runtime behaviour is unchanged when the LLM omits the parameter.Files changed
application/single_app/route_backend_chats.pyapplication/single_app/semantic_kernel_plugins/tabular_processing_plugin.pyOptional[str]→strin all kernel functionAnnotatedparamsdocs/explanation/fixes/v0.241.008/TABULAR_SK_MULTIENDPOINT_AND_PY313_OPTIONAL_FIX.mdapplication/single_app/config.py0.241.008Testing
gpt-5.1on a separate Azure OpenAI endpoint with a 1189-row NIST SP-800-53 Excel file.sheet_name/sheet_indextool calls succeed on Python 3.13 with noFunctionExecutionException.