Skip to content

Fix tool_choice rejection in thinking-mode providers#3

Open
shagghiesuperstar wants to merge 1 commit into
ajsai47:mainfrom
shagghiesuperstar:fix/thinking-mode-tool-choice
Open

Fix tool_choice rejection in thinking-mode providers#3
shagghiesuperstar wants to merge 1 commit into
ajsai47:mainfrom
shagghiesuperstar:fix/thinking-mode-tool-choice

Conversation

@shagghiesuperstar

Copy link
Copy Markdown

Summary

Some providers (DeepSeek V4, Qwen3 with thinking mode enabled) reject tool_choice with a 400 error because the thinking process conflicts with the forced tool choice parameter.

Fix

  • Added a guard in build_nim_payload() that strips tool_choice from the payload when the model name contains "thinking" or when PROVIDER_DISABLE_TOOL_CHOICE=true is set in the environment
  • Added provider_disable_tool_choice: bool = False to Settings in config.py for explicit override

Changes

  • src/proxy/config.py — new setting provider_disable_tool_choice
  • src/proxy/translate.py — guard after oai_tools block omits tool_choice for thinking-mode providers

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