[Frontend] Support strict MiMo-V2.6 tool calling (#58019)
Co-authored-by: Codex <noreply@openai.com> Co-authored-by: yuchuan <yuchuan.7streams@gmail.com> Co-authored-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Ubospica <ubospica@gmail.com> Signed-off-by: yuchuan <yuchuan.7streams@gmail.com> Signed-off-by: Bugen Zhao <i@bugenzhao.com>
This commit is contained in:
co-authored by
Codex
yuchuan
Bugen Zhao
Claude Opus 5.5
parent
79a0307d74
commit
dfc8e0f3e2
@@ -0,0 +1,25 @@
|
||||
# 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