[Bugfix][Frontend] Enforce parallel_tool_calls=false in the required-tool grammar (#50502)

Signed-off-by: ostring <ostring@qq.com>
Signed-off-by: sfeng33 <4florafeng@gmail.com>
Co-authored-by: Flora Feng <4florafeng@gmail.com>
This commit is contained in:
Ostring24
2026-09-29 21:33:28 +00:00
committed by GitHub
co-authored by Flora Feng
parent 1ee7f78e80
commit 4e7af3b0de
8 changed files with 261 additions and 38 deletions
-17
View File
@@ -1,25 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from xgrammar.structural_tag import TriggeredTagsFormat
from vllm.parser.engine.registered_adapters import MiMoParserToolAdapter
from vllm.tool_parsers.tool_strict_level import ToolStrictLevel
class MiMoToolParser(MiMoParserToolAdapter): # type: ignore[valid-type, misc]
structural_tag_model = "mimo"
def get_structural_tag(
self, request, *, reasoning=False, strict_level=ToolStrictLevel.AUTO
):
tag = super().get_structural_tag(
request, reasoning=reasoning, strict_level=strict_level
)
if (
tag is not None
and request.parallel_tool_calls is False
and isinstance(tag.format, TriggeredTagsFormat)
):
tag.format.stop_after_first = True
return tag