Skip to content

fix(deepseek): map reasoning_effort=none to thinking disabled - #27608

Closed
Jwrede wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
Jwrede:fix/deepseek-reasoning-effort-none
Closed

fix(deepseek): map reasoning_effort=none to thinking disabled#27608
Jwrede wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
Jwrede:fix/deepseek-reasoning-effort-none

Conversation

@Jwrede

@Jwrede Jwrede commented May 10, 2026

Copy link
Copy Markdown

Summary

  • When reasoning_effort="none" is passed, DeepSeek V4 now receives thinking: {"type": "disabled"} instead of silently ignoring the value and 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.

Test plan

  • test_reasoning_effort_none_disables_thinking -- verifies reasoning_effort="none" maps to thinking: {"type": "disabled"}
  • test_reasoning_effort_high_enables_thinking -- verifies non-none values still enable thinking
  • test_thinking_disabled -- verifies direct thinking: {"type": "disabled"} is passed through
  • test_thinking_strips_budget_tokens -- verifies budget_tokens is stripped (DeepSeek does not support it)
  • test_no_thinking_params_leaves_thinking_unset -- verifies no thinking param when neither is set

Fixes #27453

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-apps

greptile-apps Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two gaps in DeepSeek's thinking-parameter mapping: reasoning_effort="none" now forwards thinking: {"type": "disabled"} instead of being silently dropped, and a directly-supplied thinking: {"type": "disabled"} is no longer filtered out by the enabled-only guard.

  • transformation.py: Replaces the enabled-only if check with a tuple membership test covering both "enabled" and "disabled", and adds the "none" branch in the reasoning_effort handler.
  • New tests: Five focused unit tests cover all code paths (disabled via reasoning_effort, disabled via direct thinking, enabled, budget_tokens stripping, and the no-op case); all use only mocked calls, consistent with the repo's test policy for this folder.

Confidence Score: 4/5

Safe 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.

Important Files Changed

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)

  1. litellm/llms/deepseek/chat/transformation.py, line 35-36 (link)

    P2 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

codecov Bot commented May 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the stale label Aug 9, 2026
@github-actions github-actions Bot closed this Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When reasoning_effort is set to none, thinking should be automatically disabled(for deepseek-v4)

2 participants