[Frontend] Skip structural tags for auto tool_choice without strict mode (#45600)

Signed-off-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
Flora Feng
2026-06-15 19:55:31 +00:00
committed by GitHub
parent e18fe932ca
commit cd9078fe59
8 changed files with 111 additions and 24 deletions
@@ -216,14 +216,32 @@ def test_streaming_emits_incremental_argument_chunks():
}
def _with_strict(
tools: list[ChatCompletionToolsParam],
) -> list[ChatCompletionToolsParam]:
return [
ChatCompletionToolsParam(
type=t.type,
function=FunctionDefinition(
name=t.function.name,
description=t.function.description,
parameters=t.function.parameters,
strict=True,
),
)
for t in tools
]
def test_get_vllm_registry_structural_tag_returns_structural_tag(
sample_tools: list[ChatCompletionToolsParam],
) -> None:
parser = make_parser()
strict_tools = _with_strict(sample_tools)
req = ChatCompletionRequest(
messages=[],
model="m",
tools=sample_tools,
tools=strict_tools,
tool_choice="auto",
)
tag = parser.get_structural_tag(req)