[Bugfix][Responses API] Preserve built-in tool output call IDs (#55596)
Signed-off-by: CorgiBoyG <111257566+CorgiBoyG@users.noreply.github.com> Co-authored-by: Flora Feng <4florafeng@gmail.com>
This commit is contained in:
@@ -173,7 +173,7 @@ class HarmonyPythonTool(Tool):
|
||||
processed = ResponseFunctionToolCallOutputItem(
|
||||
id=f"fco_{random_uuid()}",
|
||||
type="function_call_output",
|
||||
call_id=f"call_{random_uuid()}",
|
||||
call_id=last_msg.call_id,
|
||||
output=msg.content[0].text,
|
||||
status="completed",
|
||||
)
|
||||
|
||||
@@ -24,7 +24,6 @@ from vllm import envs
|
||||
from vllm.entrypoints.chat_utils import (
|
||||
ChatTemplateContentFormatOption,
|
||||
)
|
||||
from vllm.entrypoints.generate.base.protocol import FunctionCall
|
||||
from vllm.entrypoints.mcp.tool import Tool
|
||||
from vllm.entrypoints.mcp.tool_server import ToolServer
|
||||
from vllm.entrypoints.openai.parser.harmony_utils import render_for_completion
|
||||
@@ -440,7 +439,9 @@ class ParsableContext(ConversationContext):
|
||||
return False
|
||||
|
||||
async def call_python_tool(
|
||||
self, tool_session: Union["ClientSession", Tool], last_msg: FunctionCall
|
||||
self,
|
||||
tool_session: Union["ClientSession", Tool],
|
||||
last_msg: ResponseFunctionToolCall,
|
||||
) -> list[ResponseInputOutputItem]:
|
||||
self.called_tools.add("python")
|
||||
if isinstance(tool_session, Tool):
|
||||
@@ -455,7 +456,7 @@ class ParsableContext(ConversationContext):
|
||||
message = ResponseFunctionToolCallOutputItem(
|
||||
id=f"mcpo_{random_uuid()}",
|
||||
type="function_call_output",
|
||||
call_id=f"call_{random_uuid()}",
|
||||
call_id=last_msg.call_id,
|
||||
output=result_str,
|
||||
status="completed",
|
||||
)
|
||||
@@ -463,7 +464,9 @@ class ParsableContext(ConversationContext):
|
||||
return [message]
|
||||
|
||||
async def call_search_tool(
|
||||
self, tool_session: Union["ClientSession", Tool], last_msg: FunctionCall
|
||||
self,
|
||||
tool_session: Union["ClientSession", Tool],
|
||||
last_msg: ResponseFunctionToolCall,
|
||||
) -> list[ResponseInputOutputItem]:
|
||||
self.called_tools.add("browser")
|
||||
if isinstance(tool_session, Tool):
|
||||
@@ -481,7 +484,7 @@ class ParsableContext(ConversationContext):
|
||||
message = ResponseFunctionToolCallOutputItem(
|
||||
id=f"fco_{random_uuid()}",
|
||||
type="function_call_output",
|
||||
call_id=f"call_{random_uuid()}",
|
||||
call_id=last_msg.call_id,
|
||||
output=result_str,
|
||||
status="completed",
|
||||
)
|
||||
@@ -489,8 +492,10 @@ class ParsableContext(ConversationContext):
|
||||
return [message]
|
||||
|
||||
async def call_container_tool(
|
||||
self, tool_session: Union["ClientSession", Tool], last_msg: Message
|
||||
) -> list[Message]:
|
||||
self,
|
||||
tool_session: Union["ClientSession", Tool],
|
||||
last_msg: ResponseFunctionToolCall,
|
||||
) -> list[ResponseInputOutputItem]:
|
||||
"""Call container tool. Expect this to be run in a stateful docker
|
||||
with command line terminal.
|
||||
The official container tool would at least
|
||||
@@ -523,7 +528,7 @@ class ParsableContext(ConversationContext):
|
||||
message = ResponseFunctionToolCallOutputItem(
|
||||
id=f"fco_{random_uuid()}",
|
||||
type="function_call_output",
|
||||
call_id=f"call_{random_uuid()}",
|
||||
call_id=last_msg.call_id,
|
||||
output=result_str,
|
||||
status="completed",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user