Skip to content

[Anthropic] Fix case where anthropic models have tool choice alongside reasoning#125

Merged
knjiang merged 5 commits intomainfrom
ken/add-tool-choice-required-with-reasoning
Feb 24, 2026
Merged

[Anthropic] Fix case where anthropic models have tool choice alongside reasoning#125
knjiang merged 5 commits intomainfrom
ken/add-tool-choice-required-with-reasoning

Conversation

@knjiang
Copy link
Contributor

@knjiang knjiang commented Feb 24, 2026

Before this diff, chat_completions_to_anthropic would emit:

{ 
    "error": "400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Thinking may not be enabled when tool_choice forces tool use.\"},\"request_id\":\"req_011CYTRzwy2T1KfQDz2t7Xg4\"}", "name": "Error" }

@knjiang knjiang changed the title [Anthropic] Fix test case where tool choice is alongside reasoning [Anthropic] Fix case where anthropic models have tool choice alongside reasoning Feb 24, 2026
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by: fix-lint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive-by: fix-lint

@@ -0,0 +1,59 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snapshots are generated straight from params.ts

@@ -0,0 +1,33 @@
{
Copy link
Contributor Author

@knjiang knjiang Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transforms are generated bby taking the payload of params.ts of an openai test case and just swapping the model in for an anthropic/gemini model

they are then recorded in directory of chat_completions_to_x

@knjiang knjiang requested a review from aswink February 24, 2026 21:11
Copy link
Contributor

@aswink aswink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though I wonder if choosing between tool choice and reasoning should be an option somewhere. It's not clear to me that preferring tool choice is always what users will want

@knjiang knjiang merged commit 2698053 into main Feb 24, 2026
5 checks passed
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.

2 participants