[Misc] Provide a DeepSeek ReasoningParser with thinking enabled by default (#33221)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
This commit is contained in:
Chauncey
2026-01-28 21:16:53 +08:00
committed by GitHub
parent 2e8de86777
commit 8e5e40daf4
6 changed files with 25 additions and 192 deletions
@@ -70,3 +70,19 @@ class DeepSeekV3ReasoningParser(ReasoningParser):
current_token_ids,
delta_token_ids,
)
class DeepSeekV3ReasoningWithThinkingParser(DeepSeekV3ReasoningParser):
"""
DeepSeekV3ReasoningParser that defaults to thinking mode.
"""
def __init__(self, tokenizer: PreTrainedTokenizerBase, *args, **kwargs):
chat_kwargs = kwargs.get("chat_template_kwargs", {}) or {}
thinking = chat_kwargs.get("thinking", None)
enable_thinking = chat_kwargs.get("enable_thinking", None)
if thinking is None and enable_thinking is None:
chat_kwargs["thinking"] = True
chat_kwargs["enable_thinking"] = True
kwargs["chat_template_kwargs"] = chat_kwargs
super().__init__(tokenizer, *args, **kwargs)