Repository navigation
fix(responses): omit tool strict when not provided - #50184
Open
garbagecodes wants to merge 1 commit into
Open
garbagecodes wants to merge 1 commit into
garbagecodes wants to merge 1 commit into
Conversation
garbagecodes
force-pushed
the
litellm_fix_responses_tool_strict
branch
from
November 5, 2026 07:27
28bc133 to
491c020
Compare
4 of 6 tasks
This branch has not been deployed
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.
Summary
When a Responses request omits
stricton a function tool, the Chat bridge currently addsfunction.strict: false.This change ensures that
function.strictis only included whenstrictis explicitly provided, preserving explicittrueandfalsevalues.Problem
The Responses API and Chat Completions API have different default behaviors for function tool strict mode.
When
strictis omitted, the Responses API attempts to normalize compatible schemas into strict mode, while Chat Completions defaults to non-strict mode.Previously, the Responses-to-Chat conversion used
get("strict", False), which converted an omitted field into an explicitfalse. This prevented the upstream provider from distinguishing between an omitted field and an explicitly disabled strict mode.Solution
function.strictwhen the input tool explicitly containsstrict.trueandfalsevalues.Testing
The regression test fails for the omitted
strictcase with the original implementation and passes with this change.Caveats
This change preserves field omission during conversion but does not fully emulate the Responses API's automatic schema normalization.
For Chat-only upstream providers, an omitted
function.strictis still handled according to the upstream provider's own defaults.