o
    i                  
   @   sx  U d dl Z d dlZddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ ej	d
e
dgdZe eZde
die_e eZddi igie_e eZdddiie_e eZdejie_e eZdejie_ejdedejdeddejdeddejddedejddedejd dedgZeej ed!< ejee d"ed#Zejjd$d% Zd&d' Z d(d) Z!dS )*    N   )_transformers)errors)types   )pytest_helper   )	constantsgemini-2.5-flashzTell me a story in 300 words.modelcontentssystem_instructionyou are a chatbot.toolsgoogle_search_retrievalgeneration_configmax_output_tokens2   http_optionstest_count_tokens)name
parameters#test_count_tokens_vertex_custom_url404)r   r   exception_if_mldev"test_count_tokens_mldev_custom_url)r   r   exception_if_vertex)test_count_tokens_with_system_instructionznot supported)r   r   r   test_count_tokens_with_tools(test_count_tokens_with_generation_config
test_tablezmodels.count_tokens)fileglobals_for_filetest_methodr!   c                    s*   | j jjtjtjdI d H }|sJ d S )Nr   )aiomodelscount_tokens_COUNT_TOKENS_PARAMSr   r   )clientresponse r+   _/home/ubuntu/.local/lib/python3.10/site-packages/google/genai/tests/models/test_count_tokens.py
test_asyncd   s
   r-   c                 C   s   | j jr-| jjdtjd}|sJ | jjdtjd}|sJ | jjdtjd}|s+J d S | jjdtjd}|s:J | jjdtjd}|sGJ d S )Nr
   r   z)publishers/google/models/gemini-2.5-flashzRprojects/vertexsdk/locations/us-central1/publishers/google/models/gemini-2.5-flashzmodels/gemini-2.5-flash)_api_clientvertexair&   r'   r(   r   )r)   	response1	response3	response4	response2r+   r+   r,   test_different_model_namesl   s.   r4   c                 C   s   dddddigddiii}| j jr$| jjtjtj|d}|js"J d S t	t
j | jjtjtj|d W d    d S 1 sAw   Y  d S )	Nr   
extra_bodysystemInstructiontextr   user)partsrole)r   r   config)r.   r/   r&   r'   r(   r   r   total_tokenspytestraisesr   ClientError)r)   r;   r*   r+   r+   r,   test_extra_body   s.   
"r@   )"copyr=    r   tr   r   r   r	   _CountTokensParameters	t_contentr(   deepcopy,_COUNT_TOKENS_PARAMS_WITH_SYSTEM_INSTRUCTIONr;   _COUNT_TOKENS_PARAMS_WITH_TOOLS+_COUNT_TOKENS_PARAMS_WITH_GENERATION_CONFIG&_COUNT_TOKENS_PARAMS_VERTEX_CUSTOM_URLVERTEX_HTTP_OPTIONS%_COUNT_TOKENS_PARAMS_MLDEV_CUSTOM_URLMLDEV_HTTP_OPTIONSTestTableItemr!   list__annotations__setup__file__globals
pytestmarkmarkasyncior-   r4   r@   r+   r+   r+   r,   <module>   s   







