Skip to content

Conversation

@icyca
Copy link
Contributor

@icyca icyca commented Oct 21, 2025

Motivation and Context

  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

  1. Fixes: .Net: Bug: Internal 'NonInvocableTool' produces a ChatTool with parameters=null, leading to incompatibility with Mistral #13232

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_zeroFunctionParametersSchema that exists at OpenAIFunction.cs

Contribution Checklist

… placeholder

- Updated the `s_nonInvocableFunctionTool` to include a function description and parameters schema for better clarity and compatibility.
- Added unit tests to validate the parameters schema of `NonInvocableTool`, ensuring it meets Mistral's requirements and does not cause errors with Mistral APIs
@icyca icyca requested a review from a team as a code owner October 21, 2025 15:32
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Oct 21, 2025
@github-actions github-actions bot changed the title Fix #13232: Add empty parameters schema for NonInvocableTool placeholder .Net: Fix #13232: Add empty parameters schema for NonInvocableTool placeholder Oct 21, 2025
@icyca
Copy link
Contributor Author

icyca commented Oct 21, 2025

@microsoft-github-policy-service agree

@icyca
Copy link
Contributor Author

icyca commented Oct 21, 2025

Hello, what are these 3 pending checks?

@dmytrostruk dmytrostruk enabled auto-merge November 3, 2025 15:57
@dmytrostruk dmytrostruk added this pull request to the merge queue Nov 3, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 3, 2025
@dmytrostruk dmytrostruk added this pull request to the merge queue Nov 3, 2025
Merged via the queue into microsoft:main with commit 13e7582 Nov 3, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.Net: Bug: Internal 'NonInvocableTool' produces a ChatTool with parameters=null, leading to incompatibility with Mistral

4 participants