Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions vllm/entrypoints/harmony_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ def parse_chat_input(chat_msg) -> list[Message]:
tool_calls = chat_msg.get("tool_calls")
if role == "assistant" and tool_calls:
msgs: list[Message] = []
content = chat_msg.get("content") or ""
analysis_msg = Message.from_role_and_content(Role.ASSISTANT, content)
analysis_msg = analysis_msg.with_channel("analysis")
msgs.append(analysis_msg)

for call in tool_calls:
func = call.get("function", {})
name = func.get("name", "")
Expand All @@ -265,9 +270,13 @@ def parse_chat_input(chat_msg) -> list[Message]:
if isinstance(item, dict) and item.get("type") == "text"
)

msg = Message.from_author_and_content(
Author.new(Role.TOOL, f"functions.{name}"), content
).with_channel("commentary")
msg = (
Message.from_author_and_content(
Author.new(Role.TOOL, f"functions.{name}"), content
)
.with_channel("commentary")
.with_recipient("assistant")
)
return [msg]

# Default: user/assistant/system messages with content
Expand Down