[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user