Skip to content

[gpt-oss] Parse output msgs refactor#4

Draft
daniel-salib wants to merge 1 commit into
gpt-oss-mcp-streamingfrom
parse-output-msgs-refactor
Draft

[gpt-oss] Parse output msgs refactor#4
daniel-salib wants to merge 1 commit into
gpt-oss-mcp-streamingfrom
parse-output-msgs-refactor

Conversation

@daniel-salib
Copy link
Copy Markdown
Owner

@daniel-salib daniel-salib commented Nov 17, 2025

Purpose

Refactor parse_output_message function in
vllm/entrypoints/harmony_utils.py to improve code
maintainability and readability. The function was
becoming too complex with multiple nested conditional
branches for handling browser tools, function calls,
MCP calls, and message parsing.

This PR extracts the logic into focused
sub-functions:

  • _parse_browser_tool_call() - Handles browser tool
    calls with JSON parsing
  • _parse_function_call() - Handles function calls
  • _parse_mcp_call() - Handles MCP calls
  • _parse_reasoning_content() - Handles
    reasoning/analysis content
  • _parse_final_message() - Handles final message
    output

No functional changes - purely a code organization
improvement.

Test Plan

Run existing tests to ensure no behavioral chang

Signed-off-by: Daniel Salib <danielsalib@meta.com>
@daniel-salib daniel-salib force-pushed the parse-output-msgs-refactor branch from 018a2e3 to fe1253e Compare November 17, 2025 10:05
)


def parse_output_message(message: Message) -> list[ResponseOutputItem]:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for putting this together! One thing to keep in mind for the future is that MCP tool calls are constructed from two harmony messages as it's both an reasoning item and tool out right now, when we implement that we can build off of this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants