
    hj=                    $K   d dl Z d dlZd dlZd dlmZmZmZ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 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!deddfdZ"deddfdZ#deddfdZ$	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ(	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ)	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ*	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ+	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ,	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d Z-	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd!Z.	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd"Z/	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd#Z0	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd$Z1	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd%Z2	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd&Z3	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd'Z4	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd(Z5	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd)Z6	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d*Z7	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d+Z8	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd,Z9	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd-Z:	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d.Z;	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d/Z<	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd0Z=	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd1Z>	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd2Z?	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d3Z@	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd4ZA	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd5ZB	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd6ZC	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d7ZD	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d8ZE	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd9ZF	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd:ZG	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd;ZH	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd<ZI	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd=ZJ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd>ZK	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd?ZL	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d@ZM	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dAZN	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dBZO	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dCZP	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdDZQ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdEZR	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdFZS	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdGZT	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dHZU	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dIZV	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdJZW	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdKZX	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdLZY	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdMZZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdNZ[	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdOZ\	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dPZ]	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dQZ^	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdRZ_	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdSZ`	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdTZa	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdUZb	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdVZc	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdWZd	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdXZe	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdYZf	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZZg	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd[Zh	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d\Zi	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
d]Zj	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd^Zk	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd_Zl	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd`Zm	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdaZn	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdbZo	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdcZp	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fddZq	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdeZr	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dfZs	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dgZt	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dhZu	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
diZv	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdjZw	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdkZx	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdlZy	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdmZz	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdnZ{	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdoZ|	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdpZ}	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdqZ~	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdrZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdsZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdtZ	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
duZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdvZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdwZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdxZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdyZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdzZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd{Z	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd|Z	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd}Z	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fd~Z	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dZ	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 ddede	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         f
dZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ	 	 dde	e%e&ef         e'f         dee%e&ef                  dee	e%e&ef         e'f                  de%e&ef         fdZ G d dej                  Z G d dej                  ZdS )    N)AnyAsyncIterator	AwaitableIteratorOptionalUnion)	urlencode   )_api_module)_base_transformers)_common)_extra_utils)
_mcp_utils)_transformers)errors)types)BaseApiClient)get_value_by_path)set_value_by_path)
AsyncPagerPagerzgoogle_genai.models
enum_valuereturnc                 N    | t          dg          v rt          |  d          d S )N	ALLOW_ALLi enum value is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.set
ValueErrorr   s    W/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/google/genai/models.py(_PersonGeneration_to_mldev_enum_validater"   (   sC    3}%%%%
 	< 	< 	<   &%    c                 N    | t          dg          v rt          |  d          d S )N
BLOCK_NONEr   r   r    s    r!   )_SafetyFilterLevel_to_mldev_enum_validater&   0   sC    3~&&&&
 	< 	< 	<   '&r#   c                 N    | t          dg          v rt          |  d          d S )NSTYLEr   r   r    s    r!   4_VideoGenerationReferenceType_to_mldev_enum_validater)   8   sC     3y>>!!
 	< 	< 	<   "!r#   from_objectparent_objectroot_objectc                    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setvr   r*   r+   r,   	to_objects       r!   _AuthConfig_to_mldevr;   B   sL   
 !)	+	{##/XJ[9+ > >???	+()**6
	<  
 
+}%%1
	<  
 
+7899E
	M  
 
+0122>
	M  
 
+'((4
	<  
 
+''3
	<  
 
r#   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mimeTyper6   r9   s       r!   _Blob_to_mldevrB   r   s    
 !)	+x  ,VHd;99:::	+'((4
	<  
 
+}%%1ZL${[M"B"BCCC	r#   c           
      $   i }t          | dg          !t          |dgt          | dg                     t          | dg          0t          |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d t          | dg          D                        t          | dg          !t          |dgt          | dg                     |S )NcontentcitationMetadatacitation_metadata
tokenCounttoken_countfinishReasonfinish_reasongroundingMetadatagrounding_metadataavgLogprobsavg_logprobsindexlogprobsResultlogprobs_resultsafetyRatingssafety_ratingsc                     g | ]}|S  rU   .0items     r!   
<listcomp>z)_Candidate_from_mldev.<locals>.<listcomp>   s    ???$???r#   urlContextMetadataurl_context_metadata)r7   r8   _CitationMetadata_from_mldevr9   s       r!   _Candidate_from_mldevr]      sj   
 !)	+	{##/YKkI;!?!?@@@	+*+,,8	$1233Y	
 	
   
+~&&2]OT+~%F%FGGG	+'((4_%tK.9I'J'JKKK	++,--9	[./00   
+''3^$d;&H&HIII	+y!!-WItK';;<<<	+()**6&'k<L;M)N)NOOO	+())5	??${_,=>>???   
+,-..:	 [/011   
r#   c           	          i }t          | dg          +t          |dgd t          | dg          D                        |S )NcitationSources	citationsc                     g | ]}|S rU   rU   rV   s     r!   rY   z0_CitationMetadata_from_mldev.<locals>.<listcomp>       AAA$AAAr#   r7   r8   r9   s       r!   r\   r\      s^    
 !)	+)*++7	AA${->,?@@AAA   
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outcomeoutputidjid parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r6   r9   s       r!   _CodeExecutionResult_to_vertexri      s    
 !)	+	{##/YKkI;!?!?@@@	+z"".XJ[8* = =>>>	+v*
	2  
 
r#   
api_clientc                 <   i t          |dg          5t          ddgt          j        | t          |dg                               t          |dg          @t          dgfdt          j        t          |dg                    D                        S )Nmodel_urlcontentsc                 2    g | ]}t          |          S rU   _Content_to_vertexrW   rX   r,   r:   s     r!   rY   z6_ComputeTokensParameters_to_vertex.<locals>.<listcomp>   5     	
 	
 	
 tY<<	
 	
 	
r#   )r7   r8   tt_model
t_contentsrj   r*   r+   r,   r:   s      `@r!   "_ComputeTokensParameters_to_vertexrx      s     !)	+y!!-			*d;	::;;   
+
|$$0		
 	
 	
 	
 	
T+
|%D%DEE	
 	
 	
   
r#   c           	          i }t          | dg          !t          |dgt          | dg                     t          | dg          +t          |dgd t          | dg          D                        |S )NsdkHttpResponsesdk_http_response
tokensInfotokens_infoc                     g | ]}|S rU   rU   rV   s     r!   rY   z6_ComputeTokensResponse_from_vertex.<locals>.<listcomp>      <<<$<<<r#   rc   r9   s       r!   "_ComputeTokensResponse_from_vertexr      s    
 !)	+)*++7'(${=N<O*P*P   
+~&&2	<<${\N;;<<<   
r#   c                 v   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          |S )Nenvironmentexcluded_predefined_functionsexcludedPredefinedFunctions!enable_prompt_injection_detectionenablePromptInjectionDetectiondisabled_safety_policieszdisabled_safety_policies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r6   r9   s       r!   _ComputerUse_to_vertexr     s    
 !)	+''3]OT+%G%GHHH	+7899E	&'[:;<<   
+;<==I	)*[>?@@   
+2344@
	M  
 
r#   c                     i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )N	truncatedrH   rc   r9   s       r!   '_ContentEmbeddingStatistics_from_vertexr   5  ss    
 !)	+}%%1[M4k]#C#CDDD	+''3]OT+%G%GHHH	r#   c           
          i }t          | dg          !t          |dgt          | dg                     t          | dg          0t          |dgt          t          | dg          ||                     |S )Nvalues
statistics)r7   r8   r   r9   s       r!   _ContentEmbedding_from_vertexr   D  s    
 !)	+z"".XJ[8* = =>>>	+~&&2	/|n--y+	
 	
   
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                 2    g | ]}t          |          S rU   )_Part_to_mldevrr   s     r!   rY   z%_Content_to_mldev.<locals>.<listcomp>c  s5     	
 	
 	
 4K88	
 	
 	
r#   rolerc   r9   s     `@r!   _Content_to_mldevr   Y      
 !)	+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                 2    g | ]}t          |          S rU   )_Part_to_vertexrr   s     r!   rY   z&_Content_to_vertex.<locals>.<listcomp>y  5     	
 	
 	
 D)[99	
 	
 	
r#   r   rc   r9   s     `@r!   rq   rq   o  r   r#   c                     i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Ncontrol_typecontrolType enable_control_image_computationcomputeControlrc   r9   s       r!   !_ControlReferenceConfig_to_vertexr     s    
 !)	+'((4]OT+7G%H%HIII	+:;<<H	[=>??   
r#   c                     i }t          | dg          t          d          t          | dg          t          d          t          | dg          t          d          |S )Nsystem_instructionzzsystem_instruction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.toolszmtools parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.generation_configzygeneration_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r7   r   r9   s       r!   _CountTokensConfig_to_mldevr     s    
 !)	+,-..:
	B  
 
+y!!-
	3  
 
++,--9
	B  
 
r#   c                    i t          | dg          Bt          |dgt          t          j        t          | dg                                         t          | dg          .t          |dgfdt          | dg          D                        t          | dg          0t          |dgt          t          | dg                               S )Nr   systemInstructionr   c                 2    g | ]}t          |          S rU   )_Tool_to_vertexrr   s     r!   rY   z0_CountTokensConfig_to_vertex.<locals>.<listcomp>  r   r#   r   generationConfig)r7   r8   rq   rt   	t_content_GenerationConfig_to_vertexr9   s     `@r!   _CountTokensConfig_to_vertexr     s(   
 !)	+,-..:	K[+?*@AABB	
 	
   
+y!!-			
 	
 	
 	
 	
[7)44	
 	
 	
   
++,--9	#2344i	
 	
   
r#   c                    i t          |dg          5t          ddgt          j        | t          |dg                               t          |dg          @t          dgfdt          j        t          |dg                    D                        t          |dg           t          t          |dg                     S )Nrl   rm   rn   c                 2    g | ]}t          |          S rU   r   rr   s     r!   rY   z3_CountTokensParameters_to_mldev.<locals>.<listcomp>  5     	
 	
 	
 dI{;;	
 	
 	
r#   config)r7   r8   rt   ru   rv   r   rw   s      `@r!   _CountTokensParameters_to_mldevr     s    !)	+y!!-			*d;	::;;   
+
|$$0		
 	
 	
 	
 	
T+
|%D%DEE	
 	
 	
   
+z"".[8*%%y+   
r#   c                    i t          |dg          5t          ddgt          j        | t          |dg                               t          |dg          @t          dgfdt          j        t          |dg                    D                        t          |dg           t          t          |dg                     S )Nrl   rm   rn   c                 2    g | ]}t          |          S rU   rp   rr   s     r!   rY   z4_CountTokensParameters_to_vertex.<locals>.<listcomp>  rs   r#   r   )r7   r8   rt   ru   rv   r   rw   s      `@r!    _CountTokensParameters_to_vertexr     s    !)	+y!!-			*d;	::;;   
+
|$$0		
 	
 	
 	
 	
T+
|%D%DEE	
 	
 	
   
+z"". [8*%%y+   
r#   c                 6   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                     |S )Nrz   r{   totalTokenstotal_tokenscachedContentTokenCountcached_content_token_countrc   r9   s       r!   _CountTokensResponse_from_mldevr     s    
 !)	+)*++7'(${=N<O*P*P   
+''3^$d;&H&HIII	+1233?	%&[4566   
r#   c                     i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nrz   r{   r   r   rc   r9   s       r!    _CountTokensResponse_from_vertexr   4  s    
 !)	+)*++7'(${=N<O*P*P   
+''3^$d;&H&HIII	r#   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               |S Nrl   rm   namer7   r8   rt   ru   rw   s        r!   _DeleteModelParameters_to_mldevr   E  [     !)	+y!!-			*d;	::;;   
r#   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               |S r   r   rw   s        r!    _DeleteModelParameters_to_vertexr   V  r   r#   c                 n    i }t          | dg          !t          |dgt          | dg                     |S Nrz   r{   rc   r9   s       r!   _DeleteModelResponse_from_mldevr   g  P    
 !)	+)*++7'(${=N<O*P*P   
r#   c                 n    i }t          | dg          !t          |dgt          | dg                     |S r   rc   r9   s       r!    _DeleteModelResponse_from_vertexr   u  r   r#   c                    i }t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |dd	gt          | dg                     t          | d
g          "t          |ddgt          | d
g                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |g d t          | dg                     |S )!Noutput_gcs_uri
parameters
storageUrinegative_promptnegativePromptnumber_of_imagessampleCountaspect_ratioaspectRatioguidance_scaleguidanceScaleseedsafety_filter_levelsafetySettingperson_generationpersonGenerationinclude_safety_attributesincludeSafetyAttributesinclude_rai_reasonincludeRaiReasonlanguageoutput_mime_typer   outputOptionsrA   output_compression_qualityr   r   compressionQualityadd_watermarkaddWatermarklabels	edit_modeeditMode
base_steps)r   
editConfig	baseStepsrc   r9   s       r!   _EditImageConfig_to_vertexr     si   
 !)	+()**6	|$[+,--   
+)*++7	'([,-..   
+*+,,8	}%[-.//   
+'((4	}%[>*++   
+()**6	'[+,--   
+x  ,v.[6(0K0KLLL	+-.//;	'[0122   
++,--9	)*[./00   
+3455A	01[6788   
+,-..:	)*[/011   
+
|$$0	z"[:,''   
+*+,,8333[-.//   
+4566B===[7899   
+())5	~&[?+,,   
+z"".
Dxj$A$ABBB	+}%%1	z"[;-((   
+~&&2111[<.))   
r#   c                    i t          |dg          5t          ddgt          j        | t          |dg                               t          |dg          "t          ddgt          |dg                     t          |dg          /t          ddgfdt          |dg          D                        t          |dg           t	          t          |dg                     S )	Nrl   rm   promptinstances[0]reference_imagesreferenceImagesc                 2    g | ]}t          |          S rU   )_ReferenceImageAPI_to_vertexrr   s     r!   rY   z2_EditImageParameters_to_vertex.<locals>.<listcomp>  s5     	
 	
 	
 )y+FF	
 	
 	
r#   r   )r7   r8   rt   ru   r   rw   s      `@r!   _EditImageParameters_to_vertexr     s8    !)	+y!!-			*d;	::;;   
+z"".^X.[8*0M0MNNN	+*+,,8	*+	
 	
 	
 	
 	
[+=*>??	
 	
 	
   
+z"".[8*%%y+   
r#   c           	          i t          | dg          !t          dgt          | dg                     t          | dg          .t          dgfdt          | dg          D                        S )Nrz   r{   predictionsgenerated_imagesc                 2    g | ]}t          |          S rU   _GeneratedImage_from_vertexrr   s     r!   rY   z2_EditImageResponse_from_vertex.<locals>.<listcomp>.  5     	
 	
 	
 (iEE	
 	
 	
r#   rc   r9   s     `@r!   _EditImageResponse_from_vertexr        
 !)	+)*++7'(${=N<O*P*P   
+''3		
 	
 	
 	
 	
[=/::	
 	
 	
   
r#   c                 <   i }t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |d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          |S )N	task_type
requests[]taskTypetitleoutput_dimensionalityoutputDimensionalityr@   zqmime_type parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.auto_truncatezuauto_truncate parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.document_ocrztdocument_ocr parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.audio_track_extractionz~audio_track_extraction parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r6   r9   s       r!   _EmbedContentConfig_to_mldevr  7  sz   
 !)	+}%%1	z"[;-((   
+y!!-w/kG91M1MNNN	+/011=	-.[2344   
+}%%1
	<  
 
+())5
	<  
 
+'((4
	<  
 
+0122>
	M  
 
r#   c                    i }t          |dg          }|d}|dk    r4t          | dg          "t          |ddgt          | dg                     n9|dk    r3t          | dg          "t          |ddgt          | dg                     t          |dg          }|d}|dk    r4t          | dg          "t          |ddgt          | dg                     n9|dk    r3t          | dg          "t          |ddgt          | dg                     t          |dg          }|d}|dk    r4t          | d	g          "t          |d
dgt          | d	g                     n9|dk    r3t          | d	g          "t          |ddgt          | d	g                     t          |dg          }|d}|dk    r3t          | dg          "t          |ddgt          | dg                     t          |dg          }|d}|dk    r4t          | dg          "t          |d
dgt          | dg                     n9|dk    r3t          | dg          "t          |ddgt          | dg                     t          |dg          }|d}|dk    r3t          | dg          "t          |ddgt          | dg                     t          |dg          }|d}|dk    r3t          | dg          "t          |ddgt          | dg                     |S )Nembedding_api_typePREDICTr  instances[]EMBED_CONTENTembedContentConfigr  r  r	  r   r
  r@   rA   r  autoTruncater  documentOcrr  audioTrackExtractionrc   )r*   r+   r,   r:   discriminators        r!   _EmbedContentConfig_to_vertexr  i  s1   
 !){%9$:;;-MiK+''3

+
&
{[M
*
*  
 ''K+''3


,
{[M
*
*   {%9$:;;-MiK'##/

-14gY3O3O   ''K'##/


)
{WI
&
&   {%9$:;;-MiK1233?

/
0
{45
6
6  
 ''K1233?

!7
8
{45
6
6   {%9$:;;-MiK+''3

*
%
{[M
*
*   {%9$:;;-MiK/*++7


(
{_-
.
.  
 ''K/*++7


0
{_-
.
.   {%9$:;;-Mo%%K.)**6


/
{^,
-
-   {%9$:;;-Mo%%K2344@

!7
8
{56
7
7   
r#   c                    i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          ?t          |ddgd t          j        | t          |dg                    D                        t          |dg          2t          t          j        t          |dg                    ||           t          |dg           t          t          |dg          ||           t          |ddgt          j        | t          |dg                               |S )Nrl   rm   rn   r  rD   c                     g | ]}|S rU   rU   rV   s     r!   rY   z;_EmbedContentParametersPrivate_to_mldev.<locals>.<listcomp>  s(     	
 	
 	
 	
 	
 	
r#   r   )r7   r8   rt   ru   t_contents_for_embedr   r   r  rw   s        r!   '_EmbedContentParametersPrivate_to_mldevr    s|    !)	+y!!-			*d;	::;;   
+
|$$0	y!	
 	
.Dzl;; 	
 	
 	
	 	 	 
+	{##/	Dyk2233Y   
+z"". [8*%%y+   Wi
Dwi8899  
 
r#   c                    i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          }|d}|dk    rPt          |dg          ?t          |ddgd t          j        | t          |dg                    D                        t          |dg          }|d}|d	k    rSt          |dg          Bt          |dgt          t          j        t          |dg                    ||                     t          |d
g           t          t          |d
g          ||           |S )Nrl   rm   r  r  rn   r  rD   c                     g | ]}|S rU   rU   rV   s     r!   rY   z<_EmbedContentParametersPrivate_to_vertex.<locals>.<listcomp>  s(          r#   r  r   )r7   r8   rt   ru   r  rq   r   r  )rj   r*   r+   r,   r:   r  s         r!   (_EmbedContentParametersPrivate_to_vertexr     s    !)	+y!!-			*d;	::;;   {%9$:;;-MiK*&&2

)
$ 0d;==   	 	 	 {%9$:;;-Mo%%K)%%1

+
k${YK8899    
+z"".![8*%%y+   
r#   c           	      J   i }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                     |S )Nrz   r{   
embeddingsc                     g | ]}|S rU   rU   rV   s     r!   rY   z4_EmbedContentResponse_from_mldev.<locals>.<listcomp>J  r   r#   metadatarc   r9   s       r!    _EmbedContentResponse_from_mldevr%  ;  s    
 !)	+)*++7'(${=N<O*P*P   
+~&&2	<<${\N;;<<<   
+
|$$0ZL${ZL"A"ABBB	r#   c           
      r   i t          | dg          !t          dgt          | dg                     t          | ddg          /t          dgfdt          | ddg          D                        t          | dg          !t          dgt          | dg                     t          dg          dk    rxt          | d	g          }t          | d
g          }t          | dg          }|rCi }|r |                    d          r|d         |d<   |r||d<   ||d<   t          dg|g           S )Nrz   r{   zpredictions[]r"  c                 2    g | ]}t          |          S rU   )r   rr   s     r!   rY   z5_EmbedContentResponse_from_vertex.<locals>.<listcomp>b  5     	
 	
 	
 *$	;GG	
 	
 	
r#   r$  r  r  	embeddingusageMetadatar   promptTokenCountrH   r   )r7   r8   get)r*   r+   r,   r)  usage_metadatar   statsr:   s     `    @r!   !_EmbedContentResponse_from_vertexr/  S  s   
 !)	+)*++7'(${=N<O*P*P   
+677C		
 	
 	
 	
 	
[?L*IJJ	
 	
 	
   
+
|$$0ZL${ZL"A"ABBB	+,-../AA[;-00I+'899N[;-00I 3e	 BN../ABB B-.@Am	 '&k %i
9|nyk222	r#   c                     i }t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nendpointr   deployedModelIddeployed_model_idrc   r9   s       r!   _Endpoint_from_vertexr4  {  s    
 !)	+
|$$0VHd;==>>>	+)*++7'(${=N<O*P*P   
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coder   rg   rh   r6   r9   s       r!   _ExecutableCode_to_vertexr7    s    
 !)	+x  ,VHd;99:::	+
|$$0ZL${ZL"A"ABBB	+v*
	2  
 
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@   rA   )r7   r   r8   r9   s       r!   _FileData_to_mldevr;    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 )Nrg   argsr   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.r6   r9   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.r6   r9   s       r!   _FunctionCallingConfig_to_mldevrF    s    
 !)	+0122>	 [3455   
+x  ,VHd;99:::	+89::F
	M  
 
r#   c                     i t          |dg          Bt          |dgt          t          j        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g          !t          dgt          |dg                     t          |dg          4t          dgt          j         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!gfd"t          |d g          D                        t          |d#g          Bt          |d#g fd$t          j         t          |d#g                    D                        t          |d%g          0t          |d&gt          t          |d%g                               t          |d'g          t          d(          t          |d)g          4t          |d*gt          j	         t          |d)g                               t          |d+g          !t          d,gt          |d+g                     t          |d-g          !t          d.gt          |d-g                     t          |d/g          3t          d0gt          j
        t          |d/g                               t          |d1g          t          d2          t          |d3g          !t          d4gt          |d3g                     t          |d5g          0t          d6gt          t          |d5g                               t          |d7g          !t          d8gt          |d7g                     t          |d9g          t          d:          t          |d;g          !t          |d<gt          |d;g                     S )=Nr   r   temperaturetop_ptopPtop_ktopKcandidate_countcandidateCountmax_output_tokensmaxOutputTokensstop_sequencesstopSequencesresponse_logprobsresponseLogprobslogprobspresence_penaltypresencePenaltyfrequency_penaltyfrequencyPenaltyr   response_mime_typeresponseMimeTyperesponse_schemaresponseSchemaresponse_json_schemaresponseJsonSchemarouting_configzvrouting_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.model_selection_configz~model_selection_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.safety_settingssafetySettingsc                 2    g | ]}t          |          S rU   )_SafetySetting_to_mldevrr   s     r!   rY   z3_GenerateContentConfig_to_mldev.<locals>.<listcomp>R  5     	
 	
 	
 $D)[AA	
 	
 	
r#   r   c                 X    g | ]&}t          t          j        |                    'S rU   )_Tool_to_mldevrt   t_toolrW   rX   rj   r,   r:   s     r!   rY   z3_GenerateContentConfig_to_mldev.<locals>.<listcomp>\  sA     	
 	
 	
 18J55y+NN	
 	
 	
r#   tool_config
toolConfigr   nlabels parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.cached_contentcachedContentresponse_modalitiesresponseModalitiesmedia_resolutionmediaResolutionspeech_configspeechConfigaudio_timestampzwaudio_timestamp parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.thinking_configthinkingConfigimage_configimageConfigenable_enhanced_civic_answersenableEnhancedCivicAnswersmodel_armor_configzzmodel_armor_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.service_tierserviceTier)r7   r8   r   rt   r   t_schemar   t_tools_ToolConfig_to_mldevt_cached_content_namet_speech_config_ImageConfig_to_mldevrw   s   `  `@r!   _GenerateContentConfig_to_mldevr    s    !)	+,-..:	K[+?*@AABB	
 	
   
+''3]OT+%G%GHHH	+y!!-VHd;	::;;;	+y!!-VHd;	::;;;	+)*++7%&[;L:M(N(NOOO	++,--9%&[;N:O(P(P   
+()**6_%tK:J9K'L'LMMM	++,--9	[./00   
+
|$$0ZL${ZL"A"ABBB	+*+,,8%&[;M:N(O(O   
++,--9	[./00   
+x  ,VHd;99:::	+,-..:	[/011   
+)*++7		
:tK2C1DEEFF   
+./00<	[1233   
+()**6
	<  
 
+0122>
	M  
 
+)*++7		
 	
 	
 	
 	
[+<*=>>	
 	
 	
   
+y!!-			
 	
 	
 	
 	
 	
	*d;	.J.JKK	
 	
 	
   
+''3	}o..	;	
 	
   
+z"".
	3  
 
+()**6		[+;*<==	
 	
   
+-.//;	[0122   
+*+,,8%&[;M:N(O(O   
+())5		${_,=>>??   
+)*++7
	<  
 
+)*++7%&[;L:M(N(NOOO	+'((4	~.//K	
 	
   
+7899E	%&[:;<<   
+,-..:
	B  
 
+'((4kN;K)L)LMMM	r#   c                 j    i t          |dg          Bt          |dgt          t          j        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g          !t          dgt          |dg                     t          |dg          4t          dgt          j         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          Bt          |d#g fd$t          j         t          |d#g                    D                        t          |d%g          0t          |d&gt          t          |d%g                               t          |d'g          !t          |d'gt          |d'g                     t          |d(g          4t          |d)gt          j         t          |d(g                               t          |d*g          !t          d+gt          |d*g                     t          |d,g          !t          d-gt          |d,g                     t          |d.g          Bt          d/gt          t          j
        t          |d.g                                         t          |d0g          !t          d1gt          |d0g                     t          |d2g          !t          d3gt          |d2g                     t          |d4g          0t          d5gt          t          |d4g                               t          |d6g          t          d7          t          |d8g          !t          |d9gt          |d8g                     t          |d:g          !t          |d;gt          |d:g                     S )<Nr   r   rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  r   rZ  r[  r\  r]  r^  r_  r`  routingConfigra  modelConfigrb  rc  c                     g | ]}|S rU   rU   rV   s     r!   rY   z4_GenerateContentConfig_to_vertex.<locals>.<listcomp>  rb   r#   r   c                 X    g | ]&}t          t          j        |                    'S rU   )r   rt   ri  rj  s     r!   rY   z4_GenerateContentConfig_to_vertex.<locals>.<listcomp>  sA     	
 	
 	
 AHZ66	;OO	
 	
 	
r#   rk  rl  r   rn  ro  rp  rq  rr  rs  rt  ru  rv  audioTimestamprw  rx  ry  rz  r{  enable_enhanced_civic_answers parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r}  modelArmorConfigr~  r  )r7   r8   rq   rt   r   r  r  _ToolConfig_to_vertexr  _SpeechConfig_to_vertexr  _ImageConfig_to_vertexr   rw   s   `  `@r!    _GenerateContentConfig_to_vertexr    s	    !)	+,-..:	K[+?*@AABB	
 	
   
+''3]OT+%G%GHHH	+y!!-VHd;	::;;;	+y!!-VHd;	::;;;	+)*++7%&[;L:M(N(NOOO	++,--9%&[;N:O(P(P   
+()**6_%tK:J9K'L'LMMM	++,--9	[./00   
+
|$$0ZL${ZL"A"ABBB	+*+,,8%&[;M:N(O(O   
++,--9	[./00   
+x  ,VHd;99:::	+,-..:	[/011   
+)*++7		
:tK2C1DEEFF   
+./00<	[1233   
+()**6_%tK:J9K'L'LMMM	+0122>	[3455   
+)*++7	AA${->,?@@AAA   
+y!!-			
 	
 	
 	
 	
 	
	*d;	.J.JKK	
 	
 	
   
+''3	}o..	;	
 	
   
+z"".
Dxj$A$ABBB	+()**6		[+;*<==	
 	
   
+-.//;	[0122   
+*+,,8%&[;M:N(O(O   
+())5	d;0ABBCC	
 	
   
+)*++7%&[;L:M(N(NOOO	+)*++7%&[;L:M(N(NOOO	+'((4	~.//K	
 	
   
+7899E
	M  
 
+,-..:	[/011   
+'((4kN;K)L)LMMM	r#   c                    i t          |dg          5t          ddgt          j        | t          |dg                               t          |dg          @t          dgfdt          j        t          |dg                    D                        t          |dg          1t          dgt          | t          |dg                               S )Nrl   rm   rn   c                 2    g | ]}t          |          S rU   r   rr   s     r!   rY   z7_GenerateContentParameters_to_mldev.<locals>.<listcomp>  r   r#   r   r   )r7   r8   rt   ru   rv   r  rw   s      `@r!   #_GenerateContentParameters_to_mldevr  p  s    !)	+y!!-			*d;	::;;   
+
|$$0		
 	
 	
 	
 	
T+
|%D%DEE	
 	
 	
   
+z"".	'[8*55y+	
 	
   
r#   c                    i t          |dg          5t          ddgt          j        | t          |dg                               t          |dg          @t          dgfdt          j        t          |dg                    D                        t          |dg          1t          dgt          | t          |dg                               S )Nrl   rm   rn   c                 2    g | ]}t          |          S rU   rp   rr   s     r!   rY   z8_GenerateContentParameters_to_vertex.<locals>.<listcomp>  rs   r#   r   r   )r7   r8   rt   ru   rv   r  rw   s      `@r!   $_GenerateContentParameters_to_vertexr    s    !)	+y!!-			*d;	::;;   
+
|$$0		
 	
 	
 	
 	
T+
|%D%DEE	
 	
 	
   
+z"".	([8*55y+	
 	
   
r#   c           	         i t          | dg          !t          dgt          | dg                     t          | dg          .t          dgf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gt          | dg                     t          | dg          !t          dgt          | dg                     S )Nrz   r{   
candidatesc                 2    g | ]}t          |          S rU   )r]   rr   s     r!   rY   z7_GenerateContentResponse_from_mldev.<locals>.<listcomp>  5     	
 	
 	
 "$	;??	
 	
 	
r#   modelVersionmodel_versionpromptFeedbackprompt_feedback
responseIdresponse_idr*  r-  modelStatusmodel_statusrc   r9   s     `@r!   #_GenerateContentResponse_from_mldevr    s   
 !)	+)*++7'(${=N<O*P*P   
+~&&2		
 	
 	
 	
 	
[<.99	
 	
 	
   
+'((4_%tK.9I'J'JKKK	+()**6&'k<L;M)N)NOOO	+~&&2]OT+~%F%FGGG	+())5%&[?:K(L(LMMM	+''3^$d;&H&HIII	r#   c           	         i }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gt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nrz   r{   r  c                     g | ]}|S rU   rU   rV   s     r!   rY   z8_GenerateContentResponse_from_vertex.<locals>.<listcomp>  r   r#   
createTimecreate_timer  r  r  r  r  r  r*  r-  rc   r9   s       r!   $_GenerateContentResponse_from_vertexr    s   
 !)	+)*++7'(${=N<O*P*P   
+~&&2	<<${\N;;<<<   
+~&&2]OT+~%F%FGGG	+'((4_%tK.9I'J'JKKK	+()**6&'k<L;M)N)NOOO	+~&&2]OT+~%F%FGGG	+())5%&[?:K(L(LMMM	r#   c                 d   i }t          | dg          t          d          t          | dg          t          d          t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |dd	gt          | dg                     t          | d
g          "t          |ddgt          | d
g                     t          | dg          t          d          t          | dg          @t          t          | dg                     t          |ddgt          | dg                     t          | dg          @t	          t          | dg                     t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          t          d          t          | dg          t          d          t          | dg          "t          |dd gt          | dg                     t          | d!g          t          d"          |S )#Nr   voutput_gcs_uri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   zwnegative_prompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r   r   r   r   r   r   r   lseed parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r   r   r   r   r   r   r   r   r   r   r   r   r   zuadd_watermark parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   rm  
image_sizesampleImageSizeenhance_promptzvenhance_prompt parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.)r7   r   r8   r&   r"   r9   s       r!   _GenerateImagesConfig_to_mldevr    sJ   
 !)	+()**6
	<  
 
+)*++7
	<  
 
+*+,,8	}%[-.//   
+'((4	}%[>*++   
+()**6	'[+,--   
+x  ,
	3  
 
+-.//;-[0122   		'[0122   
++,--9,[./00   		)*[./00   
+3455A	01[6788   
+,-..:	)*[/011   
+
|$$0	z"[:,''   
+*+,,8333[-.//   
+4566B===[7899   
+())5
	<  
 
+z"".
	3  
 
+~&&2	()[<.))   
+()**6
	<  
 
r#   c                    i }t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |dd	gt          | dg                     t          | d
g          "t          |ddgt          | d
g                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |dd gt          | dg                     |S )!Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  enhancePromptrc   r9   s       r!   _GenerateImagesConfig_to_vertexr    sm   
 !)	+()**6	|$[+,--   
+)*++7	'([,-..   
+*+,,8	}%[-.//   
+'((4	}%[>*++   
+()**6	'[+,--   
+x  ,v.[6(0K0KLLL	+-.//;	'[0122   
++,--9	)*[./00   
+3455A	01[6788   
+,-..:	)*[/011   
+
|$$0	z"[:,''   
+*+,,8333[-.//   
+4566B===[7899   
+())5	~&[?+,,   
+z"".
Dxj$A$ABBB	+~&&2	()[<.))   
+()**6	'[+,--   
r#   c                 ^   i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          "t          |ddgt          |dg                     t          |dg           t	          t          |dg          ||           |S Nrl   rm   r   r   r   )r7   r8   rt   ru   r  rw   s        r!   "_GenerateImagesParameters_to_mldevr    s     !)	+y!!-			*d;	::;;   
+z"".^X.[8*0M0MNNN	+z""."[8*%%y+   
r#   c                 ^   i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          "t          |ddgt          |dg                     t          |dg           t	          t          |dg          ||           |S r  )r7   r8   rt   ru   r  rw   s        r!   #_GenerateImagesParameters_to_vertexr    s     !)	+y!!-			*d;	::;;   
+z"".^X.[8*0M0MNNN	+z"".#[8*%%y+   
r#   c           
      r   i t          | dg          !t          dgt          | dg                     t          | dg          .t          dgfdt          | dg          D                        t          | dg          0t          dgt          t          | dg                               S )Nrz   r{   r   r   c                 2    g | ]}t          |          S rU   )_GeneratedImage_from_mldevrr   s     r!   rY   z6_GenerateImagesResponse_from_mldev.<locals>.<listcomp>>  5     	
 	
 	
 'tYDD	
 	
 	
r#   positivePromptSafetyAttributes!positive_prompt_safety_attributes)r7   r8   _SafetyAttributes_from_mldevr9   s     `@r!   "_GenerateImagesResponse_from_mldevr  /  s   
 !)	+)*++7'(${=N<O*P*P   
+''3		
 	
 	
 	
 	
[=/::	
 	
 	
   
+89::F	,-$?@AA	
 	
   
r#   c           
      r   i t          | dg          !t          dgt          | dg                     t          | dg          .t          dgfdt          | dg          D                        t          | dg          0t          dgt          t          | dg                               S )Nrz   r{   r   r   c                 2    g | ]}t          |          S rU   r   rr   s     r!   rY   z7_GenerateImagesResponse_from_vertex.<locals>.<listcomp>a  r  r#   r  r  )r7   r8   _SafetyAttributes_from_vertexr9   s     `@r!   #_GenerateImagesResponse_from_vertexr  R  s   
 !)	+)*++7'(${=N<O*P*P   
+''3		
 	
 	
 	
 	
[=/::	
 	
 	
   
+89::F	,-%?@AA	
 	
   
r#   c           
         i t          | dg          "t          |ddgt          | dg                     t          | dg          t          d          t          | dg          t          d          t          | dg          "t          |dd	gt          | dg                     t          | d
g          t          d          t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          t          d          t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          t          d          t          | dg          1t          |ddgt          t          | dg                               t          | dg          /t          |ddgfdt          | dg          D                        t          | dg          t          d           t          | d!g          t          d"          t          | d#g          t          d$          t          | d%g          !t          |d&gt          | d%g                     t          | d'g          t          d(          S ))Nnumber_of_videosr   r   r   r  fpszkfps parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.duration_secondsdurationSecondsr   r  r   r   
resolutionr   r   pubsub_topicztpubsub_topic parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r   r  r  generate_audiozvgenerate_audio parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.
last_framer   	lastFramer   r   c                 2    g | ]}t          |          S rU   )'_VideoGenerationReferenceImage_to_mldevrr   s     r!   rY   z2_GenerateVideosConfig_to_mldev.<locals>.<listcomp>  s<     	
 	
 	
  4i 	
 	
 	
r#   maskzlmask parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.compression_qualityz{compression_quality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   rm  webhook_configwebhookConfigresize_modezsresize_mode parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.)r7   r8   r   _Image_to_mldevr9   s     `@r!   _GenerateVideosConfig_to_mldevr  u  su   
 !)	+*+,,8	}%[-.//   
+()**6
	<  
 
+w+
	3  
 
+*+,,8	()[-.//   
+x  ,
	3  
 
+'((4	}%[>*++   
+~&&2	|$[<.))   
++,--9	)*[./00   
+'((4
	<  
 
+)*++7	'([,-..   
+()**6	'[+,--   
+()**6
	<  
 
+~&&2	%|n--y+	
 	
   
+*+,,8	*+	
 	
 	
 	
 	
 [+=*>??		
 	
 	
	 	 	 
+x  ,
	3  
 
+-.//;
	B  
 
+z"".
	3  
 
+()**6(${=M<N*O*O   
+''3
	<  
 
r#   c           
         i t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | d	g          "t          |dd	gt          | d	g                     t          | d
g          "t          |ddgt          | d
g                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          1t          |ddgt          t          | dg                               t          | dg          /t          |ddgfdt          | dg          D                        t          | dg          1t          |ddgt          t          | dg                               t          | dg          "t          |ddgt          | dg                     t          | d g          !t          |d gt          | d g                     t          | d!g          t	          d"          t          | d#g          "t          |dd$gt          | d#g                     S )%Nr  r   r   r   r   r  r  r  r   r   r   r  r   r   r  pubsubTopicr   r   r  r  r  generateAudior  r   r  r   r   c                 2    g | ]}t          |          S rU   )(_VideoGenerationReferenceImage_to_vertexrr   s     r!   rY   z3_GenerateVideosConfig_to_vertex.<locals>.<listcomp>`	  s<     	
 	
 	
  5i 	
 	
 	
r#   r  r  r   r   r  zvwebhook_config parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r  
resizeMode)r7   r8   _Image_to_vertex_VideoGenerationMask_to_vertexr   r9   s     `@r!   _GenerateVideosConfig_to_vertexr   	  s   
 !)	+*+,,8	}%[-.//   
+()**6	|$[+,--   
+w+u-tK%/I/IJJJ	+*+,,8	()[-.//   
+x  ,v.[6(0K0KLLL	+'((4	}%[>*++   
+~&&2	|$[<.))   
++,--9	)*[./00   
+'((4	}%[>*++   
+)*++7	'([,-..   
+()**6	'[+,--   
+()**6	'[+,--   
+~&&2	%|n--y+	
 	
   
+*+,,8	*+	
 	
 	
 	
 	
 [+=*>??		
 	
 	
	 	 	 
+x  ,	 &vh''K	
 	
   
+-.//;	+,[0122   
+z"".
Dxj$A$ABBB	+()**6
	?  
 
+''3	|$[=/**   
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dg          1t          |dgt          t          | ddg          ||                     t          | ddg          1t          |dgt          t          | ddg          ||                     |S )Nr   r$  doneerrorresponsegenerateVideoResponseresult)r7   r8   "_GenerateVideosResponse_from_mldevr9   s       r!   #_GenerateVideosOperation_from_mldevr  	  s   
 !)	+x  ,VHd;99:::	+
|$$0ZL${ZL"A"ABBB	+x  ,VHd;99:::	+y!!-WItK';;<<<	+
$;<==I	*z+BCDD	
 	
   
+
$;<==I	
*z+BCDD	
 	
   
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          0t          |dgt          t          | dg          ||                     t          | dg          0t          |dgt          t          | dg          ||                     |S )Nr   r$  r  r  r  r  )r7   r8   #_GenerateVideosResponse_from_vertexr9   s       r!   $_GenerateVideosOperation_from_vertexr  	  ss   
 !)	+x  ,VHd;99:::	+
|$$0ZL${ZL"A"ABBB	+x  ,VHd;99:::	+y!!-WItK';;<<<	+
|$$0	+zl++Y	
 	
   
+
|$$0	
+zl++Y	
 	
   
r#   c                    i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          "t          |ddgt          |dg                     t          |dg          1t          |ddgt	          t          |dg          ||                     t          |dg          1t          |ddgt          t          |dg          ||                     t          |dg           t          t          |dg          ||           t          |dg           t          t          |dg          ||           |S 	Nrl   rm   r   r   imagevideosourcer   )r7   r8   rt   ru   r  _Video_to_mldev_GenerateVideosSource_to_mldevr  rw   s        r!   "_GenerateVideosParameters_to_mldevr  	  s    !)	+y!!-			*d;	::;;   
+z"".^X.[8*0M0MNNN	+y!!-	![7)44iMM   
+y!!-	![7)44iMM   
+z""."[8*%%y+   
+z""."[8*%%y+   
r#   c                    i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          "t          |ddgt          |dg                     t          |dg          1t          |ddgt	          t          |dg          ||                     t          |dg          1t          |ddgt          t          |dg          ||                     t          |dg           t          t          |dg          ||           t          |dg           t          t          |dg          ||           |S r  )r7   r8   rt   ru   r  _Video_to_vertex_GenerateVideosSource_to_vertexr  rw   s        r!   #_GenerateVideosParameters_to_vertexr  	
  s    !)	+y!!-			*d;	::;;   
+z"".^X.[8*0M0MNNN	+y!!-	!kG955y+NN   
+y!!-	!kG955y+NN   
+z"".#[8*%%y+   
+z"".#[8*%%y+   
r#   c           	      T   i t          | dg          .t          dgfdt          | dg          D                        t          | dg          !t          dgt          | dg                     t          | dg          !t          dgt          | dg                     S )NgeneratedSamplesgenerated_videosc                 2    g | ]}t          |          S rU   )_GeneratedVideo_from_mldevrr   s     r!   rY   z6_GenerateVideosResponse_from_mldev.<locals>.<listcomp>?
  r  r#   raiMediaFilteredCountrai_media_filtered_countraiMediaFilteredReasonsrai_media_filtered_reasonsrc   r9   s     `@r!   r  r  5
  s    
 !)	+*+,,8		
 	
 	
 	
 	
[+=*>??	
 	
 	
   
+/011=	#$[2344   
+1233?	%&[4566   
r#   c           	      T   i t          | dg          .t          dgfdt          | dg          D                        t          | dg          !t          dgt          | dg                     t          | dg          !t          dgt          | dg                     S )Nvideosr  c                 2    g | ]}t          |          S rU   )_GeneratedVideo_from_vertexrr   s     r!   rY   z7_GenerateVideosResponse_from_vertex.<locals>.<listcomp>`
  r  r#   r  r  r   r  rc   r9   s     `@r!   r  r  V
  s    
 !)	+z"".		
 	
 	
 	
 	
[8*55	
 	
 	
   
+/011=	#$[2344   
+1233?	%&[4566   
r#   c           
      x   i }t          | dg          "t          |ddgt          | dg                     t          | dg          1t          |ddgt          t          | dg          ||                     t          | dg          1t          |ddgt          t          | dg          ||                     |S Nr   r   r  r  )r7   r8   r  r  r9   s       r!   r  r  w
  s    
 !)	+z"".14hZ3P3P   
+y!!-	![7)44iMM   
+y!!-	![7)44iMM   
r#   c           
      x   i }t          | dg          "t          |ddgt          | dg                     t          | dg          1t          |ddgt          t          | dg          ||                     t          | dg          1t          |ddgt          t          | dg          ||                     |S r  )r7   r8   r  r  r9   s       r!   r  r  
  s    
 !)	+z"".14hZ3P3P   
+y!!-	!kG955y+NN   
+y!!-	!kG955y+NN   
r#   c           
         i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          +t          |dgd t          | dg          D                        |S )N_selfr  r   c                     g | ]}|S rU   rU   rV   s     r!   rY   z3_GeneratedImageMask_from_vertex.<locals>.<listcomp>
  s    OOOOOOr#   )r7   r8   _Image_from_vertexr9   s       r!   _GeneratedImageMask_from_vertexr  
  s    
 !)	+y!!-	wi(()[	
 	
   
+z"".H:OOkH:1N1NOOO   
r#   c           
      r   i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          !t          |dgt          | dg                     t          | dg          0t          |dgt          t          | dg          ||                     |S )Nr
  r  raiFilteredReasonrai_filtered_reasonsafety_attributes)r7   r8   _Image_from_mldevr  r9   s       r!   r  r  
  s    
 !)	+y!!-		${WI66	;OO   
++,--9	[./00   
+y!!-	$wi(()[	
 	
   
r#   c           
         i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          !t          |dgt          | dg                     t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          !t          |dgt          | dg                     |S )Nr
  r  r  r  r  r   enhanced_prompt)r7   r8   r  r  r9   s       r!   r   r   
  s"   
 !)	+y!!-		wi(()[	
 	
   
++,--9	[./00   
+y!!-	%wi(()[	
 	
   
+z"".&'kH:)F)FGGG	r#   c           
          i }t          | dg          0t          |dgt          t          | dg          ||                     |S )Nr  )r7   r8   _Video_from_mldevr9   s       r!   r  r    sX    
 !)	+y!!-		${WI66	;OO   
r#   c           
          i }t          | dg          0t          |dgt          t          | dg          ||                     |S )Nr
  r  )r7   r8   _Video_from_vertexr9   s       r!   r  r    s]    
 !)	+y!!-		wi(()[	
 	
   
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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          0t          |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+          |S ),Nra  r  r^  r_  rv  r  rM  rN  enable_affective_dialogenableAffectiveDialogrX  rY  rU  rO  rP  rr  rs  rV  rW  rS  rT  rZ  r[  rp  rq  r\  r]  r`  r  r   rt  ru  rQ  rR  rH  rw  rx  rK  rL  rI  rJ  r{  r  )r7   r8   r  r   r9   s       r!   r   r   -  sf   
 !)	+0122>	[3455   
+./00<	[1233   
+)*++7%&[;L:M(N(NOOO	+)*++7%&[;L:M(N(NOOO	+1233?	 ![4566   
++,--9	[./00   
+
|$$0ZL${ZL"A"ABBB	++,--9%&[;N:O(P(P   
+*+,,8%&[;M:N(O(O   
+*+,,8%&[;M:N(O(O   
++,--9	[./00   
+,-..:	[/011   
+-.//;	[0122   
+)*++7%&[;L:M(N(NOOO	+()**6_%tK:J9K'L'LMMM	+x  ,VHd;99:::	+())5	/00)[	
 	
   
+()**6_%tK:J9K'L'LMMM	+''3]OT+%G%GHHH	+)*++7%&[;L:M(N(NOOO	+y!!-VHd;	::;;;	+y!!-VHd;	::;;;	+7899E
	M  
 
r#   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               |S r   r   rw   s        r!   _GetModelParameters_to_mldevr    r   r#   c                     i }t          |dg          5t          |ddgt          j        | t          |dg                               |S r   r   rw   s        r!   _GetModelParameters_to_vertexr    r   r#   c           
          i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          !t          |dgt          | dg                     |S )Nauth_config
authConfigenable_widgetenableWidget)r7   r8   r;   r9   s       r!   _GoogleMaps_to_mldevr%    s    
 !)	+''3	}o..	;	
 	
   
+())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timeRangeFilterr6   r9   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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
          t          | dg          t          d          t          | dg          t          d          |S )Nr   r   r  	imageSizer   zyperson_generation parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.prominent_peoplezxprominent_people parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   zxoutput_mime_type parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   zoutput_compression_quality parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.image_output_optionsz|image_output_options parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r6   r9   s       r!   r  r    s[   
 !)	+'((4]OT+7G%H%HIII	+~&&2[M4l^#D#DEEE	++,--9
	B  
 
+*+,,8
	B  
 
+*+,,8
	B  
 
+4566B
	M  
 
+./00<
	B  
 
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
dgt          | d	g                     t          | dg          "t          |d
dgt          | dg                     t          | dg          !t          |d
gt          | dg                     |S )Nr   r   r  r/  r   r   r0  prominentPeopler   imageOutputOptionsrA   r   r   r1  rc   r9   s       r!   r  r  '  s   
 !)	+'((4]OT+7G%H%HIII	+~&&2[M4l^#D#DEEE	++,--9	[./00   
+*+,,8%&[;M:N(O(O   
+*+,,8	z*[-.//   
+4566B	34[7899   
+./00<	[1233   
r#   c           
          i }t          | dg          3t          |dgt          j        t          | dg                               t          | dg          !t          |dgt          | dg                     |S )NbytesBase64Encodedimage_bytesrA   r@   r7   r8   base_tt_bytesr9   s       r!   r  r  W  s    
 !)	+,-..:	tK*>)?@@AA   
+
|$$0[M4j\#B#BCCC	r#   c           
      Z   i }t          | dg          !t          |dgt          | dg                     t          | dg          3t          |dgt          j        t          | dg                               t          | dg          !t          |dgt          | dg                     |S )NgcsUrigcs_urir6  r7  rA   r@   r8  r9   s       r!   r  r  k  s    
 !)	+z"".YKkH:!>!>???	+,-..:	tK*>)?@@AA   
+
|$$0[M4j\#B#BCCC	r#   c           
      6   i }t          | dg          t          d          t          | dg          3t          |dgt          j        t          | dg                               t          | dg          !t          |dgt          | dg                     |S )Nr=  zogcs_uri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r7  r6  r@   rA   )r7   r   r8   r9  r:  r9   s       r!   r  r    s    
 !)	+	{##/
	<  
 
+''3	tK-99::   
+}%%1ZL${[M"B"BCCC	r#   c           
      Z   i }t          | dg          !t          |dgt          | dg                     t          | dg          3t          |dgt          j        t          | dg                               t          | dg          !t          |dgt          | dg                     |S )Nr=  r<  r7  r6  r@   rA   r8  r9   s       r!   r  r    s    
 !)	+	{##/XJ[9+ > >???	+''3	tK-99::   
+}%%1ZL${[M"B"BCCC	r#   c                    i }t          |dg          "t          |ddgt          |dg                     t          |dg          "t          |ddgt          |dg                     t          |dg          "t          |ddgt          |dg                     t          |dg          5t          |dd	gt          j        | t          |dg                               |S 
N	page_size_querypageSize
page_token	pageTokenfilter
query_baserm   
models_urlr7   r8   rt   t_models_urlrw   s        r!   _ListModelsConfig_to_mldevrL        !)	+}%%1*-tK+/O/O   
+~&&2	;[<.))   
+z"".8,d;
.K.KLLL	+~&&2		z4l^#D#DEE   
r#   c                    i }t          |dg          "t          |ddgt          |dg                     t          |dg          "t          |ddgt          |dg                     t          |dg          "t          |ddgt          |dg                     t          |dg          5t          |dd	gt          j        | t          |dg                               |S rA  rJ  rw   s        r!   _ListModelsConfig_to_vertexrO    rM  r#   c                 n    i }t          |dg          !t          | t          |dg          ||           |S Nr   )r7   rL  rw   s        r!   _ListModelsParameters_to_mldevrR    sJ     !)	+z"".Dxj119k   
r#   c                 n    i }t          |dg          !t          | t          |dg          ||           |S rQ  )r7   rO  rw   s        r!   _ListModelsParameters_to_vertexrT    sJ     !)	+z"".Dxj119k   
r#   c                 x   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fdt          j        t          | dg                    D                        S )Nrz   r{   nextPageTokennext_page_tokenr
  modelsc                 2    g | ]}t          |          S rU   )_Model_from_mldevrr   s     r!   rY   z2_ListModelsResponse_from_mldev.<locals>.<listcomp>"  r   r#   r7   r8   rt   t_extract_modelsr9   s     `@r!   _ListModelsResponse_from_mldevr]        
 !)	+)*++7'(${=N<O*P*P   
+())5&'kO;L)M)MNNN	+y!!-	
	
 	
 	
 	
 	
*4gY+G+GHH	
 	
 	
   
r#   c                 x   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fdt          j        t          | dg                    D                        S )Nrz   r{   rV  rW  r
  rX  c                 2    g | ]}t          |          S rU   )_Model_from_vertexrr   s     r!   rY   z3_ListModelsResponse_from_vertex.<locals>.<listcomp>=  rs   r#   r[  r9   s     `@r!   _ListModelsResponse_from_vertexrb  +  r^  r#   c                 6   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                     |S )N	mask_modemaskModesegmentation_classesmaskClassesmask_dilationdilationrc   r9   s       r!   _MaskReferenceConfig_to_vertexrj  F  s    
 !)	+}%%1ZL${[M"B"BCCC	+./00<M?D7M6N$O$O   
+())5ZL${_4E"F"FGGG	r#   c                     i }t          | dg          t          d          t          | dg          t          d          |S )Nr   zlname parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.streamable_http_transportzstreamable_http_transport parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   r9   s       r!   _McpServer_to_vertexrm  Z  sh    
 !)	+x  ,
	2  
 
+3455A
	M  
 
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gt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nr   displayNamer>   descriptionversionr
  tuned_model_infoinputTokenLimitinput_token_limitoutputTokenLimitoutput_token_limitsupportedGenerationMethodssupported_actionsrH  maxTemperaturemax_temperaturerJ  rI  rL  rK  thinkingrc   r9   s       r!   rZ  rZ  o  s   
 !)	+x  ,VHd;99:::	+''3^$d;&H&HIII	+''3]OT+%G%GHHH	+	{##/YKkI;!?!?@@@	+y!!-'(${WI*F*FGGG	+)*++7'(${=N<O*P*P   
+*+,,8	[-.//   
+4566B	[7899   
+''3]OT+%G%GHHH	+()**6&'k<L;M)N)NOOO	+x  ,WItK&::;;;	+x  ,WItK&::;;;	+
|$$0ZL${ZL"A"ABBB	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fd	t          | dg          D                        t          | d
g          !t          d
gt          | d
g                     t          | dg          0t          dgt          t          | dg                               t          | dg          !t          dgt          | dg                     t          | dg          +t          dgd t          | dg          D                        S )Nr   ro  r>   rp  	versionIdrq  deployedModels	endpointsc                 2    g | ]}t          |          S rU   )r4  rr   s     r!   rY   z&_Model_from_vertex.<locals>.<listcomp>  r  r#   r   r
  rr  defaultCheckpointIddefault_checkpoint_idcheckpointsc                     g | ]}|S rU   rU   rV   s     r!   rY   z&_Model_from_vertex.<locals>.<listcomp>      ===$===r#   )r7   r8   _TunedModelInfo_from_vertexr9   s     `@r!   ra  ra    sQ   
 !)	+x  ,VHd;99:::	+''3^$d;&H&HIII	+''3]OT+%G%GHHH	+}%%1YKkK=!A!ABBB	+()**6		
 	
 	
 	
 	
[+;*<==	
 	
 	
   
+z"".XJ[8* = =>>>	+y!!-	#wi(()[	
 	
   
+-.//;	 ![0122   
+''3	==${]O<<===   
r#   c           	          i t          | dg          .t          dgfdt          | dg          D                        S )Nspeaker_voice_configsspeakerVoiceConfigsc                 2    g | ]}t          |          S rU   )_SpeakerVoiceConfig_to_vertexrr   s     r!   rY   z6_MultiSpeakerVoiceConfig_to_vertex.<locals>.<listcomp>  r(  r#   rc   r9   s     `@r!   "_MultiSpeakerVoiceConfig_to_vertexr    s{    
 !)	+/011=		
 	
 	
 	
 	
[+B*CDD	
 	
 	
   
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          0t          |dgt          t          | dg          ||                     t          | d	g          0t          |d
gt          t          | d	g          ||                     t          | dg          !t          |dgt          | dg                     t          | dg          0t          |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 )Nrr  rs  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)r7   r8   r;  r@  rB   r9   s       r!   r   r     sr   
 !)	+*+,,8%&[;M:N(O(O   
+/011=	[2344   
+)*++7%&[;L:M(N(NOOO	+}%%1	{m,,i	
 	
   
+())5	/00)[	
 	
   
++,--9	[./00   
+''3	}o..	;	
 	
   
+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           
      R   i }t          | dg          !t          |dgt          | dg                     t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          0t          |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                     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 )Nrr  rs  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.)r7   r8   ri   r7  r   r9   s       r!   r   r   H  s1   
 !)	+*+,,8%&[;M:N(O(O   
+/011=	&6788)[	
 	
   
+)*++7	!0122I{	
 	
   
+}%%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           
          i }t          | dg          0t          |dgt          t          | dg          ||                     |S )Nproduct_imager  r7   r8   r  r9   s       r!   _ProductImage_to_vertexr    s_    
 !)	+())5		/00)[	
 	
   
r#   c                 j   i }t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | d	g          "t          |dd
gt          | d	g                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r   rc   r9   s       r!   _RecontextImageConfig_to_vertexr    s   
 !)	+*+,,8	}%[-.//   
+~&&2	{#[<.))   
+()**6	|$[+,--   
+x  ,v.[6(0K0KLLL	+-.//;	'[0122   
++,--9	)*[./00   
+())5	~&[?+,,   
+*+,,8333[-.//   
+4566B===[7899   
+()**6	'[+,--   
+z"".
Dxj$A$ABBB	r#   c                 Z   i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg           t	          t          |dg          ||           t          |dg           t          t          |dg          ||           |S Nrl   rm   r  r   )r7   r8   rt   ru   _RecontextImageSource_to_vertexr  rw   s        r!   #_RecontextImageParameters_to_vertexr    s     !)	+y!!-			*d;	::;;   
+z"".#[8*%%y+   
+z"".#[8*%%y+   
r#   c           	          i t          | dg          .t          dgfdt          | dg          D                        S )Nr   r   c                 2    g | ]}t          |          S rU   r   rr   s     r!   rY   z7_RecontextImageResponse_from_vertex.<locals>.<listcomp>   r  r#   rc   r9   s     `@r!   #_RecontextImageResponse_from_vertexr    sw    
 !)	+''3		
 	
 	
 	
 	
[=/::	
 	
 	
   
r#   c           
      x   i t          | dg          "t          |ddgt          | dg                     t          | dg          1t          |g dt          t          | dg                               t          | dg          /t          |ddgfdt          | dg          D                        S )Nr   r   person_image)r   personImager  product_imagesproductImagesc                 2    g | ]}t          |          S rU   )r  rr   s     r!   rY   z3_RecontextImageSource_to_vertex.<locals>.<listcomp>A  rf  r#   r  r9   s     `@r!   r  r  )  s   
 !)	+z"".14hZ3P3P   
+'((4000~.//K	
 	
   
+()**6	)	
 	
 	
 	
 	
[+;*<==	
 	
 	
   
r#   c           
          i }t          | dg          0t          |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          0t          |dgt          t          | dg          ||                     t          | d	g          0t          |d
gt	          t          | d	g          ||                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nreference_imagereferenceImagereference_idreferenceIdreference_typereferenceTypemask_image_configmaskImageConfigcontrol_image_configcontrolImageConfigstyle_image_configstyleImageConfigsubject_image_configsubjectImageConfig)r7   r8   r  rj  r   r9   s       r!   r   r   J  s   
 !)	+)*++7	0122I{	
 	
   
+'((4]OT+7G%H%HIII	+()**6_%tK:J9K'L'LMMM	++,--9	&2344i	
 	
   
+./00<	)5677K	
 	
   
+,-..:	[/011   
+./00<	[1233   
r#   c                 R   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          |S )	Nr@   rA   voice_sample_audiovoiceSampleAudioconsent_audiozuconsent_audio parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.voice_consent_signaturezvoice_consent_signature parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r6   r9   s       r!    _ReplicatedVoiceConfig_to_vertexr    s    
 !)	+}%%1ZL${[M"B"BCCC	+,-..:	[/011   
+())5
	?  
 
+1233?
	M  
 
r#   c           	      >   i }t          | ddg          "t          |dgt          | ddg                     t          | ddg          "t          |dgt          | ddg                     t          | dg          !t          |dgt          | dg                     |S NsafetyAttributes
categoriesscorescontentTypecontent_typerc   r9   s       r!   r  r        
 !)	+*L9::F	[-|<==   
+*H566BH:tK2Dh1OPP   
+''3^$d;&H&HIII	r#   c           	      >   i }t          | ddg          "t          |dgt          | ddg                     t          | ddg          "t          |dgt          | ddg                     t          | dg          !t          |dgt          | dg                     |S r  rc   r9   s       r!   r  r    r  r#   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categorymethodznmethod parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.	thresholdr6   r9   s       r!   re  re    s    
 !)	+
|$$0ZL${ZL"A"ABBB	+z"".
	3  
 
+}%%1[M4k]#C#CDDD	r#   c           
          i }t          | dg          0t          |dgt          t          | dg          ||                     |S )Nr  r  r9   s       r!   _ScribbleImage_to_vertexr    sX    
 !)	+y!!-		kG955y+NN   
r#   c                 l   i }t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | d	g          "t          |dd
gt          | d	g                     t          | dg          !t          |dgt          | dg                     |S )NrD  r   max_predictionsmaxPredictionsconfidence_thresholdconfidenceThresholdrh  maskDilationbinary_color_thresholdbinaryColorThresholdr   rc   r9   s       r!   _SegmentImageConfig_to_vertexr    s   
 !)	+x  ,v.[6(0K0KLLL	+)*++7	'([,-..   
+./00<	,-[1233   
+())5	~&[?+,,   
+0122>	-.[3455   
+z"".
Dxj$A$ABBB	r#   c                 Z   i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg           t	          t          |dg          ||           t          |dg           t          t          |dg          ||           |S r  )r7   r8   rt   ru   _SegmentImageSource_to_vertexr  rw   s        r!   !_SegmentImageParameters_to_vertexr  "  s     !)	+y!!-			*d;	::;;   
+z"".![8*%%y+   
+z"".![8*%%y+   
r#   c           	          i t          | dg          .t          dgfdt          | dg          D                        S )Nr   generated_masksc                 2    g | ]}t          |          S rU   )r  rr   s     r!   rY   z5_SegmentImageResponse_from_vertex.<locals>.<listcomp>G  s5     	
 	
 	
 ,D)[II	
 	
 	
r#   rc   r9   s     `@r!   !_SegmentImageResponse_from_vertexr  =  sw    
 !)	+''3		
 	
 	
 	
 	
[=/::	
 	
 	
   
r#   c           
      x   i }t          | dg          "t          |ddgt          | dg                     t          | dg          1t          |ddgt          t          | dg          ||                     t          | dg          1t          |ddgt          t          | dg          ||                     |S )Nr   r   r  scribble_imagescribble)r7   r8   r  r  r9   s       r!   r  r  P  s    
 !)	+z"".14hZ3P3P   
+y!!-	!kG955y+NN   
+()**6	$ /0119k	
 	
   
r#   c           
          i }t          | dg          !t          |dgt          | dg                     t          | dg          0t          |dgt          t          | dg          ||                     |S )Nspeakervoice_configvoiceConfig)r7   r8   _VoiceConfig_to_vertexr9   s       r!   r  r  n  s    
 !)	+	{##/YKkI;!?!?@@@	+'((4	~.//K	
 	
   
r#   c           
      r   i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          !t          |dgt          | dg                     t          | dg          0t          |dgt          t          | dg          ||                     |S )Nr  r  language_codelanguageCodemulti_speaker_voice_configmultiSpeakerVoiceConfig)r7   r8   r  r  r9   s       r!   r  r    s    
 !)	+'((4	~.//K	
 	
   
+())5^$d;8I&J&JKKK	+4566B	"#*;<==	
 	
   
r#   c           
      T   i }t          | dg          !t          |dgt          | dg                     t          | dg          0t          |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)r7   r8   rF  r9   s       r!   r  r    s    
 !)	+*+,,8%&[;M:N(O(O   
+1233?	 !'89::	
 	
   
+>?@@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.r6   r9   s       r!   r  r    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          0t          |dgt          t          | dg          ||                     t          | d	g          0t          |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 rU   rU   rV   s     r!   rY   z"_Tool_to_mldev.<locals>.<listcomp>      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 rU   rU   rV   s     r!   rY   z"_Tool_to_mldev.<locals>.<listcomp>'  r  r#   )r7   r   r8   r-  r%  r9   s       r!   rh  rh    s   
 !)	+}%%1
	<  
 
+'((4]OT+7G%H%HIII	+''3\ND}o$F$FGGG	+())5	/00)[	
 	
   
+''3	}o..	;	
 	
   
+()**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          0t          dgt          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gfdt          | dg          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 rU   rU   rV   s     r!   rY   z#_Tool_to_vertex.<locals>.<listcomp>Y  r  r#   r  r  r  parallelAiSearchr  r  r  r  c                 2    g | ]}t          |          S rU   )rm  rr   s     r!   rY   z#_Tool_to_vertex.<locals>.<listcomp>q  s5     	
 	
 	
 !y+>>	
 	
 	
r#   )r7   r8   r   r   r9   s     `@r!   r   r   -  s	   
 !)	+}%%1[M4k]#C#CDDD	+'((4	~.//K	
 	
   
+''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		
 	
 	
 	
 	
[=/::	
 	
 	
   
r#   c           	      <   i }t          | ddg          	 "t          |dgt          | ddg                     t          | dg          !t          |dgt          | dg                     t          | dg          !t          |dgt          | dg                     |S )Nr   z&google-vertex-llm-tuning-base-model-id
base_modelr  r  
updateTimeupdate_timerc   r9   s       r!   r  r  z  s    
 !)
;#KLMM 		[8%MNOO   
+~&&2]OT+~%F%FGGG	+~&&2]OT+~%F%FGGG	r#   c                 6   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                     |S Nr>   ro  rp  r  r  rc   r9   s       r!   _UpdateModelConfig_to_mldevr'        
 !)	+'((4kN;K)L)LMMM	+''3kM?)K)KLLL	+/011=	[2344   
r#   c                 6   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                     |S r&  rc   r9   s       r!   _UpdateModelConfig_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 )Nrl   rm   r   r   )r7   r8   rt   ru   r'  rw   s        r!   _UpdateModelParameters_to_mldevr,    s     !)	+y!!-			*d;	::;;   
+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 )Nrl   rm   r   )r7   r8   rt   ru   r*  rw   s        r!    _UpdateModelParameters_to_vertexr.    s     !)	+y!!-			*d;	::;;   
+z"". [8*%%y+   
r#   c                 j   i }t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |dd	gt          | dg                     t          | d
g          "t          |g dt          | d
g                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          "t          |g dt          | dg                     t          | dg          !t          |dgt          | dg                     t          | dg          "t          |ddgt          | dg                     t          | dg          "t          |ddgt          | dg                     |S )Nr   r   r   r   r   r   r   r   r   r   r   r   r   enhance_input_image)r   upscaleConfigenhanceInputImageimage_preservation_factor)r   r1  imagePreservationFactorr   r   r   rD  rc   r9   s       r!    _UpscaleImageAPIConfig_to_vertexr5    s   
 !)	+()**6	|$[+,--   
+-.//;	'[0122   
++,--9	)*[./00   
+,-..:	)*[/011   
+*+,,8333[-.//   
+4566B===[7899   
+-.//;<<<[0122   
+3455ABBB[6788   
+z"".
Dxj$A$ABBB	+*+,,8	}%[-.//   
+x  ,v.[6(0K0KLLL	r#   c                    i }t          |dg          5t          |ddgt          j        | t          |dg                               t          |dg          1t          |ddgt	          t          |dg          ||                     t          |dg          "t          |g dt          |dg                     t          |dg           t          t          |dg          ||           |S )Nrl   rm   r  r   upscale_factor)r   r1  upscaleFactorr   )r7   r8   rt   ru   r  r5  rw   s        r!   $_UpscaleImageAPIParameters_to_vertexr9  <  s%    !)	+y!!-			*d;	::;;   
+y!!-	!kG955y+NN   
+()**6888[+,--   
+z"".$[8*%%y+   
r#   c           	          i t          | dg          !t          dgt          | dg                     t          | dg          .t          dgfdt          | dg          D                        S )Nrz   r{   r   r   c                 2    g | ]}t          |          S rU   r   rr   s     r!   rY   z5_UpscaleImageResponse_from_vertex.<locals>.<listcomp>o  r  r#   rc   r9   s     `@r!   !_UpscaleImageResponse_from_vertexr<  `  r  r#   c           
          i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          !t          |dgt          | dg                     |S )Nr  r
  rd  re  r  r9   s       r!   r  r  x  s    
 !)	+y!!-		kG955y+NN   
+}%%1ZL${[M"B"BCCC	r#   c           
      ,   i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          ?t          t          | dg                     t          |dgt          | dg                     |S Nr  r  r  )r7   r8   r  r)   r9   s       r!   r  r    s    
 !)	+y!!-		[7)44iMM   
+()**68[+,--   	_%tK:J9K'L'LMMM	r#   c           
          i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          !t          |dgt          | dg                     |S r?  r  r9   s       r!   r  r    s    
 !)	+y!!-		kG955y+NN   
+()**6_%tK:J9K'L'LMMM	r#   c           
      Z   i }t          | dg          !t          |dgt          | dg                     t          | dg          3t          |dgt          j        t          | dg                               t          | dg          !t          |dgt          | dg                     |S )NuriencodedVideovideo_bytesencodingr@   r8  r9   s       r!   r  r    s    
 !)	+w+UGT+w77888	+'((4	tK.)9::;;   
+
|$$0[M4j\#B#BCCC	r#   c           
      Z   i }t          | dg          !t          |dgt          | dg                     t          | dg          3t          |dgt          j        t          | dg                               t          | dg          !t          |dgt          | dg                     |S )Nr<  rB  r6  rD  rA   r@   r8  r9   s       r!   r  r    s    
 !)	+z"".UGT+z::;;;	+,-..:	tK*>)?@@AA   
+
|$$0[M4j\#B#BCCC	r#   c           
      Z   i }t          | dg          !t          |dgt          | dg                     t          | dg          3t          |dgt          j        t          | dg                               t          | dg          !t          |dgt          | dg                     |S )NrB  rD  rC  r@   rE  r8  r9   s       r!   r  r    s    
 !)	+w+UGT+w77888	+''3	tK-99::   
+}%%1ZL${[M"B"BCCC	r#   c           
      Z   i }t          | dg          !t          |dgt          | dg                     t          | dg          3t          |dgt          j        t          | dg                               t          | dg          !t          |dgt          | dg                     |S )NrB  r<  rD  r6  r@   rA   r8  r9   s       r!   r  r    s    
 !)	+w+XJ[5' : :;;;	+''3	tK-99::   
+}%%1ZL${[M"B"BCCC	r#   c           
          i }t          | dg          0t          |dgt          t          | dg          ||                     t          | dg          !t          |dgt          | dg                     |S )Nreplicated_voice_configreplicatedVoiceConfigprebuilt_voice_configprebuiltVoiceConfig)r7   r8   r  r9   s       r!   r  r    s    
 !)	+1233?	 !(89::	
 	
   
+/011=	[2344   
r#   c                      e Zd Zdddedeej        ej        f         deej	                 dej
        fdZdddedeej        ej        f         deej	                 deej
                 fdZddddd	dedeeej        ej        f                  d
eeej        ej        f                  deej                 deej                 dej        fdZdddededeej                 dej        fdZdddededeej                 deej                 dej        f
dZdddedej        dedeej                 dej        f
dZdddedej         deej!                 dej"        fdZ#dddedej$        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deej.                 dej)        fdZ/dddedeej0                 dej1        fdZ2dddedeej        ej        f         deej3                 dej4        fdZ5dddedeej        ej        f         deej6                 dej7        fdZ8dddddddedee         deej                 deej9                 deej:                 deej;                 dej<        fdZ=dddedeej        ej        f         deej                 dej        fd Z>dddedej        deej	                 dej
        fd!Z?dddedej        deej	                 deej
                 fd"Z@dddededeej                 dej        fd#ZAdddededeej                 deej                 dej        f
d$ZBdddedej        dedeejC                 dej        f
d%ZDdddddddedee         deej                 deej9                 deej:                 deej;                 dej<        fd&ZEdddeej+                 deFej)                 fd'ZdS )(ModelsNr   rl   rn   r   r   c                R   t          j        |||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }	|j
        |j
        j        |j
        j        }	t          j        |          }t          j        |          }| j                            d|||	          }
|Bt!          |dd           r1t          j        |
	          }| j                            |           |S |
j        si nt)          j        |
j                  }| j        j        rt-          |d |          }| j        j        st/          |d |          }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 Nrl   rn   r   rm   z{model}:generateContentrC  ?r   postshould_return_http_response)r{   r\  r^  include_all_fieldsr\  r^  rW  r  kwargsheaders)r   _GenerateContentParameters_api_clientvertexair  r,  
format_mapr  r	   popr   http_optionsr   convert_to_dictencode_unserializable_typesrequestgetattrGenerateContentResponse_verify_responsebodyjsonloadsr  r  _from_responseHttpResponser\  r{   selfrl   rn   r   parameter_modelrequest_dictrequest_url_dictpathquery_paramsrb  r  return_valueresponse_dicts                r!   _generate_contentzModels._generate_content)  s)    6  O   )9

OT? l &))&11	 )(334DEE(8

OT? l &))&11	 )(334DEE(##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H g-t  2XNNNl
''555&mJBBHM1J1JM  :
 m $ 9
 m 0?? ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! @  L$ &+%7 & & &L" 	%%l333r#   c             #   $  K   t          j        |||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }	|j
        |j
        j        |j
        j        }	t          j        |          }t          j        |          }| t          |dd           rt!          d          | j                            d	|||	          D ]}
|
j        si nt'          j        |
j                  }| j        j        rt+          |d |          }| j        j        st-          |d |          }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                            |           |V  d S )NrS  rm   %{model}:streamGenerateContent?alt=sserC  rT  r   rV  FAccessing the raw HTTP response is not supported in streaming methods.rU  r\  r^  rW  rX  rY  r[  )r   r]  r^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  rf  r   request_streamedri  rj  rk  r  r  rg  rl  rm  r\  r{   rh  ro  rl   rn   r   rp  rq  rr  rs  rt  rb  r  rv  ru  s                r!   _generate_content_streamzModels._generate_content_stream  s@      6  O   79

OT? l &))&11	 76AA
 
 78

OT? l &))&11	 76AA
 
 7##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDLg-t    
 $55lL  & & !)Lbb4:hm3L3Lm			" 
<4
 
 & 
;4
 
 2AA  _h55%,%,.?& & +2%,.Dd+ + )0%,.BD) )
 
  ! B  l$ (-'9"( ( (l$ ''555M& &r#   rn   rD   r  r   rD   r  c                   t          j        |||||          }| j        j        rdt	          | j        |d|          }|                    d          }t          j        |j                  rdnd}	|r|		                    |          }
nI|	}
nFt          | j        |d|          }|                    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-          |d|          }| j        j        st/          |d|          }t           j                            |t5          |d	d          rDd	t5          |j        dd          t5          |j        dd          t5          |j        dd          dini           }t          j        |j                  |_        | j                            |           |S )aA  Calculates embeddings for the given contents. Only text is supported.

    Args:
      model (str): The model to use.
      contents (list[Content]): The contents to embed.
      config (EmbedContentConfig): Optional configuration for embeddings.

    Usage:

    .. code-block:: python

      embeddings = client.models.embed_content(
          model= 'text-embedding-004',
          contents=[
              'What is your name?',
              'What is your favorite color?',
          ],
          config={
              'output_dimensionality': 64
          },
      )
    rl   rn   rD   r  r   Nrm   {model}:embedContent{model}:predict{model}:batchEmbedContentsrC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   _EmbedContentParametersPrivater^  r_  r   r,  rt   t_is_vertex_embed_content_modelrl   r`  r  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r/  r%  EmbedContentResponserl  rf  rm  r\  r{   rh  ro  rl   rn   rD   r  r   rp  rq  rr  endpoint_urlrs  rt  rb  r  rv  ru  s                   r!   _embed_contentzModels._embed_content  s    H :-  O   ,=

OT? l &))&11/0/PQ`Qf/g/g~++m~l	 &&'788<

OT? l &))&11	 ,+667GHH+##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  7
 m $ 6
 m -<< ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! =  L$ &+%7 & & &L" 	%%l333r#   r   c                   t          j        |||          }| j        j        rGt	          | j        |d|          }|                    d          }|rd                    |          }nId}nFt          | j        |d|          }|                    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'          |d|          }| j        j        st)          |d|          }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 )z%Private method for generating images.rl   r   r   Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   _GenerateImagesParametersr^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r  r  GenerateImagesResponserl  rf  rm  r\  r{   rh  ro  rl   r   r   rp  rq  rr  rs  rt  rb  r  rv  ru  s                r!   _generate_imageszModels._generate_imagesg  s    5  O   !8

OT? l &))&11	 ! ++,<== 7

OT? l &))&11	 ! ++,<== ##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  9
 m $ 8
 m />> ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! ?  L$ &+%7 & & &L" 	%%l333r#   r   c                "   t          j        ||||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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 )z$Private method for editing an image.rl   r   r   r   iThis method is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   _EditImageParametersr^  r_  r   r   r,  r`  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r  EditImageResponserl  rf  rm  r\  r{   rh  ro  rl   r   r   r   rp  rq  rr  rs  rt  rb  r  rv  ru  s                 r!   _edit_imagezModels._edit_image  sy    0)	  O $ !5  
 4

OT? l &))&11	 ! ++,<== ##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  4
 m *99 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! :  L$ &+%7 & & &L" 	%%l333r#   r  r7  c                "   t          j        ||||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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 )z&Private method for upscaling an image.rl   r  r7  r   r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   _UpscaleImageAPIParametersr^  r_  r   r9  r,  r`  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r<  UpscaleImageResponserl  rf  rm  r\  r{   rh  ro  rl   r  r7  r   rp  rq  rr  rs  rt  rb  r  rv  ru  s                 r!   _upscale_imagezModels._upscale_image  sy    6%	  O $ !5  
 :

OT? l &))&11	 ! ++,<== ##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  7
 m -<< ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! =  L$ &+%7 & & &L" 	%%l333r#   r  c                   t          j        |||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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  Recontextualizes an image.

    There is one type of recontextualization currently supported:
    1) Virtual Try-On: Generate images of persons modeling fashion products.

    Args:
      model (str): The model to use.
      source (RecontextImageSource): An object containing the source inputs
        (prompt, person_image, product_images) for image recontext. prompt is
        behind an allowlist. person_image is required. product_images is
        required. Only one product image is supported currently.
      config (RecontextImageConfig): Configuration for recontextualization.

    Usage:

      ```
      virtual_try_on_response = client.models.recontext_image(
          model="virtual-try-on-001",
          source=types.RecontextImageSource(
              person_image=types.Image.from_file(location=IMAGE1_FILE_PATH),
              product_images=[types.ProductImage(product_image=
                  types.Image.from_file(location=IMAGE2_FILE_PATH)
              )],
          ),
          config=types.RecontextImageConfig(
              number_of_images=1,
          ),
      )
      image = virtual_try_on_response.generated_images[0].image
      ```
    rl   r  r   r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  )r   _RecontextImageParametersr^  r_  r   r  r,  r`  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r  RecontextImageResponserl  rf  rh  ro  rl   r  r   rp  rq  rr  rs  rt  rb  r  rv  ru  s                r!   recontext_imagezModels.recontext_imagej  sU   N 5  O $ !5  
 9

OT? l &))&11	 ! ++,<== ##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  9
 m />> ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! ?  L& 	%%l333r#   c                   t          j        |||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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+  Segments an image, creating a mask of a specified area.

    Args:
      model (str): The model to use.
      source (SegmentImageSource): An object containing the source inputs
        (prompt, image, scribble_image) for image segmentation. The prompt is
        required for prompt mode and semantic mode, disallowed for other modes.
        scribble_image is required for the interactive mode, disallowed for
        other modes.
      config (SegmentImageConfig): Configuration for segmentation.

    Usage:

      ```
      response = client.models.segment_image(
          model="image-segmentation-001",
          source=types.SegmentImageSource(
              image=types.Image.from_file(location=IMAGE_FILE_PATH),
          ),
      )

      mask_image = response.generated_masks[0].mask
      ```
    r  r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  )r   _SegmentImageParametersr^  r_  r   r  r,  r`  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r  SegmentImageResponserl  rf  rh  r  s                r!   segment_imagezModels.segment_image  sU   @ 3  O $ !5  
 7

OT? l &))&11	 ! ++,<== ##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  7
 m -<< ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! =  L& 	%%l333r#   c                   t          j        ||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    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'          |
d |          }
| j        j        st)          |
d |          }
t           j                            |
t/          |dd           rDdt/          |j
        dd           t/          |j
        d	d           t/          |j
        d
d           dini           }| j                            |           |S Nrl   r   rm   {name}rC  rT  r   r,  r\  r^  rW  rX  rY  )r   _GetModelParametersr^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  ra  rZ  Modelrl  rf  rh  ro  rl   r   rp  rq  rr  rs  rt  rb  r  rv  ru  s               r!   r,  z
Models.get?  s    /  O   2

OT? l &))&11	 ""#3441

OT? 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  O(oNNm$ N't_MMm;-- ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! .  L& 	%%l333r#   c                \   t          j        |          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    d          }|rd                    |          }nd}|                    d          }|rI|                    d          r4|                    d          }| d| }|r|dt          |           z  }n|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'          |
d |          }
| j        j        st)          |
d |          }
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 NrP  rm   z{models_url}rC  rG  z?filter=&rT  r   r,  r\  r^  rW  rX  rY  r[  )r   _ListModelsParametersr^  r_  rT  r,  r`  rR  ra  r	   r   rb  r   rc  rd  re  ri  rj  rk  rb  r]  ListModelsResponserl  rf  rm  r\  r{   rh  ro  r   rp  rq  rr  rs  rt  query_param_filterrb  r  rv  ru  s               r!   _listzModels._list  s5    1  O   4

OT? l &))&11	 (()9::3

OT? l &))&11	 (()9::##H--L 1((22 1'++H5522022d	 .-Il++---	 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''t\<PPH&mJBBHM1J1JM  5
 m $ 4
 m +:: ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! ;  L$ &+%7 & & &L" 	%%l333r#   c                   t          j        ||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    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'          |
d |          }
| j        j        st)          |
d |          }
t           j                            |
t/          |dd           rDdt/          |j
        d	d           t/          |j
        d
d           t/          |j
        dd           dini           }| j                            |           |S Nr  rm   z{model}r  rC  rT  r   patchr\  r^  rW  rX  rY  )r   _UpdateModelParametersr^  r_  r.  r,  r`  r,  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  ra  rZ  r  rl  rf  rh  r  s               r!   updatezModels.update  s    2  O   5

OT? l &))&11	 ##$4554

OT? 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  O(oNNm$ N't_MMm;-- ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! .  L& 	%%l333r#   c                   t          j        ||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    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'          |
d |          }
| j        j        st)          |
d |          }
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  rm   r  rC  rT  r   deleter\  r^  rW  rX  rY  r[  )r   _DeleteModelParametersr^  r_  r   r,  r`  r   r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r   r   DeleteModelResponserl  rf  rm  r\  r{   rh  r  s               r!   r  zModels.delete2  s    2  O   5

OT? l &))&11	 ""#3444

OT? 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  6
 m $ 5
 m ,;; ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! <  L$ &+%7 & & &L" 	%%l333r#   c                   t          j        |||          }| j        j        rGt	          | j        |d|          }|                    d          }|rd                    |          }nId}nFt          | j        |d|          }|                    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'          |d|          }| j        j        st)          |d|          }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 )a8  Counts the number of tokens in the given content.

    Multimodal input is supported for Gemini models.

    Args:
      model (str): The model to use for counting tokens.
      contents (list[types.Content]): The content to count tokens for.
      config (CountTokensConfig): The configuration for counting tokens.

    Usage:

    .. code-block:: python

      response = client.models.count_tokens(
          model='gemini-2.0-flash',
          contents='What is your name?',
      )
      print(response)
      # total_tokens=5 cached_content_token_count=None
    rS  Nrm   {model}:countTokensrC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   _CountTokensParametersr^  r_  r   r,  r`  r   r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r   r   CountTokensResponserl  rf  rm  r\  r{   rh  r|  s                r!   count_tokenszModels.count_tokens  s   8 2  O   %5

OT? l &))&11	 %$//0@AA$4

OT? l &))&11	 %$//0@AA$##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  6
 m $ 5
 m ,;; ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! <  L$ &+%7 & & &L" 	%%l333r#   c                    t          j        |||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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 )az  Given a list of contents, returns a corresponding TokensInfo containing the

    list of tokens and list of token ids.

    This method is not supported by the Gemini Developer API.

    Args:
      model (str): The model to use.
      contents (list[shared.Content]): The content to compute tokens for.

    Usage:

    .. code-block:: python

      response = client.models.compute_tokens(
          model='gemini-2.0-flash',
          contents='What is your name?',
      )
      print(response)
      # tokens_info=[TokensInfo(role='user', token_ids=['1841', ...],
      # tokens=[b'What', b' is', b' your', b' name', b'?'])]
    rS  r  Nrm   {model}:computeTokensrC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   _ComputeTokensParametersr^  r_  r   rx   r,  r`  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r   ComputeTokensResponserl  rf  rm  r\  r{   rh  r|  s                r!   compute_tokenszModels.compute_tokens  sv   < 4  O $ '5  
 8

OT? l &))&11	 '&112BCC&##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  8
 m .== ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! >  L$ &+%7 & & &L" 	%%l333r#   r   r  r  r  r   r  c                   t          j        ||||||          }| j        j        rGt	          | j        |d|          }|                    d          }	|	rd                    |	          }
nId}
nFt          | j        |d|          }|                    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'          |d|          }| j        j        st)          |d|          }t           j                            |t/          |dd          rDdt/          |j
        d	d          t/          |j
        d
d          t/          |j
        dd          dini           }| j                            |           |S )z%Private method for generating videos.rl   r   r  r  r  r   Nrm   {model}:predictLongRunningrC  rT  r   rU  r\  r^  rW  rX  rY  )r   _GenerateVideosParametersr^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  re  ri  rj  rk  r  r  GenerateVideosOperationrl  rf  rh  ro  rl   r   r  r  r  r   rp  rq  rr  rs  rt  rb  r  rv  ru  s                   r!   _generate_videoszModels._generate_videos^  s    5  O   ,8

OT? l &))&11	 ,+667GHH+7

OT? l &))&11	 ,+667GHH+##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL''lL H 'mJBBHM1J1JM  :
 m $ 9
 m 0?? ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! @  L& 	%%l333r#   c                   | j         j        s0d|v rt          j        |          }|                     |||          S t          j        |          ret          j        |          }t          |          dk    rt          d          |                     |d|d         t          j	        j
        |          S |                     |d|t          j	        j        |          S )	a  Calculates embeddings for the given contents.

    Args:
      model (str): The model to use.
      contents (list[Content]): The contents to embed.
      config (EmbedContentConfig): Optional configuration for embeddings.

    Usage:

    .. code-block:: python

      embeddings = client.models.embed_content(
          model= 'text-embedding-004',
          contents=[
              'What is your name?',
              'What is your favorite color?',
          ],
          config={
              'output_dimensionality': 64
          },
      )

      multimodal_embeddings = client.models.embed_content(
          model='gemini-embedding-2-preview',
          contents=[
              types.Part.from_uri(
                  file_uri='gs://generativeai-downloads/images/scones.jpg',
                  mime_type='image/jpeg',
              ),
          ],
          config={
              'output_dimensionality': 64
          },
      )
    gemini-embedding-2rS  r
   HThe embedContent API for this model only supports one content at a time.Nr   r  )rl   rD   rn   r  r   r^  r_  rt   rv   r  r  lenr   r   EmbeddingApiTyper  r  ro  rl   rn   r   normalized_contentss        r!   embed_contentzModels.embed_content  s   T $ P		&	&<))  ux OOO(// L22	 	!	!A	%	%
 
 	
   %a("3A !      "3; !   r#   c                0   t          j        |          }t          j        |          }|r4|j        r-t	          j        |j                  rt          j        d          t          j        |          r| 	                    |||          S |rd}t          |t          j                  r|j        rt          |j                  }n<t          |t                    r'|                    dg           }|rt          |          }t          |          |k    rCd                    t#          t$          |                    }t&                              d|           | 	                    |||          S t          j        |          }	t&                              d|	 d           g }
t          j                    }d}|	dk    r|r|                    d	
          nd}t          j        |          }|rt          j        |          }|dz  }| 	                    |||          }|snU|snQ|j        r)|j        d         j        r|j        d         j        j        snt          j        ||          }|snt&                              d| d           |	dz  }	|	dk    rt&                              d           |j        d         j        }t          j        d|          }tA          j!        |          }|
s|
"                    |           t          |tF                    r*|$                    |           |$                    |           |
$                    |           |
$                    |           |	dk    t          j%        |          r	||
|_&        |S )a	  Makes an API request to generate content using a model.

    For the `model` parameter, supported formats for Gemini Enterprise Agent
    Platform API include:
    - The Gemini model ID, for example: 'gemini-2.0-flash'
    - The full resource name starts with 'projects/', for example:
      'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
    - The partial resource name with 'publishers/', for example:
      'publishers/google/models/gemini-2.0-flash' or
    - `/` separated publisher and model name, for example:
      'google/gemini-2.0-flash'

    For the `model` parameter, supported formats for Gemini API include:
    - The Gemini model ID, for example: 'gemini-2.0-flash'
    - The model name starts with 'models/', for example:
      'models/gemini-2.0-flash'
    - For tuned models, the model name starts with 'tunedModels/',
      for example:
      'tunedModels/1234567890123456789'

    Some models support multimodal input and output.

    Built-in MCP support is an experimental feature.

    Usage:

    .. code-block:: python

      from google.genai import types
      from google import genai

      client = genai.Client(
          vertexai=True, project='my-project-id', location='us-central1'
      )

      response = client.models.generate_content(
        model='gemini-2.0-flash',
        contents='''What is a good name for a flower shop that specializes in
          selling bouquets of dried flowers?'''
      )
      print(response.text)
      # **Elegant & Classic:**
      # * The Dried Bloom
      # * Everlasting Florals
      # * Timeless Petals

      response = client.models.generate_content(
        model='gemini-2.0-flash',
        contents=[
          types.Part.from_text(text='What is shown in this image?'),
          types.Part.from_uri(file_uri='gs://generativeai-downloads/images/scones.jpg',
          mime_type='image/jpeg')
        ]
      )
      print(response.text)
      # The image shows a flat lay arrangement of freshly baked blueberry
      # scones.
    6MCP sessions are not supported in synchronous methods.rS  r   r   , Tools at indices [%s] are not compatible with automatic function calling (AFC). AFC is disabled. If AFC is intended, please include python callables in the tool list, and do not include function declaration and MCP server in the tool list.&AFC is enabled with max remote calls: .TdeepNr
   AFC remote call 	 is done.8Reached max remote calls for automatic function calling.userr   r   )'r   "find_afc_incompatible_tool_indexesparse_config_for_mcp_usager   r   has_mcp_session_usager   UnsupportedFunctionErrorshould_disable_afcrw  
isinstancer   GenerateContentConfigr  dictr,  joinmapstrloggerwarningget_max_remote_calls_afcinforg  
model_copyget_function_mapget_usage_headerr  rD   r   get_function_response_partsContentrt   rv   extendlistappendshould_append_afc_history"automatic_function_calling_history)ro  rl   rn   r   incompatible_tools_indexesparsed_configoriginal_tools_lengthr   indices_strremaining_remote_calls_afcr   r  iparsed_config_to_callfunction_mapfunc_response_partsfunc_call_contentfunc_response_contents                     r!   generate_contentzModels.generate_content  s9   F 	7??  !;FCCM ,]-@AA
 +
B   &}55 ## $    " 	FE7	8	8 -< 	4"%fl"3"3
fd## -

7B'' 	-"%e**
	'	(	(,A	A	AiiC)C D DEED 	
 	
 	
 ## $    ".!F" " KKN1KNNN   ?A&,..H	A
$q
(
(1>
H-
"
"
"
-
-
-D  "2=AAl	 
 , =!!
 !
 1fa''1F (  h   !$Q'/ $Q'/5
 	(D
L  ! kk1Q111222 A% 	#q	(	(NOOO"-a08#m#   h''h/ <*11(;;;	Hd	#	# /)***-...(//0ABBB(//0EFFF] %q
(
(` 	.}==  - 1 Or#   c             #     K   t          j        |          }t          j        |          }|r4|j        r-t	          j        |j                  rt          j        d          t          j        |          r | 	                    |||          E d{V  dS |rd}t          |t          j                  r|j        rt          |j                  }n<t          |t                    r'|                    dg           }|rt          |          }t          |          |k    rCd                    t#          t$          |                    }t&                              d|           | 	                    |||          E d{V  dS t          j        |           t          j        |          }	t&                              d|	 d	           g }
d}d}d}|	dk    r|r|                    d
          nd}t          j        |          }|rt          j        |          }|dz  }| 	                    |||          }|dk    r|D ]}|st          j        ||          }|V  |j        r)|j        d         j        r|j        d         j        j        s n1t          j        ||          }|st          j        ||          }|V  n|D ]6}t          j         |          r|
|_!        t          j        ||          }|V  7|0|j        r)|j        d         j        r|j        d         j        j        sdS t          j        ||          }|sdS |sdS t&                              d| d           |	dz  }	|	dk    rt&                              d           ||j        |j        d         j        }t          j"        d|          }tG          j$        |          }|
s|
%                    |           t          |tL                    r,|*|'                    |           |'                    |           ||
'                    |           |
'                    |           |	dk    dS dS )a-  Makes an API request to generate content using a model and yields the model's response in chunks.

    For the `model` parameter, supported formats for Gemini Enterprise Agent
    Platform API include:
    - The Gemini model ID, for example: 'gemini-2.0-flash'
    - The full resource name starts with 'projects/', for example:
      'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
    - The partial resource name with 'publishers/', for example:
      'publishers/google/models/gemini-2.0-flash' or
    - `/` separated publisher and model name, for example:
      'google/gemini-2.0-flash'

    For the `model` parameter, supported formats for Gemini API include:
    - The Gemini model ID, for example: 'gemini-2.0-flash'
    - The model name starts with 'models/', for example:
      'models/gemini-2.0-flash'
    - For tuned models, the model name starts with 'tunedModels/',
      for example:
      'tunedModels/1234567890123456789'

    Some models support multimodal input and output.

    Built-in MCP support is an experimental feature.

    Usage:

    .. code-block:: python

      from google.genai import types
      from google import genai

      client = genai.Client(
          vertexai=True, project='my-project-id', location='us-central1'
      )

      for chunk in client.models.generate_content_stream(
        model='gemini-2.0-flash',
        contents='''What is a good name for a flower shop that specializes in
          selling bouquets of dried flowers?'''
      ):
        print(chunk.text)
      # **Elegant & Classic:**
      # * The Dried Bloom
      # * Everlasting Florals
      # * Timeless Petals

      for chunk in client.models.generate_content_stream(
        model='gemini-2.0-flash',
        contents=[
          types.Part.from_text('What is shown in this image?'),
          types.Part.from_uri('gs://generativeai-downloads/images/scones.jpg',
          'image/jpeg')
        ]
      ):
        print(chunk.text)
      # The image shows a flat lay arrangement of freshly baked blueberry
      # scones.
    r  rS  Nr   r   r  z_Tools at indices [%s] are not compatible with automatic function calling. AFC will be disabled.r  r  Tr  r
   r  r  r  r  r  )(r   r  r  r   r   r  r   r  r  r}  r  r   r  r  r  r,  r  r  r  r  r  'raise_error_for_afc_incompatible_configr  r  r  r  r  append_chunk_contentsr  rD   r   r  r  r   r  rt   rv   r  r  r  )ro  rl   rn   r   r  r  r  r   r  r  r   chunkr	  r  r  r  r  r
  r  s                      r!   generate_content_streamzModels.generate_content_stream  s     F 	7??  !;FCCM ,]-@AA
 +
B   &}55 .. /          f! 	FE7	8	8 -< 	4"%fl"3"3
fd## -

7B'' 	-"%e**
	'	(	(,A	A	AiiC)C D DEE-	
 	
 	

 .. /          f 8GGG!-!F" " KKN1KNNN   ?A&E	A
$q
(
(1>
H-
"
"
"
-
-
-D  "2=AAl	 
 , =!!
 !
 1fa..1F /  h 
a  	 	E #9(EJJHKKKK $'*2 '*28
 e"."J|# # ' %;HeLLhkkk  	 	E3MBB 2 4 "7%HH(++++M# #A&.  #A&.4 
 %*F<
 
    kk1Q111222 A% 	#q	(	(NOOO 
	u/;!,Q/7 %%!
 !
 !
 <))1 	>
,
3
3H
=
=
=h%% 	1*;*G
//+
,
,
,
///
0
0
0(
,
3
34E
F
F
F*112GHHHa %q
(
(
(
(
(
(r#   c                    |                      |||          }d}g }|r|j        s|S |j        D ]6}|j        r|j        j        dk    r|j        }!|                    |           7t          j        ||          }|S )ap  Generates images based on a text description and configuration.

    Args:
      model (str): The model to use.
      prompt (str): A text description of the images to generate.
      config (GenerateImagesConfig): Configuration for generation.

    Usage:

    .. code-block:: python

      response = client.models.generate_images(
        model='imagen-3.0-generate-002',
        prompt='Man with a dog',
        config=types.GenerateImagesConfig(
            number_of_images= 1,
            include_rai_reason= True,
        )
      )
      response.generated_images[0].image.show()
      # Shows a man with a dog.
    r  NPositive Promptr   r  r  r   r  r  r  r   r  	ro  rl   r   r   api_responser  r   generated_imager  s	            r!   generate_imageszModels.generate_imagesu  s    : (( )  L
 )-% |< '8 1 1

+1/<  -<,M))0000+)*K  H Or#   c                4    |                      ||||          S )aU  Edits an image based on a text description and configuration.

    Args:
      model (str): The model to use.
      prompt (str): A text description of the edit to apply to the image.
        reference_images (list[Union[RawReferenceImage, MaskReferenceImage,
        ControlReferenceImage, StyleReferenceImage, SubjectReferenceImage]): The
        reference images for editing.
      config (EditImageConfig): Configuration for editing.

    Usage:

    .. code-block:: python

      from google.genai.types import RawReferenceImage, MaskReferenceImage

      raw_ref_image = RawReferenceImage(
        reference_id=1,
        reference_image=types.Image.from_file(location=IMAGE_FILE_PATH),
      )

      mask_ref_image = MaskReferenceImage(
        reference_id=2,
        config=types.MaskReferenceConfig(
            mask_mode='MASK_MODE_FOREGROUND',
            mask_dilation=0.06,
        ),
      )
      response = client.models.edit_image(
        model='imagen-3.0-capability-001',
        prompt='Man with dog',
        reference_images=[raw_ref_image, mask_ref_image],
        config=types.EditImageConfig(
            edit_mode= "EDIT_MODE_INPAINT_INSERTION",
            number_of_images= 1,
            include_rai_reason= True,
        )
      )
      response.generated_images[0].image.show()
      # Shows a man with a dog instead of a cat.
    r  r  ro  rl   r   r   r   s        r!   
edit_imagezModels.edit_image  s.    b )	    r#   c                   t          j        ||||           |pi }t          |t           j                  r|                                }nt          |          }t          j        |                    dd          |                    dd          |                    dd          |                    dd          |                    dd          |                    dd          |                    d	d          |                    d
d          |                    dd          |                    dd          
  
        }d|d<   d|d<   |                     ||||          S )a  Makes an API request to upscale a provided image.

    Args:
      model (str): The model to use.
      image (Image): The input image for upscaling.
      upscale_factor (str): The factor to upscale the image (x2 or x4).
      config (UpscaleImageConfig): Configuration for upscaling.

    Usage:

    .. code-block:: python

      from google.genai.types import Image

      IMAGE_FILE_PATH="my-image.png"
      response=client.models.upscale_image(
          model='imagen-3.0-generate-001',
          image=types.Image.from_file(location=IMAGE_FILE_PATH),
          upscale_factor='x2',
      )
      response.generated_images[0].image.show()
      # Opens my-image.png which is upscaled by a factor of 2.
    r  rb  Nr   r   r   r   r   r   r0  r3  r   
rb  r   r   r   r   r   r   r0  r3  r   upscalerD  r
   r   	r   UpscaleImageParametersr  UpscaleImageConfig
model_dumpr  _UpscaleImageAPIConfigDictr,  r  ro  rl   r  r7  r   
config_dct
api_configs          r!   upscale_imagezModels.upscale_image  s~   B 
 %	    \rF&%233  $$&&jj<<j1^^ND99!~~&6==&NN+@$GG$..)<dCC%>>*>EE#(:DAA#->>($$
 $
 'NN+@$GG",..'#
 #
 ~~h--  J$ #Jv%&J!"%	    r#   c          
         |s|s|r|rt          d          i }| j        j        s|rt          |t          j                  r|                                }nt          |          }|                    d          rQ|                    d          r<t	          j        |                    d          |                    d                    }no| j        j        sb|r_t          |t          j	                  r+|                                }|                    di           }nwt          |          }t          |                    d          t          j                  r;|                    dt	          j                              }	|	                                }|r|                    d          r|                    d          rwt	          j	        |                    d          |                    d          t	          j        |                    d          |                    d                    	          }| 
                    ||||||
          S )  Generates videos based on an input (text, image, or video) and configuration.

    The following use cases are supported:
    1. Text to video generation.
    2a. Image to video generation (additional text prompt is optional).
    2b. Image to video generation with frame interpolation (specify last_frame
    in config).
    3. Video extension (additional text prompt is optional)

    Args:
      model: The model to use.
      prompt: The text prompt for generating the videos. Optional for image to
        video and video extension use cases. This argument is deprecated, please
        use source instead.
      image: The input image for generating the videos. Optional if prompt is
        provided. This argument is deprecated, please use source instead.
      video: The input video for video extension use cases. Optional if prompt
        or image is provided. This argument is deprecated, please use source
        instead.
      source: The input source for generating the videos (prompt, image, and/or
        video)
      config: Configuration for generation.

    Usage:

      ```
      operation = client.models.generate_videos(
          model="veo-2.0-generate-001",
          source=types.GenerateVideosSource(
              prompt="A neon hologram of a cat driving at top speed",
          ),
      )
      while not operation.done:
          time.sleep(10)
          operation = client.operations.get(operation)

      operation.result.generated_videos[0].video.uri
      ```
    MSource and prompt/image/video are mutually exclusive. Please only use source.rB  rD  r@   rB  r@   r  r   r  r   r  r  r  r   r^  r_  r  r   Videor$  r  r,  GenerateVideosSourcer  
ro  rl   r   r  r  r  r   	video_dct
source_dct	video_objs
             r!   generate_videoszModels.generate_videos.  sO   b 	 % 5 f '  
 !#I$ 
 
	E5;	'	'  $$&&		KK		u		 
)--">"> 
e$$	k0J0J
 
 
 & 
6 
	FE6	7	7 -&&((
NN7B//		&\\
jnnW--u{;; 	-#->>'5;==#I#I)**,,)	 
y}}U++ 
	m0L0L 
+>>(++..))+MM%((#--44  
 
 
    !   r#   c                J   t          j        |          j        pt          j                    }|j        d|_        | j        j        r2|                    d          }|j        s|j        }|r|dz   nd|_        t          d| j
        | 
                    |          |          S )a  Makes an API request to list the available models.

    If `query_base` is set to True in the config or not set (default), the
    API will return all available base models. If set to False, it will return
    all tuned models.

    Args:
      config (ListModelsConfigOrDict): Configuration for retrieving models.

    Usage:

    .. code-block:: python

      response=client.models.list(config={'page_size': 5})
      print(response.page)
      # [Model(name='projects/./locations/./models/123', display_name='my_model'

      response=client.models.list(config={'page_size': 5, 'query_base': True})
      print(response.page)
      # [Model(name='publishers/google/models/gemini-2.0-flash-exp' ...
    rP  NTr  &filter=labels.tune-type:*labels.tune-type:*rX  )r   r  r   ListModelsConfigrH  r^  r_  r  rG  r   r  ro  r   filter_values      r!   r  zModels.list  s    8 	#62229 	$!##   f  	
  d ++f 
} &L777% 	
 


&
!!	  r#   )G__name__
__module____qualname__r  r   r   ContentListUnionContentListUnionDictr   GenerateContentConfigOrDictrg  rw  r   r}  ContentUnionContentUnionDictr  EmbedContentConfigOrDictr  r  GenerateImagesConfigOrDictr  r  r  _ReferenceImageAPIOrDictEditImageConfigOrDictr  r  ImageOrDict_UpscaleImageAPIConfigOrDictr  r  RecontextImageSourceOrDictRecontextImageConfigOrDictr  r  SegmentImageSourceOrDictSegmentImageConfigOrDictr  r  GetModelConfigOrDictr  r,  ListModelsConfigOrDictr  r  UpdateModelConfigOrDictr  DeleteModelConfigOrDictr  r  CountTokensConfigOrDictr  r  ComputeTokensConfigOrDictr  r  VideoOrDictGenerateVideosSourceOrDictGenerateVideosConfigOrDictr  r  r  r  r  r  r  UpscaleImageConfigOrDictr)  r6  r   rU   r#   r!   rO  rO  '  s
        =A^ ^ ^ ^ e,e.HHI	^
 u89^ $^ ^ ^ ^J =Ac c c c e,e.HHI	c
 u89c -.c c c cV  =A9=w w w w 
&(BB
C	w 
"E$::
;w #5#9:w u56w !w w w w| <@Y Y Y Y 	Y
 u78Y #Y Y Y YB 7;R R R R 	R
 U;<R u23R R R R Rt >BR R R R 	R
 R u9:R !R R R Rr <@l l l l .	l
 u78l #l l l lf :>e e e e ,	e
 u56e !e e e eP KOJ J JJ#+E,F#GJ{J J J JZ AET T T <=TT T T Tt 9=	O O O O u45	O
 {O O O Oj 9=	U U U U u45	U
  U U U Ux 9=l l l l e,e.HHI	l
 u45l  l l l lf ;?e e e e e,e.HHI	e
 u67e "e e e eV #+/+/;?;?] ] ] ] sm	]
 e'(] e'(] u78] u78] $] ] ] ]H :>D D D D e,e.HHI	D
 u56D !D D D DV =Ag g g g *	g
 u89g $g g g g\ =AGI GI GI GI *	GI
 u89GI -.GI GI GI GI\ <@5 5 5 5 	5
 u785 #5 5 5 5z 7;6 6 6 6 	6
 U;<6 u236 6 6 6 6| :>H H H H 	H
 H u56H !H H H H\ #+/+/;?;?[ [ [ [ sm	[
 e'([ e'([ u78[ u78[ $[ [ [ [@ 8<0 0 0 u340 U[	0 0 0 0 0 0r#   rO  c                   \   e Zd Zdddedeej        ej        f         deej	                 dej
        fdZdddedeej        ej        f         deej	                 deeej
                          fdZddddd	dedeeej        ej        f                  d
eeej        ej        f                  deej                 deej                 dej        fdZdddededeej                 dej        fdZdddededeej                 deej                 dej        f
dZdddedej        dedeej                 dej        f
dZ dddedej!        deej"                 dej#        fdZ$dddedej%        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deej/                 dej*        fdZ0dddedeej1                 dej2        fdZ3dddedeej        ej        f         deej4                 dej5        fdZ6dddedeej        ej        f         deej7                 dej8        fdZ9dddddddedee         deej                 deej:                 deej;                 deej<                 dej=        fdZ>dddedeej        ej        f         deej	                 dej
        fd Z?dddedeej        ej        f         deej	                 deej
                 fd!Z@dddededeej                 deej                 dej        f
d"ZAdddeej,                 deBej*                 fd#Zdddededeej                 dej        fd$ZCdddedej        dedeejD                 dej        f
d%ZEdddddddedee         deej                 deej:                 deej;                 deej<                 dej=        fd&ZFdddedeej        ej        f         deej                 dej        fd'ZGdS )(AsyncModelsNrP  rl   rn   r   r   c                b  K   t          j        |||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    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 }
|Bt!          |dd           r1t          j        |
	          }| j                            |           |S |
j        si nt)          j        |
j                  }| j        j        rt-          |d |          }| j        j        st/          |d |          }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 rR  )r   r]  r^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  async_requestrf  rg  rh  ri  rj  rk  r  r  rl  rm  r\  r{   rn  s                r!   rw  zAsyncModels._generate_content  sK      6  O   )9

OT? l &))&11	 )(334DEE(8

OT? l &))&11	 )(334DEE(##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H g-t  2XNNNl
''555&mJBBHM1J1JM  :
 m $ 9
 m 0?? ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! @  L$ &+%7 & & &L" 	%%l333r#   c                ,   
K   t          j        |||          
 j        j        rGt	           j        
d 
          }|                    d          }|rd                    |          }nId}nFt           j        
d 
          }|                    d          }|rd                    |          }nd}|                    d          }|r| dt          |           }|	                    dd            d }
j
        
j
        j        
j
        j        }t          j        |          }t          j        |          }| t          |dd           rt!          d           j                            d	|||           d {V 
 fd
}	 |	            S )NrS  rm   ry  rC  rT  r   rV  rz  rU  c                 D  K   2 3 d {V } | j         si nt          j        | j                   }j        j        rt          |d           }j        j        st          |d           }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                            |           |W V  6 d S )Nr   r\  r^  rW  rX  rY  r[  )ri  rj  rk  r^  r_  r  r  r   rg  rl  rf  r   rm  r\  r{   rh  )r  rv  ru  rp  response_streamro  s      r!   async_generatorz=AsyncModels._generate_content_stream.<locals>.async_generatora  s     + $ $ $ $ $ $ $"*-NTZ5N5N$ 	>T? - ( 	=T? - 4CC" $77'.'.0A4( ( -4'.0F- - +2'.0Dd+ +
 
  ! D 
 
$ */);$*
 *
 *
& 	)),777I ,OOs   D)r   r]  r^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  rf  r   async_request_streamed)ro  rl   rn   r   rq  rr  rs  rt  rb  r`  rp  r_  s   `         @@r!   r}  z$AsyncModels._generate_content_stream   s-      6  O   79

OT? l &))&11	 76AA
 
 78

OT? l &))&11	 76AA
 
 7##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDLg-t    
 !,CClL       O% % % % % % %N ?r#   r~  rD   r  c                  K   t          j        |||||          }| j        j        rdt	          | j        |d|          }|                    d          }t          j        |j                  rdnd}	|r|		                    |          }
nI|	}
nFt          | j        |d|          }|                    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-          |d|          }| j        j        st/          |d|          }t           j                            |t5          |d	d          rDd	t5          |j        dd          t5          |j        dd          t5          |j        dd          dini           }t          j        |j                  |_        | j                            |           |S )aK  Calculates embeddings for the given contents. Only text is supported.

    Args:
      model (str): The model to use.
      contents (list[Content]): The contents to embed.
      config (EmbedContentConfig): Optional configuration for embeddings.

    Usage:

    .. code-block:: python

      embeddings = await client.aio.models.embed_content(
          model= 'text-embedding-004',
          contents=[
              'What is your name?',
              'What is your favorite color?',
          ],
          config={
              'output_dimensionality': 64
          },
      )
    r  Nrm   r  r  r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   r  r^  r_  r   r,  rt   r  rl   r`  r  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r/  r%  r  rl  rf  rm  r\  r{   rh  r  s                   r!   r  zAsyncModels._embed_content  s"     H :-  O   ,=

OT? l &))&11/0/PQ`Qf/g/g~++m~l	 &&'788<

OT? l &))&11	 ,+667GHH+##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H 'mJBBHM1J1JM  7
 m $ 6
 m -<< ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! =  L$ &+%7 & & &L" 	%%l333r#   r   c                  K   t          j        |||          }| j        j        rGt	          | j        |d|          }|                    d          }|rd                    |          }nId}nFt          | j        |d|          }|                    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'          |d|          }| j        j        st)          |d|          }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 )z4Private method for generating images asynchronously.r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   r  r^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r  r  r  rl  rf  rm  r\  r{   rh  r  s                r!   r  zAsyncModels._generate_images  s      5  O   !8

OT? l &))&11	 ! ++,<== 7

OT? 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  9
 m $ 8
 m />> ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! ?  L$ &+%7 & & &L" 	%%l333r#   r   c                2  K   t          j        ||||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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 )z3Private method for editing an image asynchronously.r  r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   r  r^  r_  r   r   r,  r`  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r  r  rl  rf  rm  r\  r{   rh  r  s                 r!   r  zAsyncModels._edit_image^  s      0)	  O $ !5  
 4

OT? 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  4
 m *99 ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! :  L$ &+%7 & & &L" 	%%l333r#   r  r7  c                2  K   t          j        ||||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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 )z5Private method for upscaling an image asynchronously.r  r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   r  r^  r_  r   r9  r,  r`  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r<  r  rl  rf  rm  r\  r{   rh  r  s                 r!   r  zAsyncModels._upscale_image  s      6%	  O $ !5  
 :

OT? 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  7
 m -<< ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! =  L$ &+%7 & & &L" 	%%l333r#   r  c                  K   t          j        |||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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  Recontextualizes an image.

    There is one type of recontextualization currently supported:
    1) Virtual Try-On: Generate images of persons modeling fashion products.

    Args:
      model (str): The model to use.
      source (RecontextImageSource): An object containing the source inputs
        (prompt, person_image, product_images) for image recontext. prompt is
        behind an allowlist. person_image is required. product_images is
        required. Only one product image is supported currently.
      config (RecontextImageConfig): Configuration for recontextualization.

    Usage:

      ```
      virtual_try_on_response = await client.aio.models.recontext_image(
          model="virtual-try-on-001",
          source=types.RecontextImageSource(
              person_image=types.Image.from_file(location=IMAGE1_FILE_PATH),
              product_images=[types.ProductImage(product_image=
                  types.Image.from_file(location=IMAGE2_FILE_PATH)
              )],
          ),
          config=types.RecontextImageConfig(
              number_of_images=1,
          ),
      )
      image = virtual_try_on_response.generated_images[0].image
      ```
    r  r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  )r   r  r^  r_  r   r  r,  r`  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r  r  rl  rf  rh  r  s                r!   r  zAsyncModels.recontext_image  sw     N 5  O $ !5  
 9

OT? 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  9
 m />> ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! ?  L& 	%%l333r#   c                  K   t          j        |||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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  Segments an image, creating a mask of a specified area.

    Args:
      model (str): The model to use.
      source (SegmentImageSource): An object containing the source inputs
        (prompt, image, scribble_image) for image segmentation. The prompt is
        required for prompt mode and semantic mode, disallowed for other modes.
        scribble_image is required for the interactive mode, disallowed for
        other modes.
      config (SegmentImageConfig): Configuration for segmentation.

    Usage:

      ```
      response = await client.aio.models.segment_image(
          model="image-segmentation-001",
          source=types.SegmentImageSource(
              image=types.Image.from_file(location=IMAGE_FILE_PATH),
          ),
          config=types.SegmentImageConfig(
              mode=types.SegmentMode.foreground,
          ),
      )

      mask_image = response.generated_masks[0].mask
      ```
    r  r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  )r   r  r^  r_  r   r  r,  r`  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r  r  rl  rf  rh  r  s                r!   r  zAsyncModels.segment_imaget  sw     F 3  O $ !5  
 7

OT? 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  7
 m -<< ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! =  L& 	%%l333r#   c                  K   t          j        ||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    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'          |
d |          }
| j        j        st)          |
d |          }
t           j                            |
t/          |dd           rDdt/          |j
        dd           t/          |j
        d	d           t/          |j
        d
d           dini           }| j                            |           |S r  )r   r  r^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  ra  rZ  r  rl  rf  rh  r  s               r!   r,  zAsyncModels.get  s      /  O   2

OT? l &))&11	 ""#3441

OT? 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  O(oNNm$ N't_MMm;-- ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! .  L& 	%%l333r#   c                l  K   t          j        |          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    d          }|rd                    |          }nd}|                    d          }|rI|                    d          r4|                    d          }| d| }|r|dt          |           z  }n|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'          |
d |          }
| j        j        st)          |
d |          }
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_  rT  r,  r`  rR  ra  r	   r   rb  r   rc  rd  r\  ri  rj  rk  rb  r]  r  rl  rf  rm  r\  r{   rh  r  s               r!   r  zAsyncModels._list,  s^      1  O   4

OT? l &))&11	 (()9::3

OT? l &))&11	 (()9::##H--L 1((22 1'++H5522022d	 .-Il++---	 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33t\<       H 'mJBBHM1J1JM  5
 m $ 4
 m +:: ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! ;  L$ &+%7 & & &L" 	%%l333r#   c                  K   t          j        ||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    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'          |
d |          }
| j        j        st)          |
d |          }
t           j                            |
t/          |dd           rDdt/          |j
        d	d           t/          |j
        d
d           t/          |j
        dd           dini           }| j                            |           |S r  )r   r  r^  r_  r.  r,  r`  r,  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  ra  rZ  r  rl  rf  rh  r  s               r!   r  zAsyncModels.update  s      2  O   5

OT? l &))&11	 ##$4554

OT? 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  O(oNNm$ N't_MMm;-- ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! .  L& 	%%l333r#   c                  K   t          j        ||          }| j        j        rGt	          | j        |d |          }|                    d          }|rd                    |          }nId}nFt          | j        |d |          }|                    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'          |
d |          }
| j        j        st)          |
d |          }
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	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r   r   r  rl  rf  rm  r\  r{   rh  r  s               r!   r  zAsyncModels.delete  s      2  O   5

OT? l &))&11	 ""#3444

OT? 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  6
 m $ 5
 m ,;; ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! <  L$ &+%7 & & &L" 	%%l333r#   c                  K   t          j        |||          }| j        j        rGt	          | j        |d|          }|                    d          }|rd                    |          }nId}nFt          | j        |d|          }|                    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'          |d|          }| j        j        st)          |d|          }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 )aB  Counts the number of tokens in the given content.

    Multimodal input is supported for Gemini models.

    Args:
      model (str): The model to use for counting tokens.
      contents (list[types.Content]): The content to count tokens for.
      config (CountTokensConfig): The configuration for counting tokens.

    Usage:

    .. code-block:: python

      response = await client.aio.models.count_tokens(
          model='gemini-2.0-flash',
          contents='What is your name?',
      )
      print(response)
      # total_tokens=5 cached_content_token_count=None
    rS  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   r  r^  r_  r   r,  r`  r   r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r   r   r  rl  rf  rm  r\  r{   rh  r|  s                r!   r  zAsyncModels.count_tokens,   s     8 2  O   %5

OT? l &))&11	 %$//0@AA$4

OT? l &))&11	 %$//0@AA$##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H 'mJBBHM1J1JM  6
 m $ 5
 m ,;; ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! <  L$ &+%7 & & &L" 	%%l333r#   c                0  K   t          j        |||          }| j        j        st	          d          t          | j        |d|          }|                    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'          |d|          }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 )aF  Given a list of contents, returns a corresponding TokensInfo containing the

    list of tokens and list of token ids.


    Args:
      model (str): The model to use.
      contents (list[shared.Content]): The content to compute tokens for.

    Usage:

    .. code-block:: python

      response = await client.aio.models.compute_tokens(
          model='gemini-2.0-flash',
          contents='What is your name?',
      )
      print(response)
      # tokens_info=[TokensInfo(role='user', token_ids=['1841', ...],
      # tokens=[b'What', b' is', b' your', b' name', b'?'])]
    rS  r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  r[  )r   r  r^  r_  r   rx   r,  r`  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r   r  rl  rf  rm  r\  r{   rh  r|  s                r!   r  zAsyncModels.compute_tokens   s     : 4  O $ '5  
 8

OT? l &))&11	 '&112BCC&##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H 'mJBBHM1J1JM  8
 m .== ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! >  L$ &+%7 & & &L" 	%%l333r#   r  r  c                  K   t          j        ||||||          }| j        j        rGt	          | j        |d|          }|                    d          }	|	rd                    |	          }
nId}
nFt          | j        |d|          }|                    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'          |d|          }| j        j        st)          |d|          }t           j                            |t/          |dd          rDdt/          |j
        d	d          t/          |j
        d
d          t/          |j
        dd          dini           }| j                            |           |S )z4Private method for generating videos asynchronously.r  Nrm   r  rC  rT  r   rU  r\  r^  rW  rX  rY  )r   r  r^  r_  r  r,  r`  r  r	   ra  r   rb  r   rc  rd  r\  ri  rj  rk  r  r  r  rl  rf  rh  r  s                   r!   r  zAsyncModels._generate_videos !  s      5  O   ,8

OT? l &))&11	 ,+667GHH+7

OT? l &))&11	 ,+667GHH+##H--L 100y..00dXt$$$04L*"/;$+8l*<88L6|DDL%33lL       H 'mJBBHM1J1JM  :
 m $ 9
 m 0?? ?Hd33#*#*,=t$ $ )0#*,BD) ) '.#*,@$' '
 

 
 ! @  L& 	%%l333r#   c          	        K   t          j        |t          | j        dd                    }|sd}n=t	          |t
                    rt          j        di |}n|                    d          }t          j
                    4 d{V }| j        j        rKt          j        |          r6|3g }|j        r)|j        D ]}t	          |t          j                  r|j        r|j        s|j        s|j        s|j        s|j        r-|                    ddi          }	|                    |	           |j        D ]}
t          |
d	d          	 t-          d
          |
j        N|                    t3          j        | j        |
j                             d{V }|                    |           xt-          d          |                    |           ||_        t          j        |t          | j        dd                     d{V \  }}t          j        |          r0|                     |||           d{V cddd          d{V  S |rd}t	          |t          j                  r|j        rt=          |j                  }n<t	          |t
                    r'|                    dg           }|rt=          |          }t=          |          |k    rCd                     tC          tD          |                    }tF          $                    d|           |                     |||           d{V cddd          d{V  S t          j%        |          }tF          &                    d| d           g }t          j'                    }|dk    rt          j(        ||d          }|r|                    d          nd}|rt          j)        |          }|                     |||           d{V }|dz  }|dk    rtF          &                    d           |sn|sn|j*        r)|j*        d         j+        r|j*        d         j+        j,        snt          j-        ||           d{V }|sn|j*        d         j+        }t          j.        d|          }t_          j0        |          }|s|1                    |           t	          |td                    r*|                    |           |                    |           |                    |           |                    |           |dk    t          j3        |          r	|||_4        |cddd          d{V  S # 1 d{V swxY w Y   dS )ad  Makes an API request to generate content using a model.

    Some models support multimodal input and output.

    Built-in MCP support is an experimental feature.

    Usage:

    .. code-block:: python

      from google.genai import types
      from google import genai

      client = genai.Client(
          vertexai=True, project='my-project-id', location='us-central1'
      )

      response = await client.aio.models.generate_content(
          model='gemini-2.0-flash',
          contents='User input: I like bagels. Answer:',
          config=types.GenerateContentConfig(
              system_instruction=
                [
                  'You are a helpful language translator.',
                  'Your mission is to translate text in English to French.'
                ]
          ),
      )
      print(response.text)
      # J'aime les bagels.
    r_  Fis_agent_platformNTr  r  r  rl  The 'streamable_http_transport' parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.2Agent Platform MCP servers require a 'name' field.rS  r   r   r  r  r  r  is_caller_method_asyncr
   r  r  r  rU   )5r   r  rf  r^  r  r  r   r  r  
contextlibAsyncExitStackr_  has_agent_platform_mcp_serversr   Toolr  r  r	  r  r  r  r  r   r   enter_async_contextr   _connect_agent_platform_mcpparse_config_for_mcp_sessionsr  rw  r  r,  r  r  r  r  r  r  r  rg  r  r  r  rD   r   !get_function_response_parts_asyncr  rt   rv   r  r  r  r   )ro  rl   rn   r   r  r  stack	new_toolstool	tool_copyserversessionfinal_parsed_configmcp_to_genai_tool_adaptersr  r   r  r  r   r  r  final_parsed_config_to_callr	  r
  r  s                            r!   r  zAsyncModels.generate_content_!  sr     P 	7%d&6
EJJ	
 	
 	
   3mm	FD	!	! 31;;F;;mm''T'22m (** ^ ^ ^ ^ ^ ^ ^e 

#.*9-HH.* '!	 (	*#) &% &%d$
++ %%0@ %% ,,', ^, 1	,
 (, !OOM43HOII	  +++ ,  & F$?FF  #9   ;*"'";"; <*FK # #      '
 ""7++++"J  +2 t$$$$ )-
 : '(8*e L L         65 
	()<	=	= 
++(3F , 
 
 
 
 
 
 
 
y^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^@ 
$ 
 !fe9:: 	/\ 6$'$5$5!%% 	/**Wb))% /$'JJ!)**.CCC		#c+E"F"FGG+
..G    ++(3F , 
 
 
 
 
 
 
 
e^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^l $0#H
$ $  kk
P3M
P
P
P   AC(.00h&**#4&#'
 
 
 #***555 	$
  	(4(E)) )
% //(3N 0 
 
 
 
 
 
 
 
 	#a'"%**
++H    	
 	
#	&q)1	 &q)17	
 @,        	
 # 	
$/2: %%!
 !
 !
 <))1 	>
,
3
3H
=
=
=h%% 	1
//+
,
,
,
///
0
0
0*112CDDD*112GHHHk '**p 
01D
E
E
" / 	3 }^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^s!   F=U7C)U7HU77
VVc                   K   sdn=t          t                    rt          j        di n                    d          t          j        t           j        dd                     fd} |            S )	aM  Makes an API request to generate content using a model and yields the model's response in chunks.

    For the `model` parameter, supported formats for Gemini Enterprise Agent
    Platform API include:
    - The Gemini model ID, for example: 'gemini-2.0-flash'
    - The full resource name starts with 'projects/', for example:
      'projects/my-project-id/locations/us-central1/publishers/google/models/gemini-2.0-flash'
    - The partial resource name with 'publishers/', for example:
      'publishers/google/models/gemini-2.0-flash' or
    - `/` separated publisher and model name, for example:
      'google/gemini-2.0-flash'

    For the `model` parameter, supported formats for Gemini API include:
    - The Gemini model ID, for example: 'gemini-2.0-flash'
    - The model name starts with 'models/', for example:
      'models/gemini-2.0-flash'
    - For tuned models, the model name starts with 'tunedModels/',
      for example:
      'tunedModels/1234567890123456789'

    Some models support multimodal input and output.

    Built-in MCP support is an experimental feature.

    Usage:

    .. code-block:: python

      from google.genai import types
      from google import genai

      client = genai.Client(
          vertexai=True, project='my-project-id', location='us-central1'
      )

      async for chunk in await client.aio.models.generate_content_stream(
        model='gemini-2.0-flash',
        contents='''What is a good name for a flower shop that specializes in
          selling bouquets of dried flowers?'''
      ):
        print(chunk.text)
      # **Elegant & Classic:**
      # * The Dried Bloom
      # * Everlasting Florals
      # * Timeless Petals

      async for chunk in await client.aio.models.generate_content_stream(
        model='gemini-2.0-flash',
        contents=[
          types.Part.from_text('What is shown in this image?'),
          types.Part.from_uri('gs://generativeai-downloads/images/scones.jpg',
          'image/jpeg')
        ]
      ):
        print(chunk.text)
      # The image shows a flat lay arrangement of freshly baked blueberry
      # scones.
    NTr  r_  Frp  c            	       K   t          j                    4 d {V } }t          j        dd          rKt	          j        |          r6|3g }|j        r)|j        D ]}t          |t          j	                  r|j
        r|j        s|j        s|j        s|j        s|j        r-|                    dd i          }|                    |           |j
        D ]}t          |dd           	 t%          d          |j        N|                     t+          j        j        |j                             d {V }|                    |           xt%          d          |                    |           ||_        t	          j        |t          j        dd                     d {V \  }}t	          j        |          rB                    |	           d {V }	|	2 3 d {V }
|
W V  6 	 d d d           d {V  d S rd
}t          t          j                  rj        rt7          j                  }n<t          t8                    r'                    dg           }|rt7          |          }t7                    |k    rCd                    t?          t@                              }tB          "                    d|                               |	           d {V }	|	2 3 d {V }
|
W V  6 	 d d d           d {V  d S t	          j#        |           t	          j$        |          }tB          %                    d| d           g }d }d }
d
}}|d
k    rt	          j&        ||d          }|r|                    d          nd }|rt	          j'        |          }|dz  }                    ||	           d {V }	|dk    rtB          %                    d| d           |dz  }|dk    r |d
k    rtB          %                    d           |dk    r|	2 3 d {V }
|st	          j(        ||
          }|
W V  $|
j)        r)|
j)        d
         j*        r|
j)        d
         j*        j+        s n9t	          j,        |
|           d {V }|st	          j(        ||
          }|
W V  6 n|	2 3 d {V }
t	          j-        |          r||
_.        t	          j(        ||
          }|
W V  =6 |
0|
j)        r)|
j)        d
         j*        r|
j)        d
         j*        j+        snt	          j,        |
|           d {V }|r|sn|
|
j)        d
         j*        }t          j/        d|          }ta          j1        |          }|s|2                    |           t          |tf                    r,|*|                    |           |                    |           ||                    |           |                    |           |d
k    	 d d d           d {V  d S # 1 d {V swxY w Y   d S )Nr_  Fr  rr  rl  rs  rt  rp  rS  r   r   r  r  r  r  Tru  r  r
   r  r  r  r  r  )4rw  rx  rf  r^  r   ry  r   r  r   rz  r  r  r	  r  r  r  r  r  r   r   r{  r   r|  r}  r  r}  r  r  r  r,  r  r  r  r  r  r  r  r  r  r  r  r  rD   r   r~  r  r   r  rt   rv   r  r  )r  current_configr  r  r  r  r  r  r  r  r  r  r   r  r  r   r	  r  loop_contentsr  r  r
  r  r   rn   r  rl   r  ro  s                          r!   stream_generatorz=AsyncModels.generate_content_stream.<locals>.stream_generator"  s
     *,, OK OK OK OK OK OK OK& D$j%88+	-;NKK+	- *!#)! %-&, #' #'D%*-- "'$2B "'..). ~. 3	.
 *. #oomT5JoKK)""9---".  Ff&A4HH!" %;   [,$)$=$="> ,fk % %      G
 $$W----$L  '.   &&&&#,N  <")$*:J"N"N         	87 *+>?? 	88H5H 9        ( &       EKKKKK &
{OK OK OK OK OK OK OK OK OK OK OK OK OK OK~ & 	"#
 ;<< 1| 8&)&,&7&7#&$'' 1JJw++E 1&)%jj#+,,0EEE))C-G$H$HIIKNN
     88H5H 9        ( &       EKKKKK &
oOK OK OK OK OK OK OK OK OK OK OK OK OK OKr 	<	
 	
 	
 &2%J&
 &
" 	.*. . .	
 	
 	
 CE*" (1,,%6!(%)  , %!,,$,777 &
  *6*G++ +' q&!88$0 9        ( UUKK71777888
$
)
$UU1Q66KKJ   !VV'       e!  , B!5! !  ( +A.6 !+A.6<
 %&H|        $
 + "."D#U# #- ++++-  (0  (       e78KLL 6 8 +@ m kkkkk  ( ' '*2  '*28 
 "D<           %8 ] $.q19
"'-'# # #
 ,}55-3 E.55mDDDt,, 81B1N  !2333  !6777*.556GHHH
,
3
34I
J
J
JK )1,,,UOK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OK OKsR   GX4)G6/	X4C-X48L>	X4DX42S 8BX4T
EX44
X>X>rU   )	r  r  r   r  r  r   r  rf  r^  )ro  rl   rn   r   r  r  r  s   ```` @@r!   r  z#AsyncModels.generate_content_stream5"  s      B  3mm	FD	!	! 31;;F;;mm''T'22m 	7%d&6
EJJ	
 	
 	
 QK QK QK QK QK QK QK QK QK QKf r#   c                D   K   |                      ||||           d{V S )a_  Edits an image based on a text description and configuration.

    Args:
      model (str): The model to use.
      prompt (str): A text description of the edit to apply to the image.
        reference_images (list[Union[RawReferenceImage, MaskReferenceImage,
        ControlReferenceImage, StyleReferenceImage, SubjectReferenceImage]): The
        reference images for editing.
      config (EditImageConfig): Configuration for editing.

    Usage:

    .. code-block:: python

      from google.genai.types import RawReferenceImage, MaskReferenceImage

      raw_ref_image = RawReferenceImage(
        reference_id=1,
        reference_image=types.Image.from_file(location=IMAGE_FILE_PATH),
      )

      mask_ref_image = MaskReferenceImage(
        reference_id=2,
        config=types.MaskReferenceConfig(
            mask_mode='MASK_MODE_FOREGROUND',
            mask_dilation=0.06,
        ),
      )
      response = await client.aio.models.edit_image(
        model='imagen-3.0-capability-001',
        prompt='man with dog',
        reference_images=[raw_ref_image, mask_ref_image],
        config=types.EditImageConfig(
            edit_mode= "EDIT_MODE_INPAINT_INSERTION",
            number_of_images= 1,
            include_rai_reason= True,
        )
      )
      response.generated_images[0].image.show()
      # Shows a man with a dog instead of a cat.
    r  Nr  r  s        r!   r  zAsyncModels.edit_imageY#  sP      b !!)	 "         r#   c                Z  K   t          j        |          j        pt          j                    }|j        d|_        | j        j        r2|                    d          }|j        s|j        }|r|dz   nd|_        t          d| j
        | 
                    |           d{V |          S )a  Makes an API request to list the available models.

    If `query_base` is set to True in the config or not set (default), the
    API will return all available base models. If set to False, it will return
    all tuned models.

    Args:
      config (ListModelsConfigOrDict): Configuration for retrieving models.

    Usage:

    .. code-block:: python

      response = await client.aio.models.list(config={'page_size': 5})
      print(response.page)
      # [Model(name='projects/./locations/./models/123', display_name='my_model'

      response = await client.aio.models.list(
          config={'page_size': 5, 'query_base': True}
        )
      print(response.page)
      # [Model(name='publishers/google/models/gemini-2.0-flash-exp' ...
    rP  NTr  r8  r9  rX  )r   r  r   r:  rH  r^  r_  r  rG  r   r  r;  s      r!   r  zAsyncModels.list#  s      < 	#62229 	$!##   f  	
  d ++f 
} &L777% 	
 
jjj''''''''	  r#   c                  K   |                      |||           d{V }d}g }|r|j        s|S |j        D ]6}|j        r|j        j        dk    r|j        }!|                    |           7t          j        ||          }|S )az  Generates images based on a text description and configuration.

    Args:
      model (str): The model to use.
      prompt (str): A text description of the images to generate.
      config (GenerateImagesConfig): Configuration for generation.

    Usage:

    .. code-block:: python

      response = await client.aio.models.generate_images(
        model='imagen-3.0-generate-002',
        prompt='Man with a dog',
        config=types.GenerateImagesConfig(
            number_of_images= 1,
            include_rai_reason= True,
        )
      )
      response.generated_images[0].image.show()
      # Shows a man with a dog.
    r  Nr  r  r  r  s	            r!   r  zAsyncModels.generate_images#  s      : .. /        L
 )-% |< '8 1 1

+1/<  -<,M))0000+)*K  H Or#   c                  K   t          j        ||||           |pi }t          |t           j                  r|                                }nt          |          }t          j        |                    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{V S )a  Makes an API request to upscale a provided image.

    Args:
      model (str): The model to use.
      image (Image): The input image for upscaling.
      upscale_factor (str): The factor to upscale the image (x2 or x4).
      config (UpscaleImageConfig): Configuration for upscaling.

    Usage:

    .. code-block:: python

      from google.genai.types import Image

      IMAGE_FILE_PATH="my-image.png"
      response = await client.aio.models.upscale_image(
          model='imagen-3.0-generate-001',
          image=types.Image.from_file(location=IMAGE_FILE_PATH),
          upscale_factor='x2',
      )
      response.generated_images[0].image.show()
      # Opens my-image.png which is upscaled by a factor of 2.
    r  rb  Nr   r   r   r   r   r   r0  r3  r   r  r   rD  r
   r   r!  r&  s          r!   r)  zAsyncModels.upscale_image#  s     B 
 %	    \rF&%233  $$&&jj<<j1^^ND99!~~&6==&NN+@$GG$..)<dCC%>>*>EE#(:DAA#->>($$
 $
 'NN+@$GG",..'#
 #
 ~~h--  J$ #Jv%&J!"$$%	 %         r#   c          
        K   |s|s|r|rt          d          i }| j        j        s|rt          |t          j                  r|                                }nt          |          }|                    d          rQ|                    d          r<t	          j        |                    d          |                    d                    }no| j        j        sb|r_t          |t          j	                  r+|                                }|                    di           }nwt          |          }t          |                    d          t          j                  r;|                    dt	          j                              }	|	                                }|r|                    d          r|                    d          rwt	          j	        |                    d          |                    d          t	          j        |                    d          |                    d                    	          }| 
                    ||||||
           d{V S )r+  r,  rB  rD  r@   r-  r  r   r  r.  r  Nr/  r2  s
             r!   r6  zAsyncModels.generate_videosF$  sq     b 	 % 5 f '  
 !#I$ 
 
	E5;	'	'  $$&&		KK		u		 
)--">"> 
e$$	k0J0J
 
 
 & 
6 
	FE6	7	7 -&&((
NN7B//		&\\
jnnW--u{;; 	-#->>'5;==#I#I)**,,)	 
y}}U++ 
	m0L0L 
+>>(++..))+MM%((#--44  
 
 
 && '         r#   c                  K   | j         j        s6d|v rt          j        |          }|                     |||           d{V S t          j        |          rkt          j        |          }t          |          dk    rt          d          |                     |||d         t          j	        j
        |           d{V S |                     ||t          j	        j        |           d{V S )	a  Calculates embeddings for the given contents.

    Args:
      model (str): The model to use.
      contents (list[Content]): The contents to embed.
      config (EmbedContentConfig): Optional configuration for embeddings.

    Usage:

    .. code-block:: python

      embeddings = await client.aio.models.embed_content(
          model= 'text-embedding-004',
          contents=[
              'What is your name?',
              'What is your favorite color?',
          ],
          config={
              'output_dimensionality': 64
          },
      )

      multimodal_embeddings = await client.aio.models.embed_content(
          model='gemini-embedding-2-preview',
          contents=[
              types.Part.from_uri(
                  file_uri='gs://generativeai-downloads/images/scones.jpg',
                  mime_type='image/jpeg',
              ),
          ],
          config={
              'output_dimensionality': 64
          },
      )
    r  rS  Nr
   r  r   r  )rl   rn   r  r   r  r  s        r!   r  zAsyncModels.embed_content$  si     T $ 		&	&<))&& '          	(// L22	 	!	!A	%	%
 
 	
 &&%a("3A '          &&"3;	 '         r#   )Hr=  r>  r?  r  r   r   r@  rA  r   rB  rg  rw  r   r   r}  rC  rD  r  rE  r  r  rF  r  r  r  rG  rH  r  r  rI  rJ  r  r  rK  rL  r  r  rM  rN  r  r  rO  r  r,  rP  r  r  rQ  r  rR  r  r  rS  r  r  rT  r  r  rU  rV  rW  r  r  r  r  r  r   r  rX  r)  r6  r  rU   r#   r!   rZ  rZ    s
        =A^ ^ ^ ^ e,e.HHI	^
 u89^ $^ ^ ^ ^J =Ah h h h e,e.HHI	h
 u89h u<=>h h h h`  =A9=w w w w 
&(BB
C	w 
"E$::
;w #5#9:w u56w !w w w w| <@Y Y Y Y 	Y
 u78Y #Y Y Y YB 7;R R R R 	R
 U;<R u23R R R R Rt >BR R R R 	R
 R u9:R !R R R Rr <@l l l l .	l
 u78l #l l l lf :>h h h h ,	h
 u56h !h h h hV KOL L LL#+E,F#GL{L L L L^ AEV V V <=VV V V Vx 9=	O O O O u45	O
 {O O O Oj 9=	U U U U u45	U
  U U U Ux 9=l l l l e,e.HHI	l
 u45l  l l l lf ;?d d d d e,e.HHI	d
 u67d "d d d dT #+/+/;?;?] ] ] ] sm	]
 e'(] e'(] u78] u78] $] ] ] ]H =AT T T T e,e.HHI	T
 u89T $T T T Tv =Ab b b b e,e.HHI	b
 u89b U23b b b bT	 7;6 6 6 6 	6
 U;<6 u236 6 6 6 6v 8<2 2 2 u342 %+	2 2 2 2r <@5 5 5 5 	5
 u785 #5 5 5 5z :>H H H H 	H
 H u56H !H H H H\ #+/+/;?;?[ [ [ [ sm	[
 e'([ e'([ u78[ u78[ $[ [ [ [D :>D D D D e,e.HHI	D
 u56D !D D D D D Dr#   rZ  )NN)rw  rj  loggingtypingr   r   r   r   r   r   urllib.parser	    r   r   r9  r   r   r   r   rt   r   r   r^  r   r   r7   r   r8   pagersr   r   	getLoggerr  r"   r&   r)   r  r  objectr;   rB   r]   r\   ri   rx   r   r   r   r   r   rq   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r   r%  r/  r4  r7  r;  r@  rF  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r   r  r  r%  r-  r  r  r  r  r  r  rL  rO  rR  rT  r]  rb  rj  rm  rZ  ra  r  r   r   r  r  r  r  r  r   r  r  r  re  r  r  r  r  r  r  r  r  r  rh  r   r  r'  r*  r,  r.  r5  r9  r<  r  r  r  r  r  r  r  r  
BaseModulerO  rZ  rU   r#   r!   <module>r     sC  $       K K K K K K K K K K K K K K K K " " " " " "       * * * * * *                                           & & & & & & . . . . . . . . . . . . % % % % % % % %		0	1	1     # $    	    /3;?- -tCH~v-.-DcN+- %S#X 678- 
#s(^	- - - -d /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;?6 6tCH~v-.6DcN+6 %S#X 6786 
#s(^	6 6 6 6v /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   $ /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   : /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   D /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   " /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   * /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   < /3;?% %tCH~v-.%DcN+% %S#X 678% 
#s(^	% % % %V /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   F /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   D /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   4 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   ( /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   ( /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   & /3;? tCH~v-.DcN+ %S#X 678 
#s(^	     /3;? tCH~v-.DcN+ %S#X 678 
#s(^	     /3;?v vtCH~v-.vDcN+v %S#X 678v 
#s(^	v v v vx /3;?	    tCH~v-.  DcN+  %S#X 678	 
 
#s(^       J /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   4 /3;?/ /tCH~v-./DcN+/ %S#X 678/ 
#s(^	/ / / /h /3;?n ntCH~v-.nDcN+n %S#X 678n 
#s(^	n n n nh /3;?	) ))tCH~v-.) DcN+) %S#X 678	)
 
#s(^) ) ) )^ /3;?	2 22tCH~v-.2 DcN+2 %S#X 678	2
 
#s(^2 2 2 2n /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   4 /3;?% %tCH~v-.%DcN+% %S#X 678% 
#s(^	% % % %T /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   & /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   @ /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   8 /3;?	B BBtCH~v-.B DcN+B %S#X 678	B
 
#s(^B B B BP /3;?	{ {{tCH~v-.{ DcN+{ %S#X 678	{
 
#s(^{ { { {B /3;?	! !!tCH~v-.! DcN+! %S#X 678	!
 
#s(^! ! ! !N /3;?	! !!tCH~v-.! DcN+! %S#X 678	!
 
#s(^! ! ! !L /3;?$ $tCH~v-.$DcN+$ %S#X 678$ 
#s(^	$ $ $ $R /3;?! !tCH~v-.!DcN+! %S#X 678! 
#s(^	! ! ! !L /3;?~ ~tCH~v-.~DcN+~ %S#X 678~ 
#s(^	~ ~ ~ ~F /3;?v vtCH~v-.vDcN+v %S#X 678v 
#s(^	v v v vx /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   8 /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   6 /3;?   tCH~v-. DcN+  %S#X 678  
#s(^	       J /3;?   tCH~v-. DcN+  %S#X 678  
#s(^	       J /3;?H HtCH~v-.HDcN+H %S#X 678H 
#s(^	H H H HZ /3;?H HtCH~v-.HDcN+H %S#X 678H 
#s(^	H H H HZ /3;?( (tCH~v-.(DcN+( %S#X 678( 
#s(^	( ( ( (Z /3;?$ $tCH~v-.$DcN+$ %S#X 678$ 
#s(^	$ $ $ $T /3;?	) ))tCH~v-.) DcN+) %S#X 678	)
 
#s(^) ) ) )^ /3;?	) ))tCH~v-.) DcN+) %S#X 678	)
 
#s(^) ) ) )\ /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   F /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   F /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   < /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   < /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   2 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   D /3;?" "tCH~v-."DcN+" %S#X 678" 
#s(^	" " " "N /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   $ /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   ( /3;?v vtCH~v-.vDcN+v %S#X 678v 
#s(^	v v v vx /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   ( /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   & /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   > /3;?* *tCH~v-.*DcN+* %S#X 678* 
#s(^	* * * *^ /3;?- -tCH~v-.-DcN+- %S#X 678- 
#s(^	- - - -d /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   , /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   6 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   2 /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   H /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   H /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   $ /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   " /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   : /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   : /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   , /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;?7 7tCH~v-.7DcN+7 %S#X 6787 
#s(^	7 7 7 7x /3;?6 6tCH~v-.6DcN+6 %S#X 6786 
#s(^	6 6 6 6v /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   * /3;?P PtCH~v-.PDcN+P %S#X 678P 
#s(^	P P P Pj /3;?O OtCH~v-.ODcN+O %S#X 678O 
#s(^	O O O Oh /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   ( /3;?L LtCH~v-.LDcN+L %S#X 678L 
#s(^	L L L Ld /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   : /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   * /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   F /3;?5 5tCH~v-.5DcN+5 %S#X 6785 
#s(^	5 5 5 5t /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   B /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   4 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   4 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   $ /3;?) )tCH~v-.)DcN+) %S#X 678) 
#s(^	) ) ) )^ /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   : /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   * /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   @ /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   . /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   D /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   D /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   < /3;?K KtCH~v-.KDcN+K %S#X 678K 
#s(^	K K K K` /3;?J JtCH~v-.JDcN+J %S#X 678J 
#s(^	J J J J^ /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   6 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   2 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   4 /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   2 /3;?	 tCH~v-. DcN+ %S#X 678	
 
#s(^   0 /3;?L LtCH~v-.LDcN+L %S#X 678L 
#s(^	L L L Ld /3;?	! !!tCH~v-.! DcN+! %S#X 678	!
 
#s(^! ! ! !L /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   4 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   * /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   * /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   0 /3;? tCH~v-.DcN+ %S#X 678 
#s(^	   6T" T" T" T" T"[# T" T" T"nDi$ i$ i$ i$ i$+( i$ i$ i$ i$ i$r#   