o
    cÛ·iN  ã                   @   s2   d e e dedede ee e ef  fdd„ZdS )ÚtokensÚbegin_think_token_idÚend_think_token_idÚreturnc                 C   s¶   | sg S g }g }d}| D ]C}||kr|rt dƒ‚||kr/|r'| |df¡ g }d}| |¡ q||krJ|s9t dƒ‚| |¡ | |df¡ g }d}q| |¡ q|rY| ||f¡ |S )a‚  Split the content and think chunks from a list of tokens.

    Args:
        tokens: list of tokens.
        begin_think_token_id: The token id for the begin think token.
        end_think_token_id: The token id for the end think token.

    Returns:
        list of tuples, where each tuple contains a list of tokens and a boolean indicating if the chunk is a think
        chunk.
    Fz$Nested think chunks are not allowed.Tz2End think token found without a begin think token.)Ú
ValueErrorÚappend)r   r   r   Úcontent_chunksÚcurrent_contentÚin_think_chunkÚtoken© r   úW/home/ubuntu/vllm_env/lib/python3.10/site-packages/mistral_common/experimental/think.pyÚ_split_content_and_think_chunks   s2   
r   N)ÚlistÚintÚtupleÚboolr   r   r   r   r   Ú<module>   s    ÿÿÿþ