Skip to content

Commit 63c0a39

Browse files
committed
[Frontend] supports deepseekv32 chat template
Signed-off-by: chaunceyjiang <[email protected]>
1 parent 912afb0 commit 63c0a39

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

vllm/tokenizers/deepseekv32.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,17 @@ def from_pretrained(
3939
return DeepseekV32Tokenizer(tokenizer)
4040

4141
def apply_chat_template(self, messages, tools=None, **kwargs):
42-
thinking = kwargs.get("thinking", True)
42+
thinking = kwargs.get("thinking", False)
4343
thinking_mode = "thinking"
4444
if not thinking:
4545
thinking_mode = "chat"
46-
47-
encode_config = dict(
48-
thinking_mode=thinking_mode, drop_thinking=False, add_default_bos_token=True
49-
)
50-
messages.insert(
51-
0,
52-
{
53-
"role": "system",
54-
"content": "You are a helpful Assistant.",
55-
"tools": tools if tools is not None else [],
56-
},
57-
)
46+
messages = messages.copy()
47+
drop_thinking = True
48+
if tools is not None and len(tools) > 0:
49+
messages.insert(0, {"role": "system"})
50+
messages[0]["tools"] = tools
51+
drop_thinking = False
52+
encode_config = dict(thinking_mode=thinking_mode, drop_thinking=drop_thinking)
5853
prompt_str = encode_messages(messages, **encode_config) # type: ignore
5954
return prompt_str
6055

0 commit comments

Comments
 (0)