Bases: DelegatingParser
Unified parser for MiniMax M2 models that handles both reasoning extraction and tool call parsing.
This parser delegates to the existing implementations: - MiniMaxM2ReasoningParser for reasoning extraction - MinimaxM2ToolParser for tool call parsing
MiniMax M2 models have two special behaviors: 1. Reasoning: They don't generate start token, only end token. All content before is reasoning, content after is the actual response. 2. Tool Calls: They use ... tags with ... and ... syntax.
Source code in vllm/parser/minimax_m2_parser.py
| class MiniMaxM2Parser(DelegatingParser):
"""
Unified parser for MiniMax M2 models that handles both reasoning
extraction and tool call parsing.
This parser delegates to the existing implementations:
- MiniMaxM2ReasoningParser for reasoning extraction
- MinimaxM2ToolParser for tool call parsing
MiniMax M2 models have two special behaviors:
1. Reasoning: They don't generate <think> start token, only </think> end
token. All content before </think> is reasoning, content after is the
actual response.
2. Tool Calls: They use <minimax:tool_call>...</minimax:tool_call> tags
with <invoke name="...">...</invoke> and <parameter name="...">...</parameter>
syntax.
"""
# Class-level parser classes for compatibility
reasoning_parser_cls = MiniMaxM2ReasoningParser
tool_parser_cls = MinimaxM2ToolParser
def __init__(self, tokenizer: TokenizerLike):
super().__init__(tokenizer)
# Initialize the underlying parsers
self._reasoning_parser = MiniMaxM2ReasoningParser(tokenizer)
self._tool_parser = MinimaxM2ToolParser(tokenizer)
logger.debug(
"vLLM Successfully initialized parser %s!", self.__class__.__name__
)
|
_reasoning_parser instance-attribute
reasoning_parser_cls class-attribute instance-attribute
__init__
Source code in vllm/parser/minimax_m2_parser.py
| def __init__(self, tokenizer: TokenizerLike):
super().__init__(tokenizer)
# Initialize the underlying parsers
self._reasoning_parser = MiniMaxM2ReasoningParser(tokenizer)
self._tool_parser = MinimaxM2ToolParser(tokenizer)
logger.debug(
"vLLM Successfully initialized parser %s!", self.__class__.__name__
)
|