feat: add with_non_strict_tools() opt-out on Responses API models#1897
Open
ehayes2000 wants to merge 1 commit into
Open
feat: add with_non_strict_tools() opt-out on Responses API models#1897ehayes2000 wants to merge 1 commit into
ehayes2000 wants to merge 1 commit into
Conversation
The Responses API path hardcoded strict: true on every function tool converted from a core ToolDefinition and irreversibly sanitized schemas to OpenAI's strict subset (additionalProperties: false, all properties forced into required), silently changing optional parameters into mandatory ones. The Chat Completions path already exposes the inverse knob (with_strict_tools, default off); this adds the opt-out for the Responses path (default on, preserving the existing wire format). Strict mode is decided when the request is built: core ToolDefinitions convert schema-preserving in create_completion_request (via the new verbatim ResponsesToolDefinition::new constructor) and are normalized there only when strict_tools is enabled. Public API behavior is unchanged: ResponsesToolDefinition::function and From<ToolDefinition> still sanitize eagerly, and additional_params tools always use strict mode. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The responses API doesn't include a way to opt out of strict tools. The completions API lets users either use the default (un-strict tools) or opt in with
with_strict_toolsThis PR adds
with_non_strict_toolsto let users opt out of strict tools. This PR also defers schema sanitization until the request is built. These changes are intended to be non-breaking and leave existing public API's untouched