Skip to content
Discussion options

You must be logged in to vote

Update / Workaround found

After digging into this further, I discovered that the issue only occurs when using the ChatRequest constructor that includes the tools parameter, even if tools is explicitly set to null.

The following causes the error:
// This triggers tool_choice = "none", which causes the API to reject the request
new ChatRequest(messages, tools: null, model: "gpt-4o");'

But using the overload that doesn't accept a tools parameter at all works perfectly:
// This avoids the bug entirely
new ChatRequest(messages, model: "gpt-4o");

So until the internal logic is fixed to avoid setting tool_choice when tools == null, the safest workaround is to avoid passing the tools argument ent…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@StephenHodgson
Comment options

Answer selected by StephenHodgson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #479 on July 25, 2025 13:41.