[Frontend] Support CustomToolCall in the non-Harmony Responses API (#57322)

Signed-off-by: Shijin Zhang <75300765+Dovis01@users.noreply.github.com>
Co-authored-by: Chauncey <chaunceyjiang@gmail.com>
This commit is contained in:
Shijin Zhang
2026-10-12 17:22:55 +08:00
committed by GitHub
co-authored by Chauncey
parent a33d46b471
commit 83773ecdf3
22 changed files with 698 additions and 72 deletions
@@ -8,6 +8,7 @@ from unittest.mock import MagicMock
import pytest
from vllm.entrypoints.openai.chat_completion.protocol import ChatCompletionRequest
from vllm.entrypoints.openai.responses.protocol import ResponsesRequest
from vllm.parser.gemma4 import (
TOOL_CALL_END,
TOOL_CALL_START,
@@ -117,6 +118,21 @@ def mock_request():
return request
def test_named_custom_tool_choice_skips_structured_outputs(mock_tokenizer):
# Responses custom tools ride the function shim, so a named custom choice
# must route like a named function choice, not into guided JSON.
tools = [{"type": "custom", "name": "emit_command"}]
request = ResponsesRequest(
input="hi",
tools=tools,
tool_choice={"type": "custom", "name": "emit_command"},
)
Gemma4EngineToolParser(mock_tokenizer, tools=tools).adjust_request(request)
assert request.skip_special_tokens is False
assert request.structured_outputs is None
# ---------------------------------------------------------------------------
# Unit tests for _parse_gemma4_args (shared parser logic)
# ---------------------------------------------------------------------------