
    #j                        d dl Z d dlZd dlmZmZm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 dd	lmZ dd
l
mZ ddl
mZ ddlmZmZ  ej        d          Z	 d9deeeef         ef         deeeef                  deeef         fdZ	 d9deeeef         ef         deeeef                  deeef         fdZ	 d9deeeef         ef         deeeef                  deeef         fdZ	 d9deeeef         ef         deeeef                  deeef         fdZ	 d9deeeef         ef         deeeef                  deeef         fdZ 	 d9deeeef         ef         deeeef                  deeef         fdZ!	 d9dedeeeef         ef         deeeef                  deeef         fdZ"	 d9dedeeeef         ef         deeeef                  deeef         fdZ#	 d9dedeeeef         ef         deeeef                  deeef         fdZ$	 d9dedeeeef         ef         deeeef                  deeef         fdZ%	 d9deeeef         ef         deeeef                  deeef         fdZ&	 d9deeeef         ef         deeeef                  deeef         fdZ'	 d9deeeef         ef         deeeef                  deeef         fdZ(	 d9deeeef         ef         deeeef                  deeef         fdZ)	 d9deeeef         ef         deeeef                  deeef         fd Z*	 d9dedeeeef         ef         deeeef                  deeef         fd!Z+	 d9dedeeeef         ef         deeeef                  deeef         fd"Z,	 d9deeeef         ef         deeeef                  deeef         fd#Z-	 d9deeeef         ef         deeeef                  deeef         fd$Z.	 d9deeeef         ef         deeeef                  deeef         fd%Z/	 d9deeeef         ef         deeeef                  deeef         fd&Z0	 d9deeeef         ef         deeeef                  deeef         fd'Z1	 d9deeeef         ef         deeeef                  deeef         fd(Z2	 d9deeeef         ef         deeeef                  deeef         fd)Z3	 d9deeeef         ef         deeeef                  deeef         fd*Z4	 d9deeeef         ef         deeeef                  deeef         fd+Z5	 d9deeeef         ef         deeeef                  deeef         fd,Z6	 d9deeeef         ef         deeeef                  deeef         fd-Z7	 d9deeeef         ef         deeeef                  deeef         fd.Z8	 d9deeeef         ef         deeeef                  deeef         fd/Z9	 d9deeeef         ef         deeeef                  deeef         fd0Z:	 d9deeeef         ef         deeeef                  deeef         fd1Z;	 d9deeeef         ef         deeeef                  deeef         fd2Z<	 d9dedeeeef         ef         deeeef                  deeef         fd3Z=	 d9dedeeeef         ef         deeeef                  deeef         fd4Z> G d5 d6e	j?                  Z@ G d7 d8e	j?                  ZAdS ):    N)AnyOptionalUnion)	urlencode   )_api_module)_common)_transformers)types)BaseApiClient)get_value_by_path)set_value_by_path)
AsyncPagerPagerzgoogle_genai.cachesfrom_objectparent_objectreturnc                    i }t          | dg          !t          |dgt          | dg                     t          | dg          t          d          t          | dg          t          d          t          | dg          t          d          t          | d	g          t          d
          t          | dg          t          d          t          | dg          t          d          |S )Napi_keyapiKeyapi_key_configzvapi_key_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.	auth_typezqauth_type parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.google_service_account_configzgoogle_service_account_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.http_basic_auth_configz~http_basic_auth_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.oauth_configztoauth_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.oidc_configzsoidc_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.getvsetv
ValueErrorr   r   	to_objects      [/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/google/genai/caches.py_AuthConfig_to_mldevr$   #   sL    !)	+	{##/XJ[9+ > >???	+()**6
	<  
 
+}%%1
	<  
 
+7899E
	M  
 
+0122>
	M  
 
+'((4
	<  
 
+''3
	<  
 
    c                    i }t          | dg          !t          |dgt          | dg                     t          | dg          t          d          t          | dg          !t          |dgt          | dg                     |S )Ndatadisplay_nametdisplay_name parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.	mime_typemimeTyper   r!   s      r#   _Blob_to_mldevr,   R   s     !)	+x  ,VHd;99:::	+'((4
	<  
 
+}%%1ZL${[M"B"BCCC	r%   c           	          i t          | dg          -t          dgfdt          | dg          D                        t          | dg          !t          dgt          | dg                     S )Npartsc                 0    g | ]}t          |          S  )_Part_to_mldev.0itemr"   s     r#   
<listcomp>z%_Content_to_mldev.<locals>.<listcomp>o   3     	
 	
 	
 4++	
 	
 	
r%   roler   r   r!   s     @r#   _Content_to_mldevr9   f        !)	+y!!-			
 	
 	
 	
[7)44	
 	
 	
   
+x  ,VHd;99:::	r%   c           	          i t          | dg          -t          dgfdt          | dg          D                        t          | dg          !t          dgt          | dg                     S )Nr.   c                 0    g | ]}t          |          S r0   )_Part_to_vertexr2   s     r#   r5   z&_Content_to_vertex.<locals>.<listcomp>   3     	
 	
 	
 D),,	
 	
 	
r%   r7   r8   r!   s     @r#   _Content_to_vertexr?   {   r:   r%   c                    i t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          ?t          |dgfdt          j        t          | dg                    D                        t          | dg          At          |d	gt	          t          j        t          | dg                                         t          | d
g          -t          |d
gfdt          | d
g          D                        t          | dg          /t          |dgt          t          | dg                               t          | dg          t          d          S )Nttlexpire_time
expireTimer(   displayNamecontentsc                 0    g | ]}t          |          S r0   )r9   r2   s     r#   r5   z7_CreateCachedContentConfig_to_mldev.<locals>.<listcomp>   s3     	
 	
 	
 dI..	
 	
 	
r%   system_instructionsystemInstructiontoolsc                 0    g | ]}t          |          S r0   )_Tool_to_mldevr2   s     r#   r5   z7_CreateCachedContentConfig_to_mldev.<locals>.<listcomp>   r6   r%   tool_config
toolConfigkms_key_nameztkms_key_name parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.)r   r   t
t_contentsr9   	t_content_ToolConfig_to_mldevr    r!   s     @r#   #_CreateCachedContentConfig_to_mldevrS      s@    !)	+w+kE7!;!;<<<	+''3[=/(J(JKKK	+'((4kN;K)L)LMMM	+
|$$0		
 	
 	
 	
T+
|%D%DEE	
 	
 	
   
+,-..:	K[+?*@AABBI	
 	
   
+y!!-			
 	
 	
 	
[7)44	
 	
 	
   
+''3	T+??KK   
+'((4
	<  
 
r%   c                    i t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          ?t          |dgfdt          j        t          | dg                    D                        t          | dg          At          |d	gt	          t          j        t          | dg                                         t          | d
g          -t          |d
gfdt          | d
g          D                        t          | dg          /t          |dgt          t          | dg                               t          | dg          "t          |ddgt          | dg                     S )NrA   rB   rC   r(   rD   rE   c                 0    g | ]}t          |          S r0   )r?   r2   s     r#   r5   z8_CreateCachedContentConfig_to_vertex.<locals>.<listcomp>   s3     	
 	
 	
 tY//	
 	
 	
r%   rG   rH   rI   c                 0    g | ]}t          |          S r0   )_Tool_to_vertexr2   s     r#   r5   z8_CreateCachedContentConfig_to_vertex.<locals>.<listcomp>   r>   r%   rL   rM   rN   encryption_spec
kmsKeyName)r   r   rO   rP   r?   rQ   _ToolConfig_to_vertexr!   s     @r#   $_CreateCachedContentConfig_to_vertexr[      sV    !)	+w+kE7!;!;<<<	+''3[=/(J(JKKK	+'((4kN;K)L)LMMM	+
|$$0		
 	
 	
 	
T+
|%D%DEE	
 	
 	
   
+,-..:	K[+?*@AABBI	
 	
   
+y!!-			
 	
 	
 	
[7)44	
 	
 	
   
+''3	d;@@)LL   
+'((4	L)[>*++   
r%   
api_clientc                     i }t          |dg          4t          |dgt          j        | t          |dg                               t          |dg          t	          t          |dg          |           |S Nmodelconfig)r   r   rO   t_caches_modelrS   r\   r   r   r"   s       r#   '_CreateCachedContentParameters_to_mldevrc   	  s    
 !)	+y!!-			T+y%A%ABB   
+z"".'[8*%%y   
r%   c                     i }t          |dg          4t          |dgt          j        | t          |dg                               t          |dg          t	          t          |dg          |           |S r^   )r   r   rO   ra   r[   rb   s       r#   (_CreateCachedContentParameters_to_vertexre     s    
 !)	+y!!-			T+y%A%ABB   
+z"".([8*%%y   
r%   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               |S Nname_urlr   r   rO   t_cached_content_namerb   s       r#   '_DeleteCachedContentParameters_to_mldevrl   3  \    
 !)	+x  ,		
Dvh,G,GHH   
r%   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               |S rg   rj   rb   s       r#   (_DeleteCachedContentParameters_to_vertexro   C  rm   r%   c                 n    i }t          | dg          !t          |dgt          | dg                     |S NsdkHttpResponsesdk_http_responser8   r!   s      r#   '_DeleteCachedContentResponse_from_mldevrt   S  P     !)	+)*++7'(${=N<O*P*P   
r%   c                 n    i }t          | dg          !t          |dgt          | dg                     |S rq   r8   r!   s      r#   (_DeleteCachedContentResponse_from_vertexrw   `  ru   r%   c                    i }t          | dg          t          d          t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nr(   r)   file_urifileUrir*   r+   )r   r    r   r!   s      r#   _FileData_to_mldevr{   m  s     !)	+'((4
	<  
 
+
|$$0YKkJ<!@!@AAA	+}%%1ZL${[M"B"BCCC	r%   c                    i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          t          d          t          | dg          t          d          |S )Nidargsrh   partial_argsztpartial_args parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.will_continuezuwill_continue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r!   s      r#   _FunctionCall_to_mldevr     s     !)	+v*TFDtf55666	+x  ,VHd;99:::	+x  ,VHd;99:::	+'((4
	<  
 
+())5
	<  
 
r%   c                    i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          t          d          |S )Nallowed_function_namesallowedFunctionNamesmodestream_function_call_argumentszstream_function_call_arguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r!   s      r#   _FunctionCallingConfig_to_mldevr     s     !)	+0122>	 [3455   
+x  ,VHd;99:::	+89::F
	M  
 
r%   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               |S rg   rj   rb   s       r#   $_GetCachedContentParameters_to_mldevr     rm   r%   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               |S rg   rj   rb   s       r#   %_GetCachedContentParameters_to_vertexr     rm   r%   c           
          i }t          | dg          /t          |dgt          t          | dg          |                     t          | dg          !t          |dgt          | dg                     |S )Nauth_config
authConfigenable_widgetenableWidget)r   r   r$   r!   s      r#   _GoogleMaps_to_mldevr     s     !)	+''3	T+??KK   
+())5^$d;8I&J&JKKK	r%   c                 R   i }t          | dg          !t          |dgt          | dg                     t          | dg          t          d          t          | dg          t          d          t          | dg          !t          |dgt          | dg                     |S )	Nsearch_typessearchTypesblocking_confidencez{blocking_confidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.exclude_domainszwexclude_domains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.time_range_filtertimeRangeFilterr   r!   s      r#   _GoogleSearch_to_mldevr     s     !)	+'((4]OT+7G%H%HIII	+-.//;
	B  
 
+)*++7
	<  
 
++,--9%&[;N:O(P(P   
r%   c                     i }t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     |S N	page_size_querypageSize
page_token	pageTokenr8   r!   s      r#   "_ListCachedContentsConfig_to_mldevr          !)	+}%%1*-tK+/O/O   
+~&&2	;[<.))   
r%   c                     i }t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     |S r   r8   r!   s      r#   #_ListCachedContentsConfig_to_vertexr     r   r%   c                 j    i }t          | dg          t          t          | dg          |           |S Nr`   )r   r   r!   s      r#   &_ListCachedContentsParameters_to_mldevr   .  s=     !)	+z"".&tK('D'DiPPP	r%   c                 j    i }t          | dg          t          t          | dg          |           |S r   )r   r   r!   s      r#   '_ListCachedContentsParameters_to_vertexr   9  sF     !)	+z"".'[8*%%y   
r%   c           	      J   i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          +t          |dgd t          | dg          D                        |S )Nrr   rs   nextPageTokennext_page_tokencachedContentscached_contentsc                     g | ]}|S r0   r0   r3   r4   s     r#   r5   z:_ListCachedContentsResponse_from_mldev.<locals>.<listcomp>W      @@@$@@@r%   r8   r!   s      r#   &_ListCachedContentsResponse_from_mldevr   F       !)	+)*++7'(${=N<O*P*P   
+())5&'kO;L)M)MNNN	+()**6	@@${-=,>??@@@   
r%   c           	      J   i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          +t          |dgd t          | dg          D                        |S )Nrr   rs   r   r   r   r   c                     g | ]}|S r0   r0   r   s     r#   r5   z;_ListCachedContentsResponse_from_vertex.<locals>.<listcomp>n  r   r%   r8   r!   s      r#   '_ListCachedContentsResponse_from_vertexr   ]  r   r%   c           
         i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          /t          |dgt          t          | dg          |                     t          | d	g          /t          |d
gt          t          | d	g          |                     t          | dg          !t          |dgt          | dg                     t          | dg          /t          |dgt	          t          | dg          |                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nmedia_resolutionmediaResolutioncode_execution_resultcodeExecutionResultexecutable_codeexecutableCode	file_datafileDatafunction_callfunctionCallfunction_responsefunctionResponseinline_data
inlineDatatextthoughtthought_signaturethoughtSignaturevideo_metadatavideoMetadata	tool_calltoolCalltool_responsetoolResponsepart_metadatapartMetadata)r   r   r{   r   r,   r!   s      r#   r1   r1   t  s]    !)	+*+,,8%&[;M:N(O(O   
+/011=	[2344   
+)*++7%&[;L:M(N(NOOO	+}%%1	4k];;YGG   
+())5	tK/1BCCYOO   
++,--9	[./00   
+''3	tK-999EE   
+x  ,VHd;99:::	+	{##/YKkI;!?!?@@@	++,--9	[./00   
+()**6_%tK:J9K'L'LMMM	+}%%1ZL${[M"B"BCCC	+())5^$d;8I&J&JKKK	+())5^$d;8I&J&JKKK	r%   c                    i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | d	g          !t          |d
gt          | d	g                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          t          d          t          | dg          t          d          t          | dg          t          d          |S )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   zqtool_call parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   zutool_response parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   zupart_metadata parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r!   s      r#   r=   r=     s    !)	+*+,,8%&[;M:N(O(O   
+/011=	[2344   
+)*++7%&[;L:M(N(NOOO	+}%%1ZL${[M"B"BCCC	+())5^$d;8I&J&JKKK	++,--9	[./00   
+''3\ND}o$F$FGGG	+x  ,VHd;99:::	+	{##/YKkI;!?!?@@@	++,--9	[./00   
+()**6_%tK:J9K'L'LMMM	+}%%1
	9  
 
+())5
	?  
 
+())5
	?  
 
r%   c           
      R   i }t          | dg          !t          |dgt          | dg                     t          | dg          /t          |dgt          t          | dg          |                     t          | dg          !t          |dgt          | dg                     |S )Nretrieval_configretrievalConfigfunction_calling_configfunctionCallingConfig$include_server_side_tool_invocations includeServerSideToolInvocations)r   r   r   r!   s      r#   rR   rR   	  s     !)	+*+,,8%&[;M:N(O(O   
+1233?	 !'89::I	
 	
   
+>?@@L	+,[ABCC   
r%   c                    i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          t          d          |S )Nr   r   r   r   r   zinclude_server_side_tool_invocations parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r!   s      r#   rZ   rZ   &  s     !)	+*+,,8%&[;M:N(O(O   
+1233?	 ![4566   
+>?@@L
	   
r%   c           
         i }t          | dg          t          d          t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          /t          |dgt          t          | dg          |                     t          | d	g          /t          |d
gt	          t          | d	g          |                     t          | dg          !t          |dgt          | dg                     t          | dg          t          d          t          | dg          +t          |dgd t          | dg          D                        t          | dg          !t          |dgt          | dg                     t          | dg          t          d          t          | dg          !t          |dgt          | dg                     t          | dg          +t          |dgd t          | dg          D                        |S )N	retrievalzqretrieval parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.computer_usecomputerUsefile_search
fileSearchgoogle_searchgoogleSearchgoogle_maps
googleMapscode_executioncodeExecutionenterprise_web_searchz}enterprise_web_search parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.function_declarationsfunctionDeclarationsc                     g | ]}|S r0   r0   r   s     r#   r5   z"_Tool_to_mldev.<locals>.<listcomp>m      GGG$GGGr%   google_search_retrievalgoogleSearchRetrievalparallel_ai_searchzzparallel_ai_search parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.url_context
urlContextmcp_servers
mcpServersc                     g | ]}|S r0   r0   r   s     r#   r5   z"_Tool_to_mldev.<locals>.<listcomp>  s    ===$===r%   )r   r    r   r   r   r!   s      r#   rK   rK   A  s    !)	+}%%1
	<  
 
+'((4]OT+7G%H%HIII	+''3\ND}o$F$FGGG	+())5	tK/1BCCYOO   
+''3	T+??KK   
+()**6_%tK:J9K'L'LMMM	+/011=
	B  
 
+/011=	 GG${-D,EFFGGG   
+1233?	 ![4566   
+,-..:
	B  
 
+''3\ND}o$F$FGGG	+''3	==${]O<<===   
r%   c           	         i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          t          d          t          | dg          !t          |dgt          | dg                     t          | dg          !t          |d	gt          | dg                     t          | d
g          !t          |dgt          | d
g                     t          | dg          !t          |dgt          | dg                     t          | dg          +t          |dgd t          | dg          D                        t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          t          d          |S )Nr   r   r   r   zsfile_search parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r   r   r   r   r   r   enterpriseWebSearchr   r   c                     g | ]}|S r0   r0   r   s     r#   r5   z#_Tool_to_vertex.<locals>.<listcomp>  r   r%   r   r   r   parallelAiSearchr   r   r   zsmcp_servers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r!   s      r#   rW   rW     s    !)	+}%%1[M4k]#C#CDDD	+'((4]OT+7G%H%HIII	+''3
	9  
 
+())5^$d;8I&J&JKKK	+''3\ND}o$F$FGGG	+()**6_%tK:J9K'L'LMMM	+/011=	[2344   
+/011=	 GG${-D,EFFGGG   
+1233?	 ![4566   
+,-..:	[/011   
+''3\ND}o$F$FGGG	+''3
	9  
 
r%   c                     i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S NrA   rB   rC   r8   r!   s      r#   #_UpdateCachedContentConfig_to_mldevr     s     !)	+w+kE7!;!;<<<	+''3[=/(J(JKKK	r%   c                     i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S r   r8   r!   s      r#   $_UpdateCachedContentConfig_to_vertexr     r   r%   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          t	          t          |dg          |           |S Nrh   ri   r`   )r   r   rO   rk   r   rb   s       r#   '_UpdateCachedContentParameters_to_mldevr     s    
 !)	+x  ,		
Dvh,G,GHH   
+z"".'[8*%%y   
r%   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          t	          t          |dg          |           |S r   )r   r   rO   rk   r   rb   s       r#   (_UpdateCachedContentParameters_to_vertexr    s    
 !)	+x  ,		
Dvh,G,GHH   
+z"".([8*%%y   
r%   c                   n   e Zd Zdddedeej                 dej        fdZdddedeej	                 dej        fdZ
dddedeej                 dej        fd	Zdddedeej                 dej        fd
Zdddeej                 dej        fdZdddeej                 deej                 fdZdS )CachesNr`   r_   r`   r   c                   t          j        ||          }| j        j        rEt	          | j        |          }|                    d          }|rd                    |          }nGd}nDt          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||          }	|	j        si nt#          j        |	j                  }
t           j                            |
t+          |dd          rDdt+          |j
        d	d          t+          |j
        d
d          t+          |j
        dd          dini           }| j                            |           |S )a  Creates a cached contents resource.

    Usage:

    .. code-block:: python

      contents = ... // Initialize the content to cache.
      response = client.caches.create(
          model= ... // The publisher model id
          contents=contents,
          config={
              'display_name': 'test cache',
              'system_instruction': 'What is the sum of the two pdfs?',
              'ttl': '86400s',
          },
      )
    r_   r`   ri   r   r   ?r`   Npostresponse_schemaresponse_json_schemainclude_all_fieldsr
  r  r  responsekwargs)r   _CreateCachedContentParameters_api_clientvertexaire   get
format_maprc   r   popr`   http_optionsr	   convert_to_dictencode_unserializable_typesrequestbodyjsonloadsCachedContent_from_responsegetattr_verify_responseselfr_   r`   parameter_modelrequest_dictrequest_url_dictpathquery_paramsr  r  response_dictreturn_values               r#   createzCaches.create  s`   0 :  O    =

O l &))&11	  **+;<<<

O l &))&11	  **+;<<##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM&55 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 6  L& 	%%l333r%   rh   c                   t          j        ||          }| j        j        rEt	          | j        |          }|                    d          }|rd                    |          }nGd}nDt          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||          }	|	j        si nt#          j        |	j                  }
t           j                            |
t+          |dd          rDdt+          |j
        d	d          t+          |j
        d
d          t+          |j
        dd          dini           }| j                            |           |S )zGets cached content configurations.

    .. code-block:: python

      client.caches.get(name= ... ) // The server-generated resource name.
    rh   r`   ri   {name}r   r  r`   Nr  r
  r  r  r  r  )r   _GetCachedContentParametersr  r  r   r  r  r   r   r  r`   r  r	   r  r  r  r  r  r  r  r  r   r!  r#  rh   r`   r$  r%  r&  r'  r(  r  r  r)  r*  s               r#   r  z
Caches.gets  sY    7  O   :

O l &))&11	 ""#3449

O l &))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''t\<PPH&mJBBHM1J1JM&55 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 6  L& 	%%l333r%   c                   t          j        ||          }| j        j        rEt	          | j        |          }|                    d          }|rd                    |          }nGd}nDt          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||          }	|	j        si nt#          j        |	j                  }
| j        j        rt'          |
          }
| j        j        st)          |
          }
t           j                            |
t/          |dd          rDdt/          |j
        d	d          t/          |j
        d
d          t/          |j
        dd          dini           }t          j        |	j                  |_        | j                            |           |S )zDeletes cached content.

    Usage:

    .. code-block:: python

      client.caches.delete(name= ... ) // The server-generated resource name.
    r-  ri   r.  r   r  r`   Ndeleter
  r  r  r  r  headers)r   _DeleteCachedContentParametersr  r  ro   r  r  rl   r   r  r`   r  r	   r  r  r  r  r  r  rw   rt   DeleteCachedContentResponser  r   HttpResponser4  rs   r!  r0  s               r#   r2  zCaches.delete  s    :  O   =

O l &))&11	 ""#344<

O l &))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''$l H 'mJBBHM1J1JM  N>}MMm$ M=mLLm4CC ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! D  L$ &+%7 & & &L" 	%%l333r%   c                   t          j        ||          }| j        j        rEt	          | j        |          }|                    d          }|rd                    |          }nGd}nDt          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||          }	|	j        si nt#          j        |	j                  }
t           j                            |
t+          |dd          rDdt+          |j
        d	d          t+          |j
        d
d          t+          |j
        dd          dini           }| j                            |           |S )zUpdates cached content configurations.

    .. code-block:: python

      response = client.caches.update(
          name= ... // The server-generated resource name.
          config={
              'ttl': '7600s',
          },
      )
    r-  ri   r.  r   r  r`   Npatchr
  r  r  r  r  )r   _UpdateCachedContentParametersr  r  r  r  r  r   r   r  r`   r  r	   r  r  r  r  r  r  r  r  r   r!  r0  s               r#   updatezCaches.update  s`   $ :  O   =

O l &))&11	 ""#344<

O l &))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''|\ H 'mJBBHM1J1JM&55 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 6  L& 	%%l333r%   c                   t          j        |          }| j        j        r?t	          |          }|                    d          }|rd                    |          }nAd}n>t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||          }|j        si nt#          j        |j                  }	| j        j        rt'          |	          }	| j        j        st)          |	          }	t           j                            |	t/          |dd           rDdt/          |j
        dd           t/          |j
        d	d           t/          |j
        d
d           dini           }
t          j        |j                  |
_        | j                            |
           |
S Nr  ri   r   r   r  r`   r  r
  r  r  r  r  r3  )r   _ListCachedContentsParametersr  r  r   r  r  r   r   r  r`   r  r	   r  r  r  r  r  r  r   r   ListCachedContentsResponser  r   r7  r4  rs   r!  r#  r`   r$  r%  r&  r'  r(  r  r  r)  r*  s              r#   _listzCaches._listv  s    9  O    <_MMl%))&11	  **+;<<;OLLl%))&11	  **+;<<##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''t\<PPH&mJBBHM1J1JM  M=mLLm$ L<]KKm3BB ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! C  L$ &+%7 & & &L" 	%%l333r%   c                \    | j         }t          d||                      |          |          S )a  Lists cached contents.

    Args:
      config (ListCachedContentsConfig): Optional configuration for the list
        request.

    Returns:
      A Pager object that contains one page of cached contents. When iterating
      over
      the pager, it automatically fetches the next page if there are more.

    Usage:

    .. code-block:: python
      for cached_content in client.caches.list():
        print(cached_content.name)
    r   r  )rA  r   r#  r`   list_requests      r#   listzCaches.list  s7    * :L

&
!!	  r%   )__name__
__module____qualname__strr   r   CreateCachedContentConfigOrDictr  r+  GetCachedContentConfigOrDictr  DeleteCachedContentConfigOrDictr6  r2  UpdateCachedContentConfigOrDictr;  ListCachedContentsConfigOrDictr?  rA  r   rE  r0   r%   r#   r  r    s        AE	[ [ [ [ u<=	[
 [ [ [ [B >B	N N N N u9:	N
 N N N Nh AE	Z Z Z Z u<=	Z
 (Z Z Z Z@ AE	U U U U u<=	U
 U U U Up IMG G G DEG'G G G GT IM   DEU !     r%   r  c                   n   e Zd Zdddedeej                 dej        fdZdddedeej	                 dej        fdZ
dddedeej                 dej        fd	Zdddedeej                 dej        fd
Zdddeej                 dej        fdZdddeej                 deej                 fdZdS )AsyncCachesNr  r_   r`   r   c                  K   t          j        ||          }| j        j        rEt	          | j        |          }|                    d          }|rd                    |          }nGd}nDt          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||           d{V }	|	j        si nt#          j        |	j                  }
t           j                            |
t+          |dd          rDdt+          |j
        d	d          t+          |j
        d
d          t+          |j
        dd          dini           }| j                            |           |S )a  Creates a cached contents resource.

    Usage:

    .. code-block:: python

      contents = ... // Initialize the content to cache.
      response = await client.aio.caches.create(
          model= ... // The publisher model id
          contents=contents,
          config={
              'display_name': 'test cache',
              'system_instruction': 'What is the sum of the two pdfs?',
              'ttl': '86400s',
          },
      )
    r  ri   r   r   r  r`   Nr	  r
  r  r  r  r  )r   r  r  r  re   r  r  rc   r   r  r`   r  r	   r  r  async_requestr  r  r  r  r  r   r!  r"  s               r#   r+  zAsyncCaches.create  s     0 :  O    =

O l &))&11	  **+;<<<

O l &))&11	  **+;<<##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H 'mJBBHM1J1JM&55 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 6  L& 	%%l333r%   rh   c                  K   t          j        ||          }| j        j        rEt	          | j        |          }|                    d          }|rd                    |          }nGd}nDt          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||           d{V }	|	j        si nt#          j        |	j                  }
t           j                            |
t+          |dd          rDdt+          |j
        d	d          t+          |j
        d
d          t+          |j
        dd          dini           }| j                            |           |S )zGets cached content configurations.

    .. code-block:: python

      await client.aio.caches.get(name= ... ) // The server-generated resource
      name.
    r-  ri   r.  r   r  r`   Nr  r
  r  r  r  r  )r   r/  r  r  r   r  r  r   r   r  r`   r  r	   r  r  rR  r  r  r  r  r  r   r!  r0  s               r#   r  zAsyncCaches.get<  s      7  O   :

O l &))&11	 ""#3449

O l &))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33t\<       H 'mJBBHM1J1JM&55 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 6  L& 	%%l333r%   c                  K   t          j        ||          }| j        j        rEt	          | j        |          }|                    d          }|rd                    |          }nGd}nDt          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||           d{V }	|	j        si nt#          j        |	j                  }
| j        j        rt'          |
          }
| j        j        st)          |
          }
t           j                            |
t/          |dd          rDdt/          |j
        d	d          t/          |j
        d
d          t/          |j
        dd          dini           }t          j        |	j                  |_        | j                            |           |S )zDeletes cached content.

    Usage:

    .. code-block:: python

      await client.aio.caches.delete(name= ... ) // The server-generated
      resource name.
    r-  ri   r.  r   r  r`   Nr2  r
  r  r  r  r  r3  )r   r5  r  r  ro   r  r  rl   r   r  r`   r  r	   r  r  rR  r  r  r  rw   rt   r6  r  r   r7  r4  rs   r!  r0  s               r#   r2  zAsyncCaches.delete  s       :  O   =

O l &))&11	 ""#344<

O l &))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33$l       H 'mJBBHM1J1JM  N>}MMm$ M=mLLm4CC ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! D  L$ &+%7 & & &L" 	%%l333r%   c                  K   t          j        ||          }| j        j        rEt	          | j        |          }|                    d          }|rd                    |          }nGd}nDt          | j        |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd           d}|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||           d{V }	|	j        si nt#          j        |	j                  }
t           j                            |
t+          |dd          rDdt+          |j
        d	d          t+          |j
        d
d          t+          |j
        dd          dini           }| j                            |           |S )zUpdates cached content configurations.

    .. code-block:: python

      response = await client.aio.caches.update(
          name= ... // The server-generated resource name.
          config={
              'ttl': '7600s',
          },
      )
    r-  ri   r.  r   r  r`   Nr9  r
  r  r  r  r  )r   r:  r  r  r  r  r  r   r   r  r`   r  r	   r  r  rR  r  r  r  r  r  r   r!  r0  s               r#   r;  zAsyncCaches.update  s     $ :  O   =

O l &))&11	 ""#344<

O l &))&11	 ""#344##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33|\       H 'mJBBHM1J1JM&55 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! 6  L& 	%%l333r%   c                  K   t          j        |          }| j        j        r?t	          |          }|                    d          }|rd                    |          }nAd}n>t          |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }|j
        |j
        j        |j
        j        }t          j        |          }t          j        |          }| j                            d|||           d {V }|j        si nt#          j        |j                  }	| j        j        rt'          |	          }	| j        j        st)          |	          }	t           j                            |	t/          |dd           rDdt/          |j
        dd           t/          |j
        d	d           t/          |j
        d
d           dini           }
t          j        |j                  |
_        | j                            |
           |
S r=  )r   r>  r  r  r   r  r  r   r   r  r`   r  r	   r  r  rR  r  r  r  r   r   r?  r  r   r7  r4  rs   r!  r@  s              r#   rA  zAsyncCaches._listC  s      9  O    <_MMl%))&11	  **+;<<;OLLl%))&11	  **+;<<##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33t\<       H 'mJBBHM1J1JM  M=mLLm$ L<]KKm3BB ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! C  L$ &+%7 & & &L" 	%%l333r%   c                l   K   | j         }t          d||                      |           d{V |          S )a  Lists cached contents asynchronously.

    Args:
      config (ListCachedContentsConfig): Optional configuration for the list
        request.

    Returns:
      A Pager object that contains one page of cached contents. When iterating
      over
      the pager, it automatically fetches the next page if there are more.

    Usage:

    .. code-block:: python
      async for cached_content in await client.aio.caches.list():
        print(cached_content.name)
    r   r  N)rA  r   rC  s      r#   rE  zAsyncCaches.list  sM      * :Ljjj''''''''	  r%   )rF  rG  rH  rI  r   r   rJ  r  r+  rK  r  rL  r6  r2  rM  r;  rN  r?  rA  r   rE  r0   r%   r#   rP  rP    s        AE	[ [ [ [ u<=	[
 [ [ [ [B >B	Q Q Q Q u9:	Q
 Q Q Q Qn AE	[ [ [ [ u<=	[
 ([ [ [ [B AE	U U U U u<=	U
 U U U Up IMI I I DEI'I I I IX IM   DE%%&     r%   rP  )N)Br  loggingtypingr   r   r   urllib.parser    r   r	   r
   rO   r   r  r   r   r   r   r   pagersr   r   	getLoggerloggerdictrI  objectr$   r,   r9   r?   rS   r[   rc   re   rl   ro   rt   rw   r{   r   r   r   r   r   r   r   r   r   r   r   r   r1   r=   rR   rZ   rK   rW   r   r   r   r  
BaseModuler  rP  r0   r%   r#   <module>rb     s  $   ' ' ' ' ' ' ' ' ' ' " " " " " "                               & & & & & & . . . . . . . . . . . . % % % % % % % %		0	1	1
 /3, ,tCH~v-.,DcN+, 
#s(^, , , ,b /3 tCH~v-.DcN+ 
#s(^   , /3 tCH~v-.DcN+ 
#s(^   . /3 tCH~v-.DcN+ 
#s(^   . /39 9tCH~v-.9DcN+9 
#s(^9 9 9 9| /3: :tCH~v-.:DcN+: 
#s(^: : : :@ /3 tCH~v-. DcN+ 
#s(^	   0 /3 tCH~v-. DcN+ 
#s(^	   0 /3 tCH~v-. DcN+ 
#s(^	   & /3 tCH~v-. DcN+ 
#s(^	   $ /3
 
tCH~v-.
DcN+
 
#s(^
 
 
 
 /3
 
tCH~v-.
DcN+
 
#s(^
 
 
 
 /3 tCH~v-.DcN+ 
#s(^   , /3 tCH~v-.DcN+ 
#s(^   > /3 tCH~v-.DcN+ 
#s(^   6 /3 tCH~v-. DcN+ 
#s(^	   & /3 tCH~v-. DcN+ 
#s(^	   $ /3 tCH~v-.DcN+ 
#s(^   ( /3 tCH~v-.DcN+ 
#s(^   < /3 tCH~v-.DcN+ 
#s(^   . /3 tCH~v-.DcN+ 
#s(^   . /3 tCH~v-.DcN+ 
#s(^    /3
 
tCH~v-.
DcN+
 
#s(^
 
 
 
 /3 tCH~v-.DcN+ 
#s(^   2 /3 tCH~v-.DcN+ 
#s(^   2 /3I ItCH~v-.IDcN+I 
#s(^I I I I\ /3F FtCH~v-.FDcN+F 
#s(^F F F FV /3 tCH~v-.DcN+ 
#s(^   > /3 tCH~v-.DcN+ 
#s(^   : /3F FtCH~v-.FDcN+F 
#s(^F F F FV /3? ?tCH~v-.?DcN+? 
#s(^? ? ? ?H /3 tCH~v-.DcN+ 
#s(^   " /3 tCH~v-.DcN+ 
#s(^   $ /3 tCH~v-. DcN+ 
#s(^	   0 /3 tCH~v-. DcN+ 
#s(^	   *F F F F F[# F F FRL L L L L+( L L L L Lr%   