o
    
Û¾it  ã                   @   s\   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 eeƒZG dd„ deƒZd	S )
zÙ
MiniMax M2 Parser - A unified parser for MiniMax M2 models.

This parser combines the existing MiniMaxM2ReasoningParser and
MinimaxM2ToolParser into a single unified interface by delegating
to those implementations.
é    )Úinit_logger)ÚDelegatingParser)ÚMiniMaxM2ReasoningParser)ÚTokenizerLike)ÚMinimaxM2ToolParserc                       s.   e Zd ZdZeZeZdef‡ fdd„Z	‡  Z
S )ÚMiniMaxM2Parseraª  
    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.
    Ú	tokenizerc                    s4   t ƒ  |¡ t|ƒ| _t|ƒ| _t d| jj	¡ d S )Nz(vLLM Successfully initialized parser %s!)
ÚsuperÚ__init__r   Ú_reasoning_parserr   Ú_tool_parserÚloggerÚdebugÚ	__class__Ú__name__)Úselfr   ©r   © úQ/home/ubuntu/.local/lib/python3.10/site-packages/vllm/parser/minimax_m2_parser.pyr
   +   s   

ÿzMiniMaxM2Parser.__init__)r   Ú
__module__Ú__qualname__Ú__doc__r   Úreasoning_parser_clsr   Útool_parser_clsr   r
   Ú__classcell__r   r   r   r   r      s
    r   N)r   Úvllm.loggerr   Úvllm.parser.abstract_parserr   Ú*vllm.reasoning.minimax_m2_reasoning_parserr   Úvllm.tokenizersr   Ú(vllm.tool_parsers.minimax_m2_tool_parserr   r   r   r   r   r   r   r   Ú<module>   s   