mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-11 01:25:25 +08:00
[frontend] enhance tool_calls type check (#16882)
Signed-off-by: reidliu41 <reid201711@gmail.com> Co-authored-by: reidliu41 <reid201711@gmail.com>
This commit is contained in:
parent
68d4c33202
commit
f34410715f
@ -1095,7 +1095,11 @@ def _parse_chat_message_content(
|
|||||||
if role == 'assistant':
|
if role == 'assistant':
|
||||||
parsed_msg = _AssistantParser(message)
|
parsed_msg = _AssistantParser(message)
|
||||||
|
|
||||||
if "tool_calls" in parsed_msg:
|
# The 'tool_calls' is not None check ensures compatibility.
|
||||||
|
# It's needed only if downstream code doesn't strictly
|
||||||
|
# follow the OpenAI spec.
|
||||||
|
if ("tool_calls" in parsed_msg
|
||||||
|
and parsed_msg["tool_calls"] is not None):
|
||||||
result_msg["tool_calls"] = list(parsed_msg["tool_calls"])
|
result_msg["tool_calls"] = list(parsed_msg["tool_calls"])
|
||||||
elif role == "tool":
|
elif role == "tool":
|
||||||
parsed_msg = _ToolParser(message)
|
parsed_msg = _ToolParser(message)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user