Skip to content

fix(responses): omit tool strict when not provided - #50184

Open
garbagecodes wants to merge 1 commit into
BerriAI:mainfrom
garbagecodes:litellm_fix_responses_tool_strict
Open

garbagecodes wants to merge 1 commit into
BerriAI:mainfrom
garbagecodes:litellm_fix_responses_tool_strict

Conversation

@garbagecodes

@garbagecodes garbagecodes commented Nov 5, 2026 •

Copy link
Copy Markdown

Summary

When a Responses request omits strict on a function tool, the Chat bridge currently adds function.strict: false.

This change ensures that function.strict is only included when strict is explicitly provided, preserving explicit true and false values.

Problem

The Responses API and Chat Completions API have different default behaviors for function tool strict mode.

When strict is 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 explicit false. This prevented the upstream provider from distinguishing between an omitted field and an explicitly disabled strict mode.

Solution

  • Only include function.strict when the input tool explicitly contains strict.
  • Preserve explicitly provided true and false values.
  • Do not change other function tool conversion behavior.

Testing

  • I have added meaningful tests
  • The test file covering my change passes locally
  • My PR passes all required CI/CD checks
  • My PR's scope is as isolated as possible
  • Every automated review on my PR's latest commit has finished

The regression test fails for the omitted strict case 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.strict is still handled according to the upstream provider's own defaults.

@garbagecodes garbagecodes changed the title Litellm fix responses tool strict fix(responses): omit tool strict when not provided Nov 5, 2026
@CLAassistant

CLAassistant commented Nov 5, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants