[Bugfix][Responses] Add tests for Chat Completions Responses API Render Parity (#50334)

Signed-off-by: Yifan Zong <yzong@redhat.com>
Co-authored-by: Ben Browning <56071+bbrowning@users.noreply.github.com>
This commit is contained in:
yzong-rh
2026-07-31 15:45:40 -04:00
committed by GitHub
co-authored by Ben Browning
parent 4fdd3e0b74
commit e8b358b4c0
8 changed files with 521 additions and 43 deletions
@@ -186,6 +186,12 @@ async def test_function_call_first_turn(client: OpenAI, model_name: str):
@pytest.mark.asyncio
@pytest.mark.parametrize("model_name", [MODEL_NAME])
@pytest.mark.xfail(
reason=(
"MCP tools are not properly supported: tool name parameters "
"are not extracted for prompt rendering."
),
)
async def test_mcp_tool_call(client: OpenAI, model_name: str):
"""MCP tool calling with code_interpreter.
@@ -20,7 +20,6 @@ from vllm.entrypoints.openai.responses.utils import (
_construct_message_from_response_item,
construct_chat_messages_with_tool_call,
construct_input_messages,
convert_tool_responses_to_completions_format,
should_continue_final_message,
)
@@ -116,27 +115,7 @@ def make_function_call_output(
class TestResponsesUtils:
"""Tests for convert_tool_responses_to_completions_format function."""
def test_convert_tool_responses_to_completions_format(self):
"""Test basic conversion of a flat tool schema to nested format."""
input_tool = {
"type": "function",
"name": "get_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
},
"required": ["location", "unit"],
},
}
result = convert_tool_responses_to_completions_format(input_tool)
assert result == {"type": "function", "function": input_tool}
"""Tests for Responses API utils."""
def test_construct_chat_messages_with_tool_call(self):
"""Test construction of chat messages with tool calls."""