mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-01 02:02:20 +00:00
fix(deepseek): use registry-first check in _is_always_on_reasoner with string fallback
Addresses Greptile P1: replaces pure string-pattern detection with a registry- first approach. supports_reasoning() is called first (deepseek-reasoner and R1 variants have supports_reasoning: true in the model registry; V4 opt-in models like deepseek-chat do not). String patterns remain as fallback for unregistered or custom-deployment model names. New always-on models can be handled by adding a registry entry, without touching transformation code.
This commit is contained in:
parent
2d05765955
commit
7cd1ce5f4a
1 changed files with 14 additions and 0 deletions
|
|
@ -143,7 +143,21 @@ class DeepSeekChatConfig(OpenAIGPTConfig):
|
|||
Returns True for models with always-on thinking (deepseek-reasoner, R1 variants).
|
||||
These models reject reasoning_effort, thinking: {"type": "disabled"}, and
|
||||
require reasoning_content on every assistant message unconditionally.
|
||||
|
||||
Uses the litellm model registry (supports_reasoning field) as the primary
|
||||
signal — deepseek-reasoner and R1 variants have supports_reasoning: true while
|
||||
V4 opt-in models (deepseek-chat, deepseek-v3, etc.) do not. Falls back to
|
||||
string-pattern matching for unregistered or custom-deployment model names.
|
||||
"""
|
||||
# Primary: registry-based check
|
||||
try:
|
||||
from litellm.utils import supports_reasoning
|
||||
|
||||
if supports_reasoning(model=model, custom_llm_provider="deepseek"):
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
# Fallback: string patterns for unregistered variants / custom deployments
|
||||
m = model.lower()
|
||||
return "reasoner" in m or "-r1" in m or "/r1" in m
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue