Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

feat: add with_non_strict_tools() opt-out on Responses API models#1897

Open
ehayes2000 wants to merge 1 commit into
0xPlaygrounds:mainfrom
macro-inc:feat/responses-api-non-strict-tools
Open

feat: add with_non_strict_tools() opt-out on Responses API models#1897
ehayes2000 wants to merge 1 commit into
0xPlaygrounds:mainfrom
macro-inc:feat/responses-api-non-strict-tools

Conversation

@ehayes2000

Copy link
Copy Markdown

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_tools

This PR adds with_non_strict_tools to 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

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>
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.

1 participant