vllm.entrypoints.responses_utils ¶
_construct_single_message_from_response_item ¶
_construct_single_message_from_response_item(
item: ResponseInputOutputItem,
) -> ChatCompletionMessageParam
Source code in vllm/entrypoints/responses_utils.py
_maybe_combine_reasoning_and_tool_call ¶
_maybe_combine_reasoning_and_tool_call(
item: ResponseInputOutputItem,
messages: list[ChatCompletionMessageParam],
) -> ChatCompletionMessageParam | None
Many models treat MCP calls and reasoning as a single message. This function checks if the last message is a reasoning message and the current message is a tool call
Source code in vllm/entrypoints/responses_utils.py
construct_chat_messages_with_tool_call ¶
construct_chat_messages_with_tool_call(
input_messages: list[ResponseInputOutputItem],
) -> list[ChatCompletionMessageParam]
This function wraps _construct_single_message_from_response_item Because some chatMessages come from multiple response items for example a reasoning item and a MCP tool call are two response items but are one chat message
Source code in vllm/entrypoints/responses_utils.py
construct_input_messages ¶
construct_input_messages(
*,
request_instructions: str | None = None,
request_input: str | list[ResponseInputOutputItem],
prev_msg: list[ChatCompletionMessageParam]
| None = None,
prev_response_output: list[ResponseOutputItem]
| None = None,
)
Source code in vllm/entrypoints/responses_utils.py
construct_tool_dicts ¶
Source code in vllm/entrypoints/responses_utils.py
convert_tool_responses_to_completions_format ¶
Convert a flat tool schema
{"type": "function", "name": "...", "description": "...", "parameters": {...}}
into: {"type": "function", "function": {...}}
Source code in vllm/entrypoints/responses_utils.py
extract_tool_types ¶
Extracts the tool types from the given tools.
Source code in vllm/entrypoints/responses_utils.py
make_response_output_items_from_parsable_context ¶
make_response_output_items_from_parsable_context(
response_messages: list[ResponseInputOutputItem],
) -> list[ResponseOutputItem]
Given a list of sentences, construct ResponseOutput Items.