Skip to content

Commit 82a64b3

Browse files
[Bugfix] fixed deepseekv32 tool calling error (#30025)
Signed-off-by: chaunceyjiang <[email protected]> Co-authored-by: Cyrus Leung <[email protected]>
1 parent 9ae2f60 commit 82a64b3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

vllm/tokenizers/deepseek_v32_encoding.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ def tool_calls_to_openai_format(tool_calls):
9595
def encode_arguments_to_dsml(tool_call: dict[str, str]) -> str:
9696
p_dsml_template = """<{dsml_token}parameter name="{key}" string="{is_str}">{value}</{dsml_token}parameter>"""
9797
P_dsml_strs = []
98-
99-
arguments = json.loads(tool_call["arguments"])
98+
if isinstance(tool_call["arguments"], str):
99+
arguments = json.loads(tool_call["arguments"])
100+
else:
101+
arguments = tool_call["arguments"]
100102

101103
for k, v in arguments.items():
102104
p_dsml_str = p_dsml_template.format(

vllm/tokenizers/deepseekv32.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ def apply_chat_template(self, messages, tools=None, **kwargs):
4343
thinking_mode = "thinking"
4444
if not thinking:
4545
thinking_mode = "chat"
46-
messages = messages.copy()
46+
conversation = kwargs.get("conversation", messages)
47+
messages = conversation.copy()
4748
drop_thinking = True
4849
if tools is not None and len(tools) > 0:
4950
messages.insert(0, {"role": "system"})

0 commit comments

Comments
 (0)