
    gy                    N   U d dl mZ ddlmZ ddlmZ ddddddddddd
Zded	<   i d
dddddddddddddddddddddddddddddddddi ddddddd dd!dd"dd#dd$dd%dd&d'd(d'd)dd*dd+dd,dd-dd.dddddd/d/d0Zded1<   d5d2Z	d6d3Z
y4)7    )annotations   )Encoding)get_encoding
o200k_basecl100k_base)
zo1-zchatgpt-4o-zgpt-4o-zgpt-4-zgpt-3.5-turbo-zgpt-35-turbo-zft:gpt-4zft:gpt-3.5-turbozft:davinci-002zft:babbage-002zdict[str, str]MODEL_PREFIX_TO_ENCODINGzgpt-4ozgpt-4zgpt-3.5-turbozgpt-3.5zgpt-35-turbozdavinci-002zbabbage-002ztext-embedding-ada-002ztext-embedding-3-smallztext-embedding-3-largeztext-davinci-003	p50k_baseztext-davinci-002ztext-davinci-001	r50k_baseztext-curie-001ztext-babbage-001ztext-ada-001davincicuriebabbageadazcode-davinci-002zcode-davinci-001zcode-cushman-002zcode-cushman-001zdavinci-codexzcushman-codexztext-davinci-edit-001	p50k_editzcode-davinci-edit-001ztext-similarity-davinci-001ztext-similarity-curie-001ztext-similarity-babbage-001ztext-similarity-ada-001ztext-search-davinci-doc-001ztext-search-curie-doc-001gpt2)ztext-search-babbage-doc-001ztext-search-ada-doc-001zcode-search-babbage-code-001zcode-search-ada-code-001r   zgpt-2MODEL_TO_ENCODINGc                    d}| t         v r
t         |    }n1t        j                         D ]  \  }}| j                  |      s|c S  |t	        d|  d      d|S )zrReturns the name of the encoding used by a model.

    Raises a KeyError if the model name is not recognised.
    NzCould not automatically map z_ to a tokeniser. Please use `tiktoken.get_encoding` to explicitly get the tokeniser you expect.)r   r	   items
startswithKeyError)
model_nameencoding_namemodel_prefixmodel_encoding_names       C/var/www/openai/venv/lib/python3.12/site-packages/tiktoken/model.pyencoding_name_for_modelr   K   s    
 M&&)*5
 2J1O1O1Q-L-$$\2** 2R *:, 7] ]
 	
     c                *    t        t        |             S )zfReturns the encoding used by a model.

    Raises a KeyError if the model name is not recognised.
    )r   r   )r   s    r   encoding_for_modelr   d   s    
 /
;<<r   N)r   strreturnr    )r   r    r!   r   )
__future__r   corer   registryr   r	   __annotations__r   r   r    r   r   <module>r'      s   "  " #"%##, . 2%l2% ]2% ]	2%
 }2% M2% =2% =2% m2% m2% m2%  !2%" #2%$ %2%& k'2%( )2%* K+2%, {-2%. [/2%0 {12%2 
;32%6 72%8 92%: ;2%< =2%> [?2%@ [A2%D [E2%F [G2%J ";K2%L  M2%N ";O2%P {Q2%R ";S2%T  U2%V $/*$/ +c2% > 2j2=r   