o
    iM                     @   sh   d dl mZmZmZ ddlmZ erd dlZdddddddee d	ee d
eee  def
ddZ	dS )    )ListOptionalTYPE_CHECKING   )LLTokenizerN)n_vocab	eos_tokenslicesencodingztiktoken.Encodingr   r   r	   returnc                C   s*   t j| j| j| j|du r| jn|||dS )a  
    Create a new tokenizer from a tiktoken Encoding object.
    This is an expensive operation (~1s), so the result should be cached.

    Args:
        encoding: tiktoken.Encoding - the encoding object to use
        n_vocab: int - override the size of the vocabulary
        eos_token: int - override the EOS token
        slices: List[str] - configuration for slicer optimization; pass [] to disable,
            or None to use the default configuration
    N)encoderspecial_tokenspatternr   r   r	   )r   from_tiktoken_mergeable_ranks_special_tokens_pat_str	eot_token)r
   r   r   r	    r   P/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/llguidance/tiktoken.pylltokenizer_from_encoding	   s   r   )
typingr   r   r   _libr   tiktokenintstrr   r   r   r   r   <module>   s$    
