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 12, 13:30 UTC
[responsesAPI][2] parse ResponseFunctionToolCallOutputItem (#29383)
Signed-off-by: Andrew Xia <axia@fb.com> Co-authored-by: Andrew Xia <axia@fb.com>
Andrew Xia committed
Nov 25, 2025 at 10:27 UTC
b07555d26f4c7ad9a2d1ec45428a9d4287db612c
3 files changed
+25
-4
tests/entrypoints/test_responses_utils.py
+15
@@ -2,6 +2,9 @@
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4
import pytest
5
+from openai.types.responses.response_function_tool_call_output_item import (
6
+ ResponseFunctionToolCallOutputItem,
7
+)
8
from openai.types.responses.response_reasoning_item import (
9
Content,
10
ResponseReasoningItem,
@@ -76,6 +79,18 @@ class TestResponsesUtils:
79
== 'Hmm, the user has just started with a simple "Hello,"'
80
)
81
82
+ tool_call_output = ResponseFunctionToolCallOutputItem(
83
+ id="temp_id",
84
+ type="function_call_output",
85
+ call_id="temp",
86
+ output="1234",
87
+ status="completed",
88
+ )
89
+ formatted_item = construct_chat_message_with_tool_call(tool_call_output)
90
+ assert formatted_item["role"] == "tool"
91
+ assert formatted_item["content"] == "1234"
92
+ assert formatted_item["tool_call_id"] == "temp"
93
+
94
item = ResponseReasoningItem(
95
id="lol",
96
summary=[],
vllm/entrypoints/openai/protocol.py
+1
-4
@@ -29,7 +29,6 @@ from openai.types.responses import (
29
ResponseOutputItemAddedEvent,
30
ResponseOutputItemDoneEvent,
31
ResponsePrompt,
32
- ResponseReasoningItem,
32
ResponseReasoningTextDeltaEvent,
33
ResponseReasoningTextDoneEvent,
34
ResponseStatus,
@@ -304,9 +303,7 @@ def get_logits_processors(
303
return None
304
305
307
-ResponseInputOutputItem: TypeAlias = (
308
- ResponseInputItemParam | ResponseReasoningItem | ResponseFunctionToolCall
309
-)
306
+ResponseInputOutputItem: TypeAlias = ResponseInputItemParam | ResponseOutputItem
307
308
309
class ResponsesRequest(OpenAIBaseModel):
vllm/entrypoints/responses_utils.py
+9
@@ -10,6 +10,9 @@ from openai.types.chat.chat_completion_message_tool_call_param import (
10
Function as FunctionCallTool,
11
)
12
from openai.types.responses import ResponseFunctionToolCall, ResponseOutputItem
13
+from openai.types.responses.response_function_tool_call_output_item import (
14
+ ResponseFunctionToolCallOutputItem,
15
+)
16
from openai.types.responses.response_output_message import ResponseOutputMessage
17
from openai.types.responses.response_reasoning_item import ResponseReasoningItem
18
from openai.types.responses.tool import Tool
@@ -94,6 +97,12 @@ def construct_chat_message_with_tool_call(
97
"role": "assistant",
98
"reasoning": reasoning_content,
99
}
100
+ elif isinstance(item, ResponseFunctionToolCallOutputItem):
101
+ return ChatCompletionToolMessageParam(
102
+ role="tool",
103
+ content=item.output,
104
+ tool_call_id=item.call_id,
105
+ )
106
elif item.get("type") == "function_call_output":
107
# Append the function call output as a tool message.
108
return ChatCompletionToolMessageParam(