diff --git a/litellm/llms/deepseek/chat/transformation.py b/litellm/llms/deepseek/chat/transformation.py index 5cd8d119542..9cadecb196a 100644 --- a/litellm/llms/deepseek/chat/transformation.py +++ b/litellm/llms/deepseek/chat/transformation.py @@ -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 diff --git a/tests/litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py b/tests/litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py index a2f45e7188b..e6f2a9ad023 100644 --- a/tests/litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py +++ b/tests/litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py @@ -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."""