
    dhL                     L    S SK JrJr  S\4S jrS\S\4S jrS\S\\   4S jrg)    )AnyListreturnc                  ^     SS K n U R                  5       $ ! [         a    [        S5      ef = f)Nr   zCould not import anthropic python package. This is needed in order to accurately tokenize the text for anthropic models. Please install it with `pip install anthropic`.)	anthropicImportError	Anthropic)r   s    _/var/www/html/shao/venv/lib/python3.13/site-packages/langchain_community/utilities/anthropic.py_get_anthropic_clientr      s?    
     
T
 	

s    ,textc                 4    [        5       nUR                  U S9$ )z-Get the number of tokens in a string of text.)r   )r   count_tokens)r   clients     r
   get_num_tokens_anthropicr      s    "$FD))    c                 p    [        5       nUR                  5       nUR                  U 5      nUR                  $ )z'Get the token ids for a string of text.)r   get_tokenizerencodeids)r   r   	tokenizerencoded_texts       r
   get_token_ids_anthropicr      s4    "$F$$&I##D)Lr   N)typingr   r   r   strintr   r    r   r
   <module>r      s>    	!s 	!*3 *3 *# $s) r   