[DeepSeek V3.2] Proper drop_thinking logic (#30490)

Signed-off-by: Vladislav Nosivskoy <vladnosiv@gmail.com>
This commit is contained in:
Vladislav Nosivskoy 2025-12-12 18:01:06 +03:00 committed by GitHub
parent 3e41992fec
commit 3e34adcdfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,11 +47,13 @@ class DeepseekV32Tokenizer(HfTokenizer):
thinking_mode = "chat"
conversation = kwargs.get("conversation", messages)
messages = conversation.copy()
drop_thinking = True
if tools is not None and len(tools) > 0:
messages.insert(0, {"role": "system"})
messages[0]["tools"] = tools
drop_thinking = False
# Historical reasoning content is dropped when a new user message is introduced
drop_thinking = messages[-1]["role"] == "user"
encode_config = dict(thinking_mode=thinking_mode, drop_thinking=drop_thinking)
prompt_str = encode_messages(messages, **encode_config) # type: ignore
return prompt_str