
    Gjn                       d dl Z d dlZd dlmZmZmZ d dlmZ ddlm	Z	 ddlm
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddl
mZ ddl
mZ ddl
mZ ddlmZmZ  ej4                  d      Z	 dLdeeeef   ef   deeeef      deeef   fdZ	 dLdeeeef   ef   deeeef      deeef   fdZ 	 dLdeeeef   ef   deeeef      deeef   fdZ!	 dLdeeeef   ef   deeeef      deeef   fdZ"	 dLdeeeef   ef   deeeef      deeef   fdZ#	 dLdedeeeef   ef   deeeef      deeef   fdZ$	 dLdeeeef   ef   deeeef      deeef   fdZ%	 dLdeeeef   ef   deeeef      deeef   fdZ&	 dLdeeeef   ef   deeeef      deeef   fdZ'	 dLdeeeef   ef   deeeef      deeef   fdZ(	 dLdedeeeef   ef   deeeef      deeef   fdZ)	 dLdedeeeef   ef   deeeef      deeef   fdZ*	 dLdeeeef   ef   deeeef      deeef   fd Z+	 dLdeeeef   ef   deeeef      deeef   fd!Z,	 dLdeeeef   ef   deeeef      deeef   fd"Z-	 dLdeeeef   ef   deeeef      deeef   fd#Z.	 dLdeeeef   ef   deeeef      deeef   fd$Z/	 dLdedeeeef   ef   deeeef      deeef   fd%Z0	 dLdedeeeef   ef   deeeef      deeef   fd&Z1	 dLdeeeef   ef   deeeef      deeef   fd'Z2	 dLdedeeeef   ef   deeeef      deeef   fd(Z3	 dLdedeeeef   ef   deeeef      deeef   fd)Z4	 dLdedeeeef   ef   deeeef      deeef   fd*Z5	 dLdeeeef   ef   deeeef      deeef   fd+Z6	 dLdeeeef   ef   deeeef      deeef   fd,Z7	 dLdedeeeef   ef   deeeef      deeef   fd-Z8	 dLdeeeef   ef   deeeef      deeef   fd.Z9	 dLdedeeeef   ef   deeeef      deeef   fd/Z:	 dLdeeeef   ef   deeeef      deeef   fd0Z;	 dLdeeeef   ef   deeeef      deeef   fd1Z<	 dLdeeeef   ef   deeeef      deeef   fd2Z=	 dLdedeeeef   ef   deeeef      deeef   fd3Z>	 dLdeeeef   ef   deeeef      deeef   fd4Z?	 dLdedeeeef   ef   deeeef      deeef   fd5Z@	 dLdedeeeef   ef   deeeef      deeef   fd6ZA	 dLdeeeef   ef   deeeef      deeef   fd7ZB	 dLdeeeef   ef   deeeef      deeef   fd8ZC	 dLdeeeef   ef   deeeef      deeef   fd9ZD	 dLdedeeeef   ef   deeeef      deeef   fd:ZE	 dLdeeeef   ef   deeeef      deeef   fd;ZF	 dLdeeeef   ef   deeeef      deeef   fd<ZG	 dLdeeeef   ef   deeeef      deeef   fd=ZH	 dLdeeeef   ef   deeeef      deeef   fd>ZI	 dLdeeeef   ef   deeeef      deeef   fd?ZJ	 dLdeeeef   ef   deeeef      deeef   fd@ZK	 dLdeeeef   ef   deeeef      deeef   fdAZL	 dLdeeeef   ef   deeeef      deeef   fdBZM	 dLdeeeef   ef   deeeef      deeef   fdCZN	 dLdeeeef   ef   deeeef      deeef   fdDZO	 dLdeeeef   ef   deeeef      deeef   fdEZP	 dLdeeeef   ef   deeeef      deeef   fdFZQ	 dLdeeeef   ef   deeeef      deeef   fdGZR G dH dIe	j                        ZT G dJ dKe	j                        ZUy)M    N)AnyOptionalUnion)	urlencode   )_api_module)_common)_extra_utils)_transformers)types)BaseApiClient)get_value_by_path)move_value_by_path)set_value_by_path)
AsyncPagerPagerzgoogle_genai.batchesfrom_objectparent_objectreturnc                 v   i }t        | dg      t        |dgt        | dg             t        | dg      t        d      t        | dg      t        d      t        | dg      t        d      t        | d	g      t        d
      t        | dg      t        d      t        | dg      t        d      |S )Napi_keyapiKeyapi_key_configzvapi_key_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.	auth_typezqauth_type parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.google_service_account_configzgoogle_service_account_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.http_basic_auth_configz~http_basic_auth_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.oauth_configztoauth_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.oidc_configzsoidc_config parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.getvsetv
ValueErrorr   r   	to_objects      Z/var/www/python/quitsure-support/venv/lib/python3.12/site-packages/google/genai/batches.py_AuthConfig_to_mldevr&   %   s    !)	+	{#/XJ[9+ >?	+()*6
	< 
 
+}%1
	< 
 
+789E
	M 
 
+012>
	M 
 
+'(4
	< 
 
+'3
	< 
 
    c                 X   i }t        | dg      t        |dgt        | dg             t        | ddg      2t        |dgt        | ddg      D cg c]  }t        ||       c}       t        | ddg      	 (t        |dgt        | ddg      D cg c]  }| c}       |S c c}w c c}w )NresponsesFile	file_nameinlinedResponsesinlined_responsesinlinedEmbedContentResponsesinlined_embed_content_responses)r    r!   _InlinedResponse_from_mldevr   r   r$   items       r%   _BatchJobDestination_from_mldevr2   T   s     !)	+()5[M4o5F#GH	+*,>?@L	 02DE	
 (i8	
	 ;79KLM 		*+ /1CD	
 	

 
1	
	
s   B"	B'c           
      V   i }t        | dg      t        |dgt        | dg             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        t        | d	g      |             |S )NpredictionsFormatformatgcsDestinationoutputUriPrefixgcs_uribigqueryDestination	outputUribigquery_uri"vertexMultimodalDatasetDestinationvertex_dataset)r    r!   /_VertexMultimodalDatasetDestination_from_vertexr#   s      r%    _BatchJobDestination_from_vertexr?   |   s     !)	++,-9XJ[3F2G HI	+(*;<=I	[+->?@ 
+-{;<H	[0+>? 
+<=>J	7CDEy	
 
r'   c           
         i }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
      t        | dg      t        d      t        | dg      t        d      t        | dg      #t        |dgt        t        | dg      |             |S )Nr5   r4   r8   r6   r7   r;   r9   r:   r*   qfile_name parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r,   zyinlined_responses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r.   zinlined_embed_content_responses parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r=   r<   )r    r!   r"   -_VertexMultimodalDatasetDestination_to_vertexr#   s      r%   _BatchJobDestination_to_vertexrC      sD    !)	+z".()4hZ+HI	+	{#/	,-[9+& 
+'(4	,[>*+ 
+}%1
	9 
 
++,-9
	? 
 
+9:;G
	M 
 
+()*6	-.5/019	
 
r'   c           	      H   i }t        | dg      t        |dgt        | dg             t        | ddg      t        |dgt        | ddg             t        | ddg      t        |dgt        | ddg             t        | d	d
g      	 t        |dgt        | d	d
g             |S )NinstancesFormatr5   	gcsSourceurisr8   bigquerySourceinputUrir;   vertexMultimodalDatasetSourcedatasetNamevertex_dataset_namer    r!   r#   s      r%   _BatchJobSource_from_vertexrN      s     !)	+)*+7XJ[3D2E FG	+V,-9YKkK3H!IJ	+(*56B	[+Z89 ;8-HI 		[:MJK 
r'   
api_clientc                    i }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      3t        |d
d
gt        |d	g      D cg c]  }t        | ||       c}       t        |dg      t        d      |S c c}w )Nr5   znformat parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r8   zogcs_uri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r;   ztbigquery_uri parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r*   fileNameinlined_requestsrequestsrL   z{vertex_dataset_name parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.)r    r"   r!   _InlinedRequest_to_mldevrO   r   r   r$   r1   s        r%   _BatchJobSource_to_mldevrV      s   
 !)	+z".
	3 
 
+	{#/
	< 
 
+'(4
	< 
 
+}%1ZL${[M"BC	+*+,8	Z  [+=*>?	
 %ZyA	
 
+-./;
	B 
 
	
s   Cc                    i }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
      t        | dg      t        d      t        | dg      t        |ddgt        | dg             |S )Nr5   rE   r8   rF   rG   r;   rH   rI   r*   rA   rR   zxinlined_requests parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.rL   rJ   rK   r   r#   s      r%   _BatchJobSource_to_vertexrX     s    !)	+z".&'kH:)FG	+	{#/[&)4i[+IJ	+'(4	:&[>*+ 
+}%1
	9 
 
+*+,8
	? 
 
+-./;	(-8[012 
r'   c                    i }t        | dg      t        |dgt        | dg             t        | ddg      t        |dgt        | ddg             t        | ddg      -t        |dgt        j                  t        | ddg                   t        | ddg      t        |dgt        | ddg             t        | ddg      t        |d	gt        | ddg             t        | dd
g      t        |dgt        | dd
g             t        | ddg      t        |dgt        | ddg             t        | ddg      7t        |dgt	        t        j
                  t        | ddg            |             |S )NnamemetadatadisplayNamedisplay_namestate
createTimecreate_timeendTimeend_time
updateTimeupdate_timemodeloutputdest)r    r!   tt_job_stater2   t_recv_batch_job_destinationr#   s      r%   _BatchJob_from_mldevrk   G  s    !)	+x ,VHd;9:	+
M23?	[:}56 
+
G,-9			d;W(=>? 
+
L12>	[:|45 
+
I./;ZL${Z4K"LM	+
L12>	[:|45 
+
G,-9WItK*g1FGH	+
H-.:	'**[:x"89 		
	 
r'   c                 Z   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        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	        t        | dg      |             t        | dg      6t        |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             |S )NrZ   r\   r]   r^   errorr_   r`   	startTime
start_timera   rb   rc   rd   re   inputConfigsrcoutputConfigrg   completionStatscompletion_stats
outputInfooutput_info)r    r!   rh   ri   rN   r?   rj   r#   s      r%   _BatchJob_from_vertexrw     sB    !)	+x ,VHd;9:	+'3^$d;&HI	+y!-WIq}}T+y-IJK	+y!-WItK';<	+~&2]OT+~%FG	+}%1\ND{m$DE	+	{#/ZL${YK"@A	+~&2]OT+~%FG	+y!-WItK';<	+'3	#}o.		
 
+'(4	(**4n=M+NO	
 
+)*+7&'k<M;N)O 
+~&2]OT+~%FG	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datar]   tdisplay_name parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.	mime_typemimeTyper   r#   s      r%   _Blob_to_mldevr}     s     !)	+x ,VHd;9:	+'(4
	< 
 
+}%1ZL${[M"BC	r'   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S NrZ   _urlr    r!   rh   t_batch_job_namerO   r   r   r$   s       r%   "_CancelBatchJobParameters_to_mldevr     L    
 !)	+x ,		:tK&'BC 
r'   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S r   r   r   s       r%   #_CancelBatchJobParameters_to_vertexr     r   r'   c           
      <   i }t        | dg      t        |dgt        | dg             t        | dg      #t        |dgt        t        | dg      |             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |d	gt        | dg             t        | d
g      t        |dgt        | d
g             t        | dg      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 cg c]  }| c}       t        | dg      t        |dgt        | dg             |S c c}w )NcontentcitationMetadatacitation_metadata
tokenCounttoken_countfinishReasonfinish_reasongroundingMetadatagrounding_metadataavgLogprobsavg_logprobsindexlogprobsResultlogprobs_resultsafetyRatingssafety_ratingsurlContextMetadataurl_context_metadata)r    r!   _CitationMetadata_from_mldevr0   s       r%   _Candidate_from_mldevr     s    !)	+	{#/YKkI;!?@	+*+,8	$123Y	
 
+~&2]OT+~%FG	+'(4_%tK.9I'JK	++,-9	[./0 
+'3^$d;&HI	+y!-WItK';<	+()*6&'k<L;M)NO	+()5	{_,=>?$? 
+,-.:	 [/01 
 	@s   !	Fc                 |    i }t        | dg      't        |dgt        | dg      D cg c]  }| c}       |S c c}w )NcitationSources	citationsrM   r0   s       r%   r   r   *  sQ     !)	+)*+7	{->,?@A$A 
 	Bs   	9c                     i }t        | dg      1t        |dgt        | dg      D cg c]  }t        ||       c}       t        | dg      t        |dgt        | dg             |S c c}w )Npartsrole)r    r!   _Part_to_mldevr0   s       r%   _Content_to_mldevr   9  s     !)	+y!-		 [7)4	
 4+	
 
+x ,VHd;9:		
s   A)c                     i }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             |S )Nr]   batchr\   rg   zldest parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.webhook_configwebhookConfigr   r#   s      r%   _CreateBatchJobConfig_to_mldevr   N  s     !)	+'(4	- [>*+ 
+x ,
	3 
 
+()*6	/"[+,- 
r'   c                    i }t        | dg      t        |dgt        | dg             t        | dg      6t        |dgt        t        j                  t        | dg            |             t        | dg      t        d      |S )Nr]   r\   rg   rr   r   zvwebhook_config parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.)r    r!   rC   rh   t_batch_job_destinationr"   r#   s      r%   _CreateBatchJobConfig_to_vertexr   k  s     !)	+'(4kN;K)LM	+x ,	&%%d;&ABI	
 
+()*6
	? 
 
r'   c                 T   i }t        |dg      .t        |ddgt        j                  | t        |dg                   t        |dg      9t        |ddgt	        | t        j
                  | t        |dg            |             t        |dg      t        t        |dg      |       |S Nre   r   rq   r   rp   config)r    r!   rh   t_modelrV   t_batch_job_sourcer   r   s       r%   "_CreateBatchJobParameters_to_mldevr     s    
 !)	+y!-				*d;	:; 
+w+	-    T+w-GH	
 
+z"."4hZ#@)L	r'   c                 N   i }t        |dg      -t        |dgt        j                  | t        |dg                   t        |dg      7t        |dgt	        t        j
                  | t        |dg            |             t        |dg      t        t        |dg      |       |S )Nre   rq   rp   r   )r    r!   rh   r   rX   r   r   r   s       r%   #_CreateBatchJobParameters_to_vertexr     s    
 !)	+y!-					*d;	:; 
+w+	!  T+w-GH	
 
+z".#Dxj$A9M	r'   c                 X    i }t        | dg      t        |ddgt        | dg             |S )Nr]   r   r\   rM   r#   s      r%   (_CreateEmbeddingsBatchJobConfig_to_mldevr     sA     !)	+'(4	- [>*+ 
r'   c                 ,   i }t        |dg      .t        |ddgt        j                  | t        |dg                   t        |dg      %t        |ddgt	        | t        |dg      |             t        |dg      t        t        |dg      |       |S r   )r    r!   rh   r   "_EmbeddingsBatchJobSource_to_mldevr   r   s       r%   ,_CreateEmbeddingsBatchJobParameters_to_mldevr     s    
 !)	+y!-				*d;	:; 
+w+	- *[5'2I	
 
+z".,[8*%y 
r'   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S r   r   r   s       r%   "_DeleteBatchJobParameters_to_mldevr     r   r'   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S r   r   r   s       r%   #_DeleteBatchJobParameters_to_vertexr     r   r'   c                 :   i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S NsdkHttpResponsesdk_http_responserZ   donerm   rM   r#   s      r%   _DeleteResourceJob_from_mldevr          !)	+)*+7'(${=N<O*P 
+x ,VHd;9:	+x ,VHd;9:	+y!-WItK';<	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             |S r   rM   r#   s      r%   _DeleteResourceJob_from_vertexr   %  r   r'   c                 "   i }t        |dg      <t        |g dt        j                  | t        |dg            D cg c]  }| c}       t        |dg      1t        |dgt	        t        |dg      |             t        |ddi       |S c c}w )Ncontents)
requests[]requestr   r   _selfzrequests[].*zrequests[].request.*)r    r!   rh   t_contents_for_embed_EmbedContentConfig_to_mldevmovevrU   s        r%   _EmbedContentBatch_to_mldevr   ;  s    
 !)	+
|$0, ..Dzl;	
 	
	 
+z".		$T+z%BIN
 
)n&<=>		
s   	B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_typer   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.r   r#   s      r%   r   r   W  s.    !)	+}%1	z"[;-( 
+y!-w/kG91MN	+/01=	-.[234 
+}%1
	< 
 
+()5
	< 
 
+'(4
	< 
 
+012>
	M 
 
r'   c                     i }t        |dg      t        |dgt        |dg             t        |dg      $t        |dgt        | t        |dg      |             |S )Nr*   rR   rS   )r    r!   r   r   s       r%   r   r     sr    
 !)	+}%1[M4k]#CD	+*+,8	#[+=*>?	
 
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]   rz   file_urifileUrir{   r|   )r    r"   r!   r#   s      r%   _FileData_to_mldevr     s     !)	+'(4
	< 
 
+
|$0YKkJ<!@A	+}%1ZL${[M"BC	r'   c                 N   i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        d      t        | dg      t        d      |S )NidargsrZ   partial_argsztpartial_args parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.will_continuezuwill_continue parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r#   s      r%   _FunctionCall_to_mldevr     s     !)	+v*TFDtf56	+x ,VHd;9:	+x ,VHd;9:	+'(4
	< 
 
+()5
	< 
 
r'   c                     i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        d      |S )Nallowed_function_namesallowedFunctionNamesmodestream_function_call_argumentszstream_function_call_arguments parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r#   s      r%   _FunctionCallingConfig_to_mldevr     s     !)	+012>	 [345 
+x ,VHd;9:	+89:F
	M 
 
r'   c                 N
   i }t        |dg      6t        |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      -t        |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      1t        |d!gt        |d g      D cg c]  }t        ||       c}       t        |d"g      Yt        |d"gt        j                  | t        |d"g            D cg c]"  }t        t        j                  | |      |      $ c}       t        |d#g      #t        |d$gt        t        |d#g      |             t        |d%g      t        d&      t        |d'g      -t        |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        j                  t        |d-g                   t        |d/g      t        d0      t        |d1g      t        |d2gt        |d1g             t        |d3g      #t        |d4gt        t        |d3g      |             t        |d5g      t        |d6gt        |d5g             t        |d7g      t        d8      t        |d9g      t        |d:gt        |d9g             |S c c}w c c}w );Nsystem_instructionsystemInstruction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frequencyPenaltyseed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safetySettingstoolstool_config
toolConfiglabelsznlabels 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)r    r!   r   rh   	t_contentt_schemar"   _SafetySetting_to_mldevt_tools_Tool_to_mldevt_tool_ToolConfig_to_mldevt_cached_content_namet_speech_config_ImageConfig_to_mldevrU   s        r%   _GenerateContentConfig_to_mldevr*    s   
 !)	+,-.:	KK[+?*@ABI	
 
+'3]OT+%GH	+y!-VHd;	:;	+y!-VHd;	:;	+)*+7%&[;L:M(NO	++,-9%&[;N:O(P 
+()*6_%tK:J9K'LM	++,-9	[./0 
+
|$0ZL${ZL"AB	+*+,8%&[;M:N(O 
++,-9	[./0 
+x ,VHd;9:	+,-.:	[/01 
+)*+7		

:tK2C1DEF 
+./0<	[123 
+()*6
	< 
 
+012>
	M 
 
+)*+7	 [+<*=>	
 $D)4	
 
+y!-		 		*d;	.JK	
 188J5yA	
 
+'3	T+?K 
+z".
	3 
 
+()*6		[+;*<=	
 
+-./;	[012 
+*+,8%&[;M:N(O 
+()5		${_,=>? 
+)*+7
	< 
 
+)*+7%&[;L:M(NO	+'(4	d;0@A9M 
+789E	%&[:;< 
+,-.:
	B 
 
+'(4kN;K)LM	s	
	
s   T'T"c                 X   i }t        | dg      t        |dgt        | dg             t        | dg      1t        |dgt        | dg      D cg c]  }t        ||       c}       t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      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 c c}w )Nr   r   
candidatesmodelVersionmodel_versionpromptFeedbackprompt_feedback
responseIdresponse_idusageMetadatausage_metadatamodelStatusmodel_status)r    r!   r   r0   s       r%   #_GenerateContentResponse_from_mldevr7    sZ    !)	+)*+7'(${=N<O*P 
+~&2	 [<.9	
 "$	2	
 
+'(4_%tK.9I'JK	+()*6&'k<L;M)NO	+~&2]OT+~%FG	+()5%&[?:K(LM	+'3^$d;&HI	+	
s   D'c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S r   r   r   s       r%   _GetBatchJobParameters_to_mldevr9    r   r'   c                     i }t        |dg      .t        |ddgt        j                  | t        |dg                   |S r   r   r   s       r%    _GetBatchJobParameters_to_vertexr;    r   r'   c           
          i }t        | dg      #t        |dgt        t        | dg      |             t        | dg      t        |dgt        | dg             |S )Nauth_config
authConfigenable_widgetenableWidget)r    r!   r&   r#   s      r%   _GoogleMaps_to_mldevrA    sl     !)	+'3	T+?K 
+()5^$d;8I&JK	r'   c                    i }t        | dg      t        |dgt        | dg             t        | dg      t        d      t        | dg      t        d      t        | dg      t        |dgt        | dg             |S )	Nsearch_typessearchTypesblocking_confidencez{blocking_confidence parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.exclude_domainszwexclude_domains parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.time_range_filtertimeRangeFilterr   r#   s      r%   _GoogleSearch_to_mldevrI    s     !)	+'(4]OT+7G%HI	+-./;
	B 
 
+)*+7
	< 
 
++,-9%&[;N:O(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 )Naspect_ratioaspectRatio
image_size	imageSizeperson_generationzyperson_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.output_mime_typezxoutput_mime_type parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.output_compression_qualityzoutput_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.r   r#   s      r%   r)  r)    s    !)	+'(4]OT+7G%HI	+~&2[M4l^#DE	++,-9
	B 
 
+*+,8
	B 
 
+*+,8
	B 
 
+456B
	M 
 
+./0<
	B 
 
r'   c                    i }t        |dg      .t        |ddgt        j                  | t        |dg                   t        |dg      Et        |ddgt        j                  t        |dg            D cg c]  }t        ||       c}       t        |dg      t        |dgt        |dg             t        |dg      2t        |ddgt        | t        |dg      t        |dgi                    |S c c}w )Nre   r   r   r[   r   generationConfig)default_value)r    r!   rh   r   
t_contentsr   r*  rU   s        r%   rT   rT   D  s   
 !)	+y!-	G			*d;	:; 
+
|$0	J T+
|%DE	
 dI.	
 
+
|$0ZL${ZL"AB	+z".	&''xj)YKr:	
 
)	
s   6C7c           
         i }t        | dg      #t        |dgt        t        | dg      |             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S )Nresponser[   rm   )r    r!   r7  r#   s      r%   r/   r/   l  s     !)	+
|$0	+zl+Y	
 
+
|$0ZL${ZL"AB	+y!-WItK';<	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      |S )N	page_size_querypageSize
page_token	pageTokenfilterznfilter parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.r   r#   s      r%   _ListBatchJobsConfig_to_mldevra    s     !)	+}%1*-tK+/O 
+~&2	;[<.) 
+z".
	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             |S )Nr[  r\  r]  r^  r_  r`  rM   r#   s      r%   _ListBatchJobsConfig_to_vertexrc    s     !)	+}%1*-tK+/O 
+~&2	;[<.) 
+z".8,d;
.KL	r'   c                 R    i }t        | dg      t        t        | dg      |       |S Nr   )r    ra  r#   s      r%   !_ListBatchJobsParameters_to_mldevrf    s1     !)	+z".!${XJ"?K	r'   c                 R    i }t        | dg      t        t        | dg      |       |S re  )r    rc  r#   s      r%   "_ListBatchJobsParameters_to_vertexrh    s1     !)	+z"."4hZ#@)L	r'   c                 (   i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      1t        |dgt        | dg      D cg c]  }t        ||       c}       |S c c}w )Nr   r   nextPageTokennext_page_token
operations
batch_jobs)r    r!   rk   r0   s       r%   !_ListBatchJobsResponse_from_mldevrn    s     !)	+)*+7'(${=N<O*P 
+()5&'kO;L)MN	+~&2	 [<.9	
 !y1	
 
	
   3Bc                 (   i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      1t        |dgt        | dg      D cg c]  }t        ||       c}       |S c c}w )Nr   r   rj  rk  batchPredictionJobsrm  )r    r!   rw   r0   s       r%   "_ListBatchJobsResponse_from_vertexrr    s     !)	+)*+7'(${=N<O*P 
+()5&'kO;L)MN	+-./;	 [+@*AB	
 "$	2	
 
	
ro  c           
      n   i }t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      #t        |dgt        t        | dg      |             t        | d	g      #t        |d
gt        t        | d	g      |             t        | dg      t        |dgt        | dg             t        | dg      #t        |dgt	        t        | dg      |             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             |S )Nr  r  code_execution_resultcodeExecutionResultexecutable_codeexecutableCode	file_datafileDatafunction_callfunctionCallfunction_responsefunctionResponseinline_data
inlineDatatextthoughtthought_signaturethoughtSignaturevideo_metadatavideoMetadata	tool_calltoolCalltool_responsetoolResponsepart_metadatapartMetadata)r    r!   r   r   r}   r#   s      r%   r   r      s    !)	+*+,8%&[;M:N(O 
+/01=	[234 
+)*+7%&[;L:M(NO	+}%1	4k];YG 
+()5	tK/1BCYO 
++,-9	[./0 
+'3	tK-99E 
+x ,VHd;9:	+	{#/YKkI;!?@	++,-9	[./0 
+()*6_%tK:J9K'LM	+}%1ZL${[M"BC	+()5^$d;8I&JK	+()5^$d;8I&JK	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.	thresholdr   r#   s      r%   r"  r"  L  s~     !)	+
|$0ZL${ZL"AB	+z".
	3 
 
+}%1[M4k]#CD	r'   c           
         i }t        | dg      t        |dgt        | dg             t        | dg      #t        |dgt        t        | dg      |             t        | dg      t        |dgt        | dg             |S )Nretrieval_configretrievalConfigfunction_calling_configfunctionCallingConfig$include_server_side_tool_invocations includeServerSideToolInvocations)r    r!   r   r#   s      r%   r&  r&  `  s     !)	+*+,8%&[;M:N(O 
+123?	 !'89:I	
 
+>?@L	+,[ABC 
r'   c           
         i }t        | dg      t        d      t        | dg      t        |dgt        | dg             t        | dg      t        |dgt        | dg             t        | dg      #t        |dgt        t        | dg      |             t        | d	g      #t        |d
gt	        t        | d	g      |             t        | dg      t        |dgt        | dg             t        | dg      t        d      t        | dg      't        |dgt        | dg      D cg c]  }| c}       t        | dg      t        |dgt        | dg             t        | dg      t        d      t        | dg      t        |dgt        | dg             t        | dg      't        |dgt        | dg      D cg c]  }| c}       |S c c}w c c}w )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functionDeclarations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
mcpServers)r    r"   r!   rI  rA  r0   s       r%   r$  r$  }  s:    !)	+}%1
	< 
 
+'(4]OT+7G%HI	+'3\ND}o$FG	+()5	tK/1BCYO 
+'3	T+?K 
+()*6_%tK:J9K'LM	+/01=
	B 
 
+/01=	 {-D,EFG$G 
+123?	 ![456 
+,-.:
	B 
 
+'3\ND}o$FG	+'3	{]O<=$= 
5 	H. 	>s   )	G	Gc           	          i }t        | ddg      t        |dgt        | ddg             t        | dg      t        |dgt        | dg             |S )Nr9   r:   bigquery_destinationr\   r]   rM   r#   s      r%   r>   r>     sl     !)	+-{;<H	 [0+>? 
+'3^$d;&HI	r'   c                     i }t        | dg      t        |ddgt        | dg             t        | dg      t        |dgt        | dg             |S )Nr  r9   r:   r]   r\   rM   r#   s      r%   rB   rB     sk     !)	+./0<	,[123 
+'(4]OT+7G%HI	r'   c            	          e Zd Zddddee   deej                  ej                  f   deej                     dej                  fdZdddde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deej"                     dd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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ej&                     deej                     fdZy)BatchesNre   r   re   rq   r   r   c                   t        j                  |||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }	|j                  ,|j                  j                  |j                  j                  }	t        j                  |      }t        j                  |      }| j                  j                  d|||	      }
|
j                   si nt#        j$                  |
j                         }| j                  j                  rt'        |      }| j                  j                  st)        |      }t         j*                  j-                  |t/        |dd       rGdt/        |j                  d	d       t/        |j                  d
d       t/        |j                  dd       dini       }| j                  j1                  |       |S Nre   rq   r   r   rq  z{model}:batchGenerateContentr\  ?r   postr  r  include_all_fieldsr  r  r  rY  kwargs)r   _CreateBatchJobParameters_api_clientvertexair   get
format_mapr   r   popr   http_optionsr	   convert_to_dictencode_unserializable_typesr   bodyjsonloadsrw   rk   BatchJob_from_responsegetattr_verify_responseselfre   rq   r   parameter_modelrequest_dictrequest_url_dictpathquery_paramsr  rY  response_dictreturn_values                r%   _createzBatches._create  sJ    55O   8


Ol &))&1	$//0@A$7


Ol &))&1	-889IJ-##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''lLH 'mmBHMM1JM  +M:m$$*=9m>>00 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 1 L& 	%%l3r'   c                   t        j                  |||      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }	|j                  ,|j                  j                  |j                  j                  }	t        j                  |      }t        j                  |      }| j                  j                  d|||	      }
|
j                   si nt#        j$                  |
j                         }| j                  j                  st'        |      }t         j(                  j+                  |t-        |dd       rGdt-        |j                  d	d       t-        |j                  d
d       t-        |j                  dd       dini       }| j                  j/                  |       |S Nr  ziThis method is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.r   z{model}:asyncBatchEmbedContentr\  r  r   r  r  r  r  r  r  )r   #_CreateEmbeddingsBatchJobParametersr  r  r"   r   r  r  r   r  r   r  r	   r  r  r   r  r  r  rk   r  r  r  r  r  s                r%   _create_embeddingszBatches._create_embeddings?  s    ??O   4 
 B


Ol &))&1	/::;KL/##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''lLH 'mmBHMM1JM$$*=9m>>00 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 1 L& 	%%l3r'   r   rZ   c                   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||      }	|	j                   si nt#        j$                  |	j                         }
| j                  j                  rt'        |
      }
| j                  j                  st)        |
      }
t         j*                  j-                  |
t/        |dd      rGdt/        |j                  d
d      t/        |j                  dd      t/        |j                  dd      dini       }| j                  j1                  |       |S )aW  Gets a batch job.

    Args:
      name (str): A fully-qualified BatchJob resource name or ID.
        Example: "projects/.../locations/.../batchPredictionJobs/456" or "456"
          when project and location are initialized in the Gemini Enterprise
          Agent Platform client. Or "batches/abc" using the Gemini Developer AI
          client.

    Returns:
      A BatchJob object that contains details about the batch job.

    Usage:

    .. code-block:: python

      batch_job = client.batches.get(name='123456789')
      print(f"Batch job: {batch_job.name}, state {batch_job.state}")
    rZ   r   r   batchPredictionJobs/{name}batches/{name}r\  r  r   Nr  r  r  r  r  r  )r   _GetBatchJobParametersr  r  r;  r  r  r9  r   r  r   r  r	   r  r  r   r  r  r  rw   rk   r  r  r  r  r  rZ   r   r  r  r  r  r  r  rY  r  r  s               r%   r  zBatches.get  sB   . 22O   5


Ol &))&1	+667GH+4


Ol &))&1	**+;<##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''t\<PH&mmBHMM1JM  +M:m$$*=9m>>00 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 1 L& 	%%l3r'   c                   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       y)
a  Cancels a batch job.

    Only available for batch jobs that are running or pending.

    Args:
      name (str): A fully-qualified BatchJob resource name or ID.
        Example: "projects/.../locations/.../batchPredictionJobs/456" or "456"
          when project and location are initialized in the Vertex AI client. Or
          "batches/abc" using the Gemini Developer AI client.

    Usage:

    .. code-block:: python

      client.batches.cancel(name='123456789')
    r  r   !batchPredictionJobs/{name}:cancelbatches/{name}:cancelr\  r  r   Nr  )r   _CancelBatchJobParametersr  r  r   r  r  r   r   r  r   r  r	   r  r  r   	r  rZ   r   r  r  r  r  r  r  s	            r%   cancelzBatches.cancel  sT   . 55O   8


Ol &))&1	2==>NO27


Ol &))&1	&112BC&##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DLVT<Fr'   c                   t        j                  |      }| j                  j                  r3t	        |      }|j                  d      }|rdj                  |      }n5d}n2t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||      }|j                   si nt#        j$                  |j                         }	| j                  j                  rt'        |	      }	| j                  j                  st)        |	      }	t         j*                  j-                  |	t/        |dd       rGdt/        |j                  d	d       t/        |j                  d
d       t/        |j                  dd       dini       }
t        j0                  |j2                        |
_        | j                  j7                  |
       |
S Nr  r   rq  batchesr\  r  r   r  r  r  r  r  r  headers)r   _ListBatchJobsParametersr  r  rh  r  r  rf  r   r  r   r  r	   r  r  r   r  r  r  rr  rn  ListBatchJobsResponser  r  HttpResponser  r   r  r  r   r  r  r  r  r  r  rY  r  r  s              r%   _listzBatches._list-  sE    44O   7Hl%))&1	$//0@A$6Gl%))&1	##$45##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''t\<PH&mmBHMM1JM  8Gm$$7Fm..== ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! > L$ &+%7%7  &L" 	%%l3r'   c                   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||      }	|	j                   si nt#        j$                  |	j                         }
| j                  j                  rt'        |
      }
| j                  j                  st)        |
      }
t         j*                  j-                  |
t/        |dd      rGdt/        |j                  d
d      t/        |j                  dd      t/        |j                  dd      dini       }t        j0                  |	j2                        |_        | j                  j7                  |       |S )a  Deletes a batch job.

    Args:
      name (str): A fully-qualified BatchJob resource name or ID.
        Example: "projects/.../locations/.../batchPredictionJobs/456" or "456"
          when project and location are initialized in the client.

    Returns:
      A DeleteResourceJob object that shows the status of the deletion.

    Usage:

    .. code-block:: python

      client.batches.delete(name='123456789')
    r  r   r  r  r\  r  r   Ndeleter  r  r  r  r  r  )r   _DeleteBatchJobParametersr  r  r   r  r  r   r   r  r   r  r	   r  r  r   r  r  r  r   r   DeleteResourceJobr  r  r  r  r   r  r  s               r%   r  zBatches.deletev  sg   . 55O   8


Ol &))&1	+667GH+7


Ol &))&1	**+;<##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL''$lH 'mmBHMM1JM  4]Cm$$3MBm**99 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! : L$ &+%7%7  &L" 	%%l3r'   c                .   t        j                  | j                  |      }t        j                  |||      }| j                  j
                  r4t        j                  ||j                        }| j                  |||      S | j                  |||      S )a  Creates a batch job.

    Args:
      model (str): The model to use for the batch job.
      src: The source of the batch job. Currently Gemini Enterprise Agent
        Platform supports GCS URI(-s) or BigQuery URI. Example:
        "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
        Gemini Developer API supports List of inlined_request, or file name.
        Example: "files/file_name".
      config (CreateBatchJobConfig): Optional configuration for the batch job.

    Returns:
      A BatchJob object that contains details about the batch job.

    Usage:

    .. code-block:: python

      batch_job = client.batches.create(
          model="gemini-2.0-flash-001",
          src="gs://path/to/input/data",
      )
      print(batch_job.state)
    r  
rh   r   r  r   r  r  r
   format_destinationr   r  r  re   rq   r   r  s        r%   createzBatches.create  s    > 

t//
5C 55O   ..sO4J4JKf\\3v\>>\\3v\>>r'   c                (   ddl }|j                  dt        j                  d       t	        j
                  | j                  |      }t        j                  |||      }| j                  j                  rt        d      | j                  |||      S )a]  **Experimental** Creates an embedding batch job.

    Args:
      model (str): The model to use for the batch job.
      src: Gemini Developer API supports List of inlined_request, or file name.
        Example: "files/file_name".
      config (CreateBatchJobConfig): Optional configuration for the batch job.

    Returns:
      A BatchJob object that contains details about the batch job.

    Usage:

    .. code-block:: python

      batch_job = client.batches.create_embeddings(
          model="text-embedding-004",
          src="files/my_embedding_input",
      )
      print(batch_job.state)
    r   NJbatches.create_embeddings() is experimental and may change without notice.   r  
stacklevelr  lGemini Enterprise Agent Platform (previously known as Vertex AI) does not support batches.create_embeddings.)warningswarnr	   ExperimentalWarningrh   t_embedding_batch_job_sourcer  r   r  r  r"   r  )r  re   rq   r   r   r  s         r%   create_embeddingszBatches.create_embeddings	  s    8 MM	,,	   
(
()9)93
?C ??O   9 
 $$5c&$IIr'   c                V    | j                   }t        d|| j                  |      |      S )a  Lists batch jobs.

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

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

    Usage:

    .. code-block:: python
      config = {'page_size': 10}
      for batch_job in client.batches.list(config):
        print(batch_job.name)
    rm  r  )r  r   r  r   list_requests      r%   listzBatches.list=	  s1    ( ::L

&
!	 r'   )__name__
__module____qualname__r   strr   r   BatchJobSourceUnionBatchJobSourceUnionDictCreateBatchJobConfigOrDictr  r  EmbeddingsBatchJobSourceOrDict$CreateEmbeddingsBatchJobConfigOrDictr  GetBatchJobConfigOrDictr  CancelBatchJobConfigOrDictr  ListBatchJobsConfigOrDictr  r  DeleteBatchJobConfigOrDictr  r  r  r  r   r   r'   r%   r  r    sg   
 ";?Q c]Q **E,I,IIJ	Q
 u778Q ~~Ql "EIJ c]J //	J
 uAABJ ~~JZ MQ^^"*5+H+H"I^~~^H <@	@G @G u778	@G
 @GF DHG ? ?@G""GZ <@	b b u778	b
 bR <@,? ,? ((	,?
 u778,? ~~,?f FJ3J 3J //	3J
 uAAB3J ~~3Jl DH ? ?@U^^r'   r  c            	          e Zd Zddddee   deej                  ej                  f   deej                     dej                  fdZdddde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deej"                     dd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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ej&                     deej                     fdZy)AsyncBatchesNr  re   rq   r   r   c                  K   t        j                  |||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }	|j                  ,|j                  j                  |j                  j                  }	t        j                  |      }t        j                  |      }| j                  j                  d|||	       d {   }
|
j                   si nt#        j$                  |
j                         }| j                  j                  rt'        |      }| j                  j                  st)        |      }t         j*                  j-                  |t/        |dd       rGdt/        |j                  d	d       t/        |j                  d
d       t/        |j                  dd       dini       }| j                  j1                  |       |S 7 wr  )r   r  r  r  r   r  r  r   r   r  r   r  r	   r  r  async_requestr  r  r  rw   rk   r  r  r  r  r  s                r%   r  zAsyncBatches._create\	  sY     55O   8


Ol &))&1	$//0@A$7


Ol &))&1	-889IJ-##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33lL H 'mmBHMM1JM  +M:m$$*=9m>>00 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 1 L& 	%%l3As   E$I/&I,'DI/c                8  K   t        j                  |||      }| j                  j                  rt	        d      t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }	|j                  ,|j                  j                  |j                  j                  }	t        j                  |      }t        j                  |      }| j                  j                  d|||	       d {   }
|
j                   si nt#        j$                  |
j                         }| j                  j                  st'        |      }t         j(                  j+                  |t-        |dd       rGdt-        |j                  d	d       t-        |j                  d
d       t-        |j                  dd       dini       }| j                  j/                  |       |S 7 wr  )r   r  r  r  r"   r   r  r  r   r  r   r  r	   r  r  r  r  r  r  rk   r  r  r  r  r  s                r%   r  zAsyncBatches._create_embeddings	  s     ??O   4 
 B


Ol &))&1	/::;KL/##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33lL H 'mmBHMM1JM$$*=9m>>00 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 1 L& 	%%l3;s   D1H3H4C%Hr  rZ   c                  K   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{   }	|	j                   si nt#        j$                  |	j                         }
| j                  j                  rt'        |
      }
| j                  j                  st)        |
      }
t         j*                  j-                  |
t/        |dd      rGdt/        |j                  d
d      t/        |j                  dd      t/        |j                  dd      dini       }| j                  j1                  |       |S 7 w)aa  Gets a batch job.

    Args:
      name (str): A fully-qualified BatchJob resource name or ID.
        Example: "projects/.../locations/.../batchPredictionJobs/456" or "456"
          when project and location are initialized in the Gemini Enterprise
          Agent Platform client. Or "batches/abc" using the Gemini Developer AI
          client.

    Returns:
      A BatchJob object that contains details about the batch job.

    Usage:

    .. code-block:: python

      batch_job = await client.aio.batches.get(name='123456789')
      print(f"Batch job: {batch_job.name}, state {batch_job.state}")
    r  r   r  r  r\  r  r   Nr  r  r  r  r  r  )r   r  r  r  r;  r  r  r9  r   r  r   r  r	   r  r  r  r  r  r  rw   rk   r  r  r  r  r  s               r%   r  zAsyncBatches.get	  sV    . 22O   5


Ol &))&1	+667GH+4


Ol &))&1	**+;<##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33t\< H 'mmBHMM1JM  +M:m$$*=9m>>00 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! 1 L& 	%%l3As   E#I.%I+&DI.c                  K   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{    y7 w)
a  Cancels a batch job.

    Only available for batch jobs that are running or pending.

    Args:
      name (str): A fully-qualified BatchJob resource name or ID.
        Example: "projects/.../locations/.../batchPredictionJobs/456" or "456"
          when project and location are initialized in the Vertex AI client. Or
          "batches/abc" using the Gemini Developer AI client.

    Usage:

    .. code-block:: python

      await client.aio.batches.cancel(name='123456789')
    r  r   r  r  r\  r  r   Nr  )r   r  r  r  r   r  r  r   r   r  r   r  r	   r  r  r  r  s	            r%   r  zAsyncBatches.cancel]
  se    . 55O   8


Ol &))&1	2==>NO27


Ol &))&1	&112BC&##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL



(
(lL  s   E#E-%E+&E-c                  K   t        j                  |      }| j                  j                  r3t	        |      }|j                  d      }|rdj                  |      }n5d}n2t        |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd        d }|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d|||       d {   }|j                   si nt#        j$                  |j                         }	| j                  j                  rt'        |	      }	| j                  j                  st)        |	      }	t         j*                  j-                  |	t/        |dd       rGdt/        |j                  d	d       t/        |j                  d
d       t/        |j                  dd       dini       }
t        j0                  |j2                        |
_        | j                  j7                  |
       |
S 7 +wr  )r   r  r  r  rh  r  r  rf  r   r  r   r  r	   r  r  r  r  r  r  rr  rn  r  r  r  r  r  r   r  r  s              r%   r  zAsyncBatches._list
  sY     44O   7Hl%))&1	$//0@A$6Gl%))&1	##$45##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33t\< H 'mmBHMM1JM  8Gm$$7Fm..== ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! > L$ &+%7%7  &L" 	%%l3Es   EI<I9D+I<c                *  K   t        j                  ||      }| j                  j                  r>t	        | j                  |      }|j                  d      }|rdj                  |      }n@d}n=t        | j                  |      }|j                  d      }|rdj                  |      }nd}|j                  d      }|r| dt        |       }|j                  dd       d}|j                  ,|j                  j                  |j                  j                  }t        j                  |      }t        j                  |      }| j                  j                  d	|||       d{   }	|	j                   si nt#        j$                  |	j                         }
| j                  j                  rt'        |
      }
| j                  j                  st)        |
      }
t         j*                  j-                  |
t/        |dd      rGdt/        |j                  d
d      t/        |j                  dd      t/        |j                  dd      dini       }t        j0                  |	j2                        |_        | j                  j7                  |       |S 7 +w)a  Deletes a batch job.

    Args:
      name (str): A fully-qualified BatchJob resource name or ID.
        Example: "projects/.../locations/.../batchPredictionJobs/456" or "456"
          when project and location are initialized in the client.

    Returns:
      A DeleteResourceJob object that shows the status of the deletion.

    Usage:

    .. code-block:: python

      await client.aio.batches.delete(name='123456789')
    r  r   r  r  r\  r  r   Nr  r  r  r  r  r  r  )r   r  r  r  r   r  r  r   r   r  r   r  r	   r  r  r  r  r  r  r   r   r  r  r  r  r  r   r  r  s               r%   r  zAsyncBatches.delete
  sv    . 55O   8


Ol &))&1	+667GH+7


Ol &))&1	**+;<##H-LvQy./0dXt$04L*""//;$++88l**<8L66|DL%%33$l H 'mmBHMM1JM  4]Cm$$3MBm**99 ?Hd3 #*#**,=t$ )0#**,BD) '.#**,@$'

 ! : L$ &+%7%7  &L" 	%%l3Es   E#J%J&D+Jc                ^  K   t        j                  | j                  |      }t        j                  |||      }| j                  j
                  r<t        j                  ||j                        }| j                  |||       d{   S | j                  |||       d{   S 7  7 w)a  Creates a batch job asynchronously.

    Args:
      model (str): The model to use for the batch job.
      src: The source of the batch job. Currently Gemini Enterprise Agent
        Platform supports GCS URI(-s) or BigQuery URI. Example:
        "gs://path/to/input/data" or "bq://projectId.bqDatasetId.bqTableId".
        Gemini Develop API supports List of inlined_request, or file name.
        Example: "files/file_name".
      config (CreateBatchJobConfig): Optional configuration for the batch job.

    Returns:
      A BatchJob object that contains details about the batch job.

    Usage:

    .. code-block:: python

      batch_job = await client.aio.batches.create(
          model="gemini-2.0-flash-001",
          src="gs://path/to/input/data",
      )
    r  Nr  r  s        r%   r  zAsyncBatches.createP  s     < 

t//
5C 55O   ..sO4J4JKf<<eV<DDD<<eV<DDD EDs$   BB-B)	B-$B+%B-+B-c                  K   ddl }|j                  dt        j                  d       t	        j
                  | j                  |      }t        j                  |||      }d}|j                  ,|j                  j                  |j                  j                  }| j                  j                  rt        d      | j                  |||       d{   S 7 w)ao  **Experimental** Creates an asynchronously embedding batch job.

    Args:
      model (str): The model to use for the batch job.
      src: Gemini Developer API supports inlined_requests, or file name.
        Example: "files/file_name".
      config (CreateBatchJobConfig): Optional configuration for the batch job.

    Returns:
      A BatchJob object that contains details about the batch job.

    Usage:

    .. code-block:: python

      batch_job = await client.aio.batches.create_embeddings(
          model="text-embedding-004",
          src="files/my_embedding_input",
      )
      print(batch_job.state)
    r   Nr  r  r  r  r  )r   r  r	   r  rh   r  r  r   r  r   r  r  r"   r  )r  re   rq   r   r   r  r  s          r%   r  zAsyncBatches.create_embeddings}  s     8 MM	,,	   
(
()9)93
?C ??O 15L*""//;$++88l  9 
 **C*OOOOs   CCCCc                r   K   | j                   }t        d|| j                  |       d{   |      S 7 	w)a  Lists batch jobs asynchronously.

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

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

    Usage:

    .. code-block:: python
      async for batch_job in await client.aio.batches.list():
        print(batch_job.name)
    rm  r  N)r  r   r  s      r%   r  zAsyncBatches.list  s=     & ::Ljjj''	  	(s   )75
7)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  Z	  sh   
 ";?Q c]Q **E,I,IIJ	Q
 u778Q ~~Ql "EIJ c]J //	J
 uAABJ ~~JZ MQ``"*5+H+H"I`~~`L <@	B B u778	B
 BJ DHI ? ?@I""I^ <@	b b u778	b
 bR <@+E +E ((	+E
 u778+E ~~+Ed FJ:P :P //	:P
 uAAB:P ~~:Pz DH ? ?@%..!r'   r  )N)Vr  loggingtypingr   r   r   urllib.parser    r   r	   r
   r   rh   r   r  r   r   r    r   r   r   r!   pagersr   r   	getLoggerloggerdictr  objectr&   r2   r?   rC   rN   rV   rX   rk   rw   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r*  r7  r9  r;  rA  rI  r)  rT   r/   ra  rc  rf  rh  rn  rr  r   r"  r&  r$  r>   rB   
BaseModuler  r  r  r'   r%   <module>r-     sX  $   ' ' "       & . 0 . %			1	2
 /3,tCH~v-.,DcN+, 
#s(^,b /3%tCH~v-.%DcN+% 
#s(^%T /3tCH~v-.DcN+ 
#s(^H /31tCH~v-.1DcN+1 
#s(^1l /3tCH~v-.DcN+ 
#s(^D /3++tCH~v-.+ DcN++ 
#s(^	+` /3%tCH~v-.%DcN+% 
#s(^%T /36tCH~v-.6DcN+6 
#s(^6v /3;tCH~v-.;DcN+; 
#s(^;@ /3tCH~v-.DcN+ 
#s(^. /3tCH~v-. DcN+ 
#s(^	& /3tCH~v-. DcN+ 
#s(^	$ /35tCH~v-.5DcN+5 
#s(^5t /3tCH~v-.DcN+ 
#s(^" /3tCH~v-.DcN+ 
#s(^. /3tCH~v-.DcN+ 
#s(^> /3tCH~v-.DcN+ 
#s(^< /3tCH~v-. DcN+ 
#s(^	B /3tCH~v-. DcN+ 
#s(^	> /3tCH~v-.DcN+ 
#s(^& /3tCH~v-. DcN+ 
#s(^	B /3tCH~v-. DcN+ 
#s(^	& /3tCH~v-. DcN+ 
#s(^	$ /3tCH~v-.DcN+ 
#s(^0 /3tCH~v-.DcN+ 
#s(^2 /3tCH~v-. DcN+ 
#s(^	< /3.tCH~v-..DcN+. 
#s(^.h /3tCH~v-. DcN+ 
#s(^	. /3tCH~v-.DcN+ 
#s(^, /3tCH~v-.DcN+ 
#s(^> /3tCH~v-.DcN+ 
#s(^6 /3{{tCH~v-.{ DcN+{ 
#s(^	{@ /3#tCH~v-.#DcN+# 
#s(^#R /3tCH~v-. DcN+ 
#s(^	& /3tCH~v-. DcN+ 
#s(^	$ /3tCH~v-.DcN+ 
#s(^( /3tCH~v-.DcN+ 
#s(^< /3)tCH~v-.)DcN+) 
#s(^)^ /3%%tCH~v-.% DcN+% 
#s(^	%T /3tCH~v-.DcN+ 
#s(^2 /3tCH~v-.DcN+ 
#s(^: /3tCH~v-.DcN+ 
#s(^4 /3tCH~v-.DcN+ 
#s(^ /3tCH~v-.DcN+ 
#s(^ /3tCH~v-.DcN+ 
#s(^8 /3tCH~v-.DcN+ 
#s(^8 /3ItCH~v-.IDcN+I 
#s(^I\ /3tCH~v-.DcN+ 
#s(^, /3tCH~v-.DcN+ 
#s(^> /3FtCH~v-.FDcN+F 
#s(^FV /3tCH~v-.DcN+ 
#s(^( /3tCH~v-.DcN+ 
#s(^$m	k$$ m	`x	;)) x	r'   