vllm.entrypoints.openai.responses.streaming_events ¶
Streaming SSE event builders for the Responses API.
Pure functions that translate streaming state + delta data into OpenAI Response API SSE events. Used by the streaming event processors in serving.py.
The file is organized as
- StreamingState dataclass + utility helpers
- Shared leaf helpers — delta events (take plain strings, no context)
- Shared leaf helpers — done events (take plain strings, no context)
- Harmony-specific dispatchers (route ctx/previous_item → leaf helpers)
- Harmony-specific tool lifecycle helpers
StreamingState dataclass ¶
Mutable state for streaming event processing.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
reset_for_new_item ¶
Reset state when expecting a new output item.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
_resolve_mcp_name_label ¶
Resolve MCP tool name and server label from a recipient string.
mcp.*recipients: strip prefix, use the bare name as both name and server_label.- Everything else: use the recipient as the name and look up the server_label in TOOL_NAME_TO_MCP_SERVER_LABEL.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_browser_tool_events ¶
emit_browser_tool_events(
previous_item: Message, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events for browser tool calls (web search).
Source code in vllm/entrypoints/openai/responses/streaming_events.py
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | |
emit_code_interpreter_completion_events ¶
emit_code_interpreter_completion_events(
previous_item: Message, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events when code interpreter completes.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_code_interpreter_delta_events ¶
emit_code_interpreter_delta_events(
delta: str, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events for code interpreter delta streaming.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_content_delta_events ¶
emit_content_delta_events(
ctx: StreamingHarmonyContext, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events for content delta streaming based on channel type.
This is a Harmony-specific dispatcher that extracts values from the Harmony context and delegates to shared leaf helpers.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_function_call_delta_events ¶
emit_function_call_delta_events(
delta: str, function_name: str, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events for function call argument deltas.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_function_call_done_events ¶
emit_function_call_done_events(
function_name: str,
arguments: str,
state: StreamingState,
) -> list[StreamingResponsesResponse]
Emit events when a function call completes.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_mcp_completion_events ¶
emit_mcp_completion_events(
recipient: str, arguments: str, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events when an MCP tool call completes.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_mcp_delta_events ¶
emit_mcp_delta_events(
delta: str, state: StreamingState, recipient: str
) -> list[StreamingResponsesResponse]
Emit events for MCP tool delta streaming.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_previous_item_done_events ¶
emit_previous_item_done_events(
previous_item: Message, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit done events for the previous item when expecting a new start.
This is a Harmony-specific dispatcher that extracts values from the Harmony parser's message object and delegates to shared leaf helpers.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_reasoning_delta_events ¶
emit_reasoning_delta_events(
delta: str, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events for reasoning text delta streaming.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_reasoning_done_events ¶
emit_reasoning_done_events(
text: str, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events when a reasoning (analysis) item completes.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_text_delta_events ¶
emit_text_delta_events(
delta: str, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events for text content delta streaming.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_text_output_done_events ¶
emit_text_output_done_events(
text: str, state: StreamingState
) -> list[StreamingResponsesResponse]
Emit events when a final text output item completes.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
emit_tool_action_events ¶
emit_tool_action_events(
ctx: StreamingHarmonyContext,
state: StreamingState,
tool_server: ToolServer | None,
) -> list[StreamingResponsesResponse]
Emit events for tool action turn.
Source code in vllm/entrypoints/openai/responses/streaming_events.py
is_mcp_tool_by_namespace ¶
Determine if a tool call is an MCP tool based on recipient prefix.
- Tools starting with "functions." are function calls
- Everything else is an MCP tool