fix: default converted Responses API function tools to strict=false (#30046)

Fixes #27750

When a model runs on the Responses API, every Chat Completions style tool (workspace tools, MCP and OpenAPI servers) is converted to the Responses tool shape. Only an explicit strict value was carried over, so tools without one were sent with strict omitted. Chat Completions defaults strict to false, the Responses API defaults it to true, so the conversion silently switched loose schemas into strict mode. The model then filled every optional property (empty strings, zeros, false, empty arrays) and combined mutually exclusive filters, and those arguments went to the tool unchanged. Search and filter tools received meaningful values where omission was intended and rejected the call or returned wrong results.

The converter now defaults strict to false when the source tool does not set it. Explicit true or false values are still preserved and already native Responses tools are passed through untouched, matching what the same tool definition gets on Chat Completions.
This commit is contained in:
Classic298 2026-09-16 16:19:08 +02:00 committed by GitHub
parent 4611394fa6
commit 82da9093aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1417,8 +1417,8 @@ def convert_to_responses_payload(payload: dict) -> dict:
converted_tool['description'] = func['description']
if 'parameters' in func:
converted_tool['parameters'] = func['parameters']
if 'strict' in func:
converted_tool['strict'] = func['strict']
# Responses defaults strict to true, Chat Completions to false
converted_tool['strict'] = func.get('strict', False)
converted_tools.append(converted_tool)
else:
# Already in correct format or unknown format, pass through