o
    á)iò  ã                   @   sZ   d dl mZ d dlmZmZ d dlmZ d dlmZ ee	ƒZ
e d¡G dd„ deƒƒZdS )	é    )Úinit_logger)ÚReasoningParserÚReasoningParserManager)ÚDeepSeekR1ReasoningParser)ÚMistralTokenizerZmistralc                   @   s   e Zd ZdZdefdd„ZdS )ÚMistralReasoningParserzÅ
    Reasoning parser for Mistral models.

    The Mistral models uses [THINK]...[/THINK] tokens to denote reasoning
    text. This parser extracts the reasoning content from the model output.
    Ú	tokenizerc                 C   sˆ   t |tƒs	tdƒ‚t | |¡ | jstdƒ‚ddlm} |j| _	|j
| _|j | j	¡| _|j | j¡| _| jd u s>| jd u rBtdƒ‚d S )Nz6The tokenizer must be an instance of MistralTokenizer.zZThe model tokenizer must be passed to the ReasoningParser constructor during construction.r   )ÚSpecialTokenszRMistral reasoning parser could not locate think start/end tokens in the tokenizer!)Ú
isinstancer   Ú
ValueErrorr   Ú__init__Zmodel_tokenizerZ%mistral_common.tokens.tokenizers.baser	   Zbegin_thinkZstart_tokenZ	end_thinkZ	end_tokenr   Zget_control_tokenZstart_token_idZend_token_idÚRuntimeError)Úselfr   r	   © r   ús/home/app/PaddleOCR-VL-test/.venv_paddleocr/lib/python3.10/site-packages/vllm/reasoning/mistral_reasoning_parser.pyr      s.   
ÿÿÿÿÿÿzMistralReasoningParser.__init__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r      s    r   N)Zvllm.loggerr   Zvllm.reasoningr   r   Z+vllm.reasoning.deepseek_r1_reasoning_parserr   Z*vllm.transformers_utils.tokenizers.mistralr   r   ÚloggerZregister_moduler   r   r   r   r   Ú<module>   s   