Skip to content

Translate Chat Completions tool_choice to the Responses API shape - #129

Open
jaydenireland wants to merge 1 commit into
RayBytes:mainfrom
jaydenireland:iss128
Open

jaydenireland wants to merge 1 commit into
RayBytes:mainfrom
jaydenireland:iss128

Conversation

@jaydenireland

Copy link
Copy Markdown

Closes #128.

Forced tool choices sent as {"type":"function","function":{"name":...}} were forwarded to the Responses API untouched, which rejects them with "Missing required parameter: 'tool_choice.name'". "required" was also outside the allowed string list and silently downgraded to "auto".

Add convert_tool_choice_chat_to_responses in utils.py, use it in both the OpenAI and Ollama routes (including the responses_tools retry path), and accept "required" in start_upstream_request.

Closes RayBytes#128.

Forced tool choices sent as {"type":"function","function":{"name":...}}
were forwarded to the Responses API untouched, which rejects them with
"Missing required parameter: 'tool_choice.name'". "required" was also
outside the allowed string list and silently downgraded to "auto".

Add convert_tool_choice_chat_to_responses in utils.py, use it in both
the OpenAI and Ollama routes (including the responses_tools retry path),
and accept "required" in start_upstream_request.
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.

Forced tool_choice on /v1/chat/completions is forwarded in Chat Completions shape and rejected upstream (400)

1 participant