[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:
Yixin Dong
2026-09-29 12:47:47 +00:00
committed by GitHub
co-authored by Codex yuchuan Bugen Zhao Claude Opus 5.5
parent 79a0307d74
commit dfc8e0f3e2
17 changed files with 243 additions and 15 deletions
@@ -17,6 +17,7 @@ from vllm.parser.granite import GraniteParser
from vllm.parser.granite_thinking import GraniteThinkingParser
from vllm.parser.inkling import InklingParser
from vllm.parser.kimi_k2 import KimiK2Parser
from vllm.parser.mimo import MiMoParser
from vllm.parser.minimax_m2 import MinimaxM2Parser
from vllm.parser.mistral import MistralParser
from vllm.parser.nemotron_v3 import NemotronV3Parser
@@ -69,6 +70,11 @@ from vllm.parser.seed_oss import SeedOssParser
Qwen3ParserToolAdapter,
) = make_adapters(Qwen3Parser)
(
MiMoParserReasoningAdapter,
MiMoParserToolAdapter,
) = make_adapters(MiMoParser)
(
SeedOssParserReasoningAdapter,
SeedOssParserToolAdapter,
+42
View File
@@ -0,0 +1,42 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""MiMo's compact XML parameters contain verbatim string values."""
import json
from dataclasses import replace
from vllm.parser.qwen3 import (
_PARAM_RE,
_PARTIAL_PARAM_RE,
CHATML_TURN_BOUNDARIES,
Qwen3Parser,
qwen3_config,
)
def _mimo_arg_converter(raw_args: str, partial: bool) -> str:
params = {m.group(1): m.group(2) for m in _PARAM_RE.finditer(raw_args)}
if partial:
match = _PARTIAL_PARAM_RE.search(_PARAM_RE.sub("", raw_args))
if match and match.group(1):
params[match.group(1)] = match.group(2)
return json.dumps(params, ensure_ascii=False)
class MiMoParser(Qwen3Parser):
def __init__(self, tokenizer, tools=None, **kwargs):
thinking = (kwargs.get("chat_template_kwargs") or {}).get(
"enable_thinking", True
)
kwargs.setdefault(
"parser_engine_config",
replace(
qwen3_config(
thinking=thinking,
name="mimo",
turn_boundary_tokens=CHATML_TURN_BOUNDARIES,
),
arg_converter=_mimo_arg_converter,
),
)
super().__init__(tokenizer, tools, **kwargs)