fix(deepseek): update reasoning_effort handling to disable thinking when set to 'none'

This commit is contained in:
Bao Nguyen 2026-05-03 23:02:03 -07:00
parent c011a7e3ba
commit 6068bdf3e8
2 changed files with 9 additions and 6 deletions

View file

@ -56,9 +56,12 @@ class DeepSeekChatConfig(OpenAIGPTConfig):
# DeepSeek only accepts {"type": "enabled"}, ignore budget_tokens
optional_params["thinking"] = {"type": "enabled"}
# Handle reasoning_effort - map to thinking enabled
elif reasoning_effort is not None and reasoning_effort != "none":
optional_params["thinking"] = {"type": "enabled"}
# Handle reasoning_effort - map to thinking enabled/disabled
elif reasoning_effort is not None:
if reasoning_effort != "none":
optional_params["thinking"] = {"type": "enabled"}
else:
optional_params["thinking"] = {"type": "disabled"}
return optional_params

View file

@ -93,8 +93,8 @@ class TestDeepSeekThinkingParams:
assert result["thinking"] == {"type": "enabled"}
def test_map_reasoning_effort_none_does_not_enable_thinking(self):
"""Test that reasoning_effort='none' does not enable thinking."""
def test_map_reasoning_effort_none_disables_thinking(self):
"""Test that reasoning_effort='none' sets thinking to disabled."""
non_default_params = {"reasoning_effort": "none"}
optional_params = {}
@ -105,7 +105,7 @@ class TestDeepSeekThinkingParams:
drop_params=False,
)
assert "thinking" not in result
assert result["thinking"] == {"type": "disabled"}
def test_map_reasoning_effort_null_does_not_enable_thinking(self):
"""Test that reasoning_effort=None does not enable thinking."""