o
    Yi                  
   @   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contentsZsystem_instructionyou are a chatbot.ZtoolsZgoogle_search_retrievalZgeneration_configZmax_output_tokens2   http_optionsZtest_count_tokens)name
parametersZ#test_count_tokens_vertex_custom_urlZ404)r   r   exception_if_mldevZ"test_count_tokens_mldev_custom_url)r   r   Zexception_if_vertexZ)test_count_tokens_with_system_instructionznot supported)r   r   r   Ztest_count_tokens_with_toolsZ(test_count_tokens_with_generation_config
test_tablezmodels.count_tokens)fileZglobals_for_fileZtest_methodr   c                    s*   | j jjtjtjdI d H }|sJ d S )Nr   )Zaiomodelscount_tokens_COUNT_TOKENS_PARAMSr   r   )clientresponse r   e/home/kim/smarthome/.venv/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   Z	response1Z	response3Z	response4Z	response2r   r   r   test_different_model_namesl   s.   r    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   Z
extra_bodyZsystemInstructiontextr   user)partsZrole)r   r   config)r   r   r   r   r   r   r   Ztotal_tokenspytestZraisesr   ZClientError)r   r$   r   r   r   r   test_extra_body   s.   
"r&   )"copyr%    r   tr   r   r   r	   Z_CountTokensParametersZ	t_contentr   deepcopyZ,_COUNT_TOKENS_PARAMS_WITH_SYSTEM_INSTRUCTIONr$   Z_COUNT_TOKENS_PARAMS_WITH_TOOLSZ+_COUNT_TOKENS_PARAMS_WITH_GENERATION_CONFIGZ&_COUNT_TOKENS_PARAMS_VERTEX_CUSTOM_URLZVERTEX_HTTP_OPTIONSZ%_COUNT_TOKENS_PARAMS_MLDEV_CUSTOM_URLZMLDEV_HTTP_OPTIONSZTestTableItemr   list__annotations__setup__file__globalsZ
pytestmarkmarkZasyncior   r    r&   r   r   r   r   <module>   s   







