fix(deepseek): map reasoning_effort=none to thinking disabled - #27608
fix(deepseek): map reasoning_effort=none to thinking disabled#27608Jwrede wants to merge 1 commit into
Conversation
DeepSeek V4 defaults to thinking mode when no thinking parameter is
set. When a user passes reasoning_effort="none", LiteLLM should
explicitly send thinking={"type": "disabled"} to turn off reasoning.
Previously, reasoning_effort="none" was silently ignored, leaving
the model in its default thinking-enabled state.
Also passes through thinking={"type": "disabled"} when set directly,
which was previously dropped by the enabled-only filter.
Fixes BerriAI#27453
Greptile SummaryThis PR fixes two gaps in DeepSeek's thinking-parameter mapping:
Confidence Score: 4/5Safe to merge; the change correctly extends an if/elif guard to handle the disabled path and is fully covered by new unit tests. The logic change is small and well-targeted: a tuple membership check replaces the single-value equality, and a new branch maps "none" to {"type": "disabled"}. Tests cover all five relevant cases. The only open item is a one-line docstring that still describes the old behaviour. No files require special attention beyond the minor docstring fix in transformation.py.
|
| Filename | Overview |
|---|---|
| litellm/llms/deepseek/chat/transformation.py | Fixes silent drop of reasoning_effort="none" and thinking: {type: "disabled"} by adding the disabled path; logic is correct and the inline docstring needs a one-line update. |
| tests/test_litellm/llms/deepseek/test_deepseek_chat_transformation.py | New unit tests covering all four new/changed code paths (disabled, enabled, budget_tokens stripping, no-op case); all mocked, no network calls. |
| tests/test_litellm/llms/deepseek/init.py | Empty __init__.py to make the new test directory a Python package. |
Comments Outside Diff (1)
-
litellm/llms/deepseek/chat/transformation.py, line 35-36 (link)The inline docstring is now out of date — it still says DeepSeek only accepts
{"type": "enabled"}, but the code now also accepts and forwards{"type": "disabled"}.
Reviews (1): Last reviewed commit: "fix(deepseek): map reasoning_effort=none..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Summary
reasoning_effort="none"is passed, DeepSeek V4 now receivesthinking: {"type": "disabled"}instead of silently ignoring the value and leaving the model in its default thinking-enabled state.thinking: {"type": "disabled"}when set directly, which was previously dropped by the enabled-only filter.Test plan
test_reasoning_effort_none_disables_thinking-- verifiesreasoning_effort="none"maps tothinking: {"type": "disabled"}test_reasoning_effort_high_enables_thinking-- verifies non-none values still enable thinkingtest_thinking_disabled-- verifies directthinking: {"type": "disabled"}is passed throughtest_thinking_strips_budget_tokens-- verifiesbudget_tokensis stripped (DeepSeek does not support it)test_no_thinking_params_leaves_thinking_unset-- verifies no thinking param when neither is setFixes #27453