[Frontend] Port the MiniMax M3 tool parser to the parser engine (#59743)
Signed-off-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6fddc9b21e
commit
5145e35e50
@@ -1,19 +1,10 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from vllm.tool_parsers.rust_tool_parser import RustToolParser
|
||||
from vllm.parser.engine.registered_adapters import MinimaxM3ParserToolAdapter
|
||||
|
||||
|
||||
class MinimaxM3ToolParser(RustToolParser):
|
||||
"""Adapter from the Rust MiniMax M3 parser to vLLM ToolParser.
|
||||
|
||||
The real M3 grammar lives in the Rust tool-parser crate. This class only
|
||||
configures the generic Rust bridge with the MiniMax M3 parser name.
|
||||
|
||||
M3 is not M2 with renamed tags: it prefixes each structural tag with the
|
||||
MiniMax namespace marker, allows multiple ``<invoke>`` tags in one wrapper,
|
||||
and represents nested arguments with parameter-name XML tags.
|
||||
"""
|
||||
|
||||
rust_parser_name = "MinimaxM3ToolParser"
|
||||
tool_call_start_token = "]<]minimax[>[<tool_call>"
|
||||
class MinimaxM3ToolParser(MinimaxM3ParserToolAdapter): # type: ignore[valid-type, misc]
|
||||
# Required and named tool choices parse the native M3 syntax instead of
|
||||
# forcing JSON output.
|
||||
supports_required_and_named = False
|
||||
|
||||
Reference in New Issue
Block a user