.Net: Fix #13232: Add empty parameters schema for NonInvocableTool placeholder #13278
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.
Motivation and Context
Why is this change required?
NonInvocableTool placeholder is created without a parameters field, which causes 422 errors when used with Mistral models via LiteLLM since Mistral enforces stricter JSON schema validation than other AI providers.
What problem does it solve?
Current Issue:
When Semantic Kernel has no invocable tools but needs to send tools to keep the service happy, it includes the NonInvocableTool placeholder. This lacks a parameters field, causing Mistral APIs to reject requests.
What scenario does it contribute to?
This fix enables SK to work with:
Use Cases:
Applications using Mistral as their AI provider
Enterprise applications with strict API validation requirements
Description
Solution
Updated the NonInvocableTool creation to include a proper empty parameters schema that satisfies Mistral's validation requirements while maintaining backward compatibility with all other providers
Changes Made
File: src/Connectors/Connectors.OpenAI/Core/ClientCore.ChatCompletion.cs
Line 61-64: Enhanced s_nonInvocableFunctionTool with proper parameters schema
Added: Comprehensive unit tests verifying schema structure and Mistral compatibility
Existing Tests: All 474 OpenAI connector tests pass (1 skipped)
Integration Tests: Verified with local Mistral via Ollama + LiteLLM
Backward Compatibility: Confirmed no breaking changes with OpenAI and other providers
Note: I 've noticed that this similar empty schema is used as a property called
s_zeroFunctionParametersSchemathat exists atOpenAIFunction.csContribution Checklist