mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
test(deepseek): reasoning_effort passthrough coverage
This commit is contained in:
parent
00a1c311e3
commit
43f319b57f
1 changed files with 41 additions and 0 deletions
41
tests/llm_translation/test_deepseek_reasoning_effort.py
Normal file
41
tests/llm_translation/test_deepseek_reasoning_effort.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"""Verify DeepSeek `reasoning_effort` passes through the transformation.
|
||||
|
||||
Covers the fix that preserves the effort value (low/medium/high/xhigh/max) into
|
||||
the request body when thinking is on, instead of mapping it to a binary thinking
|
||||
toggle and discarding it. See https://api-docs.deepseek.com/guides/thinking_mode
|
||||
"""
|
||||
from litellm.llms.deepseek.chat.transformation import DeepSeekChatConfig
|
||||
|
||||
|
||||
def _map(non_default_params, drop_params=True):
|
||||
cfg = DeepSeekChatConfig()
|
||||
return cfg.map_openai_params(non_default_params, {}, "deepseek/deepseek-v4-flash", drop_params)
|
||||
|
||||
|
||||
def test_reasoning_effort_low_passes_through():
|
||||
out = _map({"reasoning_effort": "low"})
|
||||
assert out["reasoning_effort"] == "low"
|
||||
assert out["thinking"] == {"type": "enabled"}
|
||||
|
||||
|
||||
def test_reasoning_effort_max_passes_through():
|
||||
out = _map({"reasoning_effort": "max"})
|
||||
assert out["reasoning_effort"] == "max"
|
||||
assert out["thinking"] == {"type": "enabled"}
|
||||
|
||||
|
||||
def test_reasoning_effort_none_disables_thinking():
|
||||
out = _map({"reasoning_effort": "none"})
|
||||
assert out["thinking"] == {"type": "disabled"}
|
||||
assert "reasoning_effort" not in out
|
||||
|
||||
|
||||
def test_explicit_thinking_disabled_wins_and_drops_effort():
|
||||
out = _map({"thinking": {"type": "disabled"}, "reasoning_effort": "low"})
|
||||
assert out["thinking"] == {"type": "disabled"}
|
||||
assert "reasoning_effort" not in out
|
||||
|
||||
|
||||
def test_no_reasoning_effort_leaves_no_key():
|
||||
out = _map({})
|
||||
assert out.get("reasoning_effort") is None
|
||||
Loading…
Add table
Reference in a new issue