vllm.entrypoints.openai.responses.utils ¶
_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/openai/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/openai/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/openai/responses/utils.py
extract_tool_types ¶
Extracts the tool types from the given tools.
Source code in vllm/entrypoints/openai/responses/utils.py
should_continue_final_message ¶
Determine if the last input message is a partial assistant message that should be continued rather than starting a new generation.
This enables partial message completion similar to Anthropic's Messages API, where users can provide an incomplete assistant message and have the model continue from where it left off.
A message is considered partial if: 1. It's a ResponseOutputMessage or ResponseReasoningItem 2. Its status is "in_progress" or "incomplete"
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_input | str | list[ResponseInputOutputItem] | The input to the Responses API request | required |
Returns:
| Type | Description |
|---|---|
bool | True if the final message should be continued, False otherwise |