@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 8a19303173
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[BugFix][gpt-oss] Fix Chat Completion with Multiple Output Message (#23318)

Signed-off-by: Chen Zhang <zhangch99@outlook.com>

Chen Zhang committed Aug 21, 2025 at 10:31 UTC 8a19303173881e4197c7656727c6f2b296faa7fc
1 file changed +5 -9
vllm/entrypoints/harmony_utils.py
+5 -9
@@ -329,23 +329,19 @@ def parse_chat_output(
329 token_ids: Sequence[int]) -> tuple[Optional[str], Optional[str], bool]:
330 parser = parse_output_into_messages(token_ids)
331 output_msgs = parser.messages
332 + is_tool_call = False # TODO: update this when tool call is supported
333 if len(output_msgs) == 0:
334 # The generation has stopped during reasoning.
334 - is_tool_call = False
335 reasoning_content = parser.current_content
336 final_content = None
337 elif len(output_msgs) == 1:
338 # The generation has stopped during final message.
339 - is_tool_call = False
339 reasoning_content = output_msgs[0].content[0].text
340 final_content = parser.current_content
341 else:
343 - if len(output_msgs) != 2:
344 - raise ValueError(
345 - "Expected 2 output messages (reasoning and final), "
346 - f"but got {len(output_msgs)}.")
347 - reasoning_msg, final_msg = output_msgs
348 - reasoning_content = reasoning_msg.content[0].text
342 + reasoning_msg = output_msgs[:-1]
343 + final_msg = output_msgs[-1]
344 + reasoning_content = "\n".join(
345 + [msg.content[0].text for msg in reasoning_msg])
346 final_content = final_msg.content[0].text
350 - is_tool_call = final_msg.recipient is not None
347 return reasoning_content, final_content, is_tool_call