You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.Net: Fix#13232: Add empty parameters schema for NonInvocableTool placeholder (#13278)
### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
1. Why is this change required?
2. What problem does it solve?
3. What scenario does it contribute to?
4. If it fixes an open issue, please link to the issue here.
-->
1. 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.
2. 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.
3. What scenario does it contribute to?
This fix enables SK to work with:
- Mistral cloud APIs
- Any AI provider with strict schema validation requirements
Use Cases:
Applications using Mistral as their AI provider
Enterprise applications with strict API validation requirements
4. Fixes: #13232
### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
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_zeroFunctionParametersSchema` that exists at
`OpenAIFunction.cs`
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
Co-authored-by: Roger Barreto <19890735+rogerbarreto@users.noreply.github.com>
0 commit comments