o
    YiFG                     @   s8  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eeeef ef d	eeeef  d
eeef fddZ	d,deeeef ef d	eeeef  d
eeef fddZ	d,deeeef ef d	eeeef  d
eeef fddZ	d,deeeef ef d	eeeef  d
eeef fddZ	d,dedeeeef ef d	eeeef  d
eeef fddZ	d,dedeeeef ef d	eeeef  d
eeef fddZ	d,deeeef ef d	eeeef  d
eeef fddZ	d,deeeef ef d	eeeef  d
eeef fddZ	d,deeeef ef d	eeeef  d
eeef fddZ	d,deeeef ef d	eeeef  d
eeef fddZ	d,deeeef ef d	eeeef  d
eeef fd d!Z	d,dedeeeef ef d	eeeef  d
eeef fd"d#Z	d,dedeeeef ef d	eeeef  d
eeef fd$d%Z	d,deeeef ef d	eeeef  d
eeef fd&d'Z	d,deeeef ef d	eeeef  d
eeef fd(d)Z	d,deeeef ef d	eeeef  d
eeef fd*d+Z dS )-    )AnyOptionalUnion   )_transformers)BaseApiClient)get_value_by_path)set_value_by_pathNfrom_objectparent_objectreturnc                 C       i }t | dgd urtd|S )NZlanguage_codesz8language_codes parameter is not supported in Gemini API.getv
ValueErrorr
   r   	to_object r   Y/home/kim/smarthome/.venv/lib/python3.10/site-packages/google/genai/_tokens_converters.py"_AudioTranscriptionConfig_to_mldev      r   c                 C   s   i }t | dgd urt|dgt | dg t | dgd ur!tdt | dgd ur-tdt | dgd ur9tdt | d	gd urEtd
t | dgd urQtdt | dgd ur]td|S )NZapi_keyZapiKeyZapi_key_configz8api_key_config parameter is not supported in Gemini API.Z	auth_typez3auth_type parameter is not supported in Gemini API.Zgoogle_service_account_configzGgoogle_service_account_config parameter is not supported in Gemini API.Zhttp_basic_auth_configz@http_basic_auth_config parameter is not supported in Gemini API.Zoauth_configz6oauth_config parameter is not supported in Gemini API.Zoidc_configz5oidc_config parameter is not supported in Gemini API.r   setvr   r   r   r   r   _AuthConfig_to_mldev%   s(   r   c                 C   sl   i }t | dgd urt|dgt | dg t | dgd ur!tdt | dgd ur4t|dgt | dg |S )Ndatadisplay_name6display_name parameter is not supported in Gemini API.	mime_typemimeTyper   r   r   r   r   _Blob_to_mldevG   s   r   c                    sb   i  t | dgd urt dg fddt | dgD  t | dgd ur/t dgt | dg  S )Npartsc                    s   g | ]}t | qS r   )_Part_to_mldev.0itemr   r   r   
<listcomp>a   s    z%_Content_to_mldev.<locals>.<listcomp>Zrole)r   r   )r
   r   r   r%   r   _Content_to_mldevX   s   

	r'   
api_clientc                 C   s   i }t |dgd urt|dgt |dg t |dgd ur(t|dgt |dg t |dgd ur;t|dgt |dg t |dgd urRt|dgt| t |dg| t |dgd uret|d	gt |dg |S )
Nexpire_timeZ
expireTimeZnew_session_expire_timeZnewSessionExpireTimeZusesZlive_connect_constraintsZbidiGenerateContentSetupZlock_additional_fieldsZ	fieldMask)r   r    _LiveConnectConstraints_to_mldevr(   r
   r   r   r   r   r   _CreateAuthTokenConfig_to_mldevm   s8   



r,   c                 C   s6   i }t |dgd urt|dgt| t |dg| |S )Nconfig)r   r   r,   r+   r   r   r   #_CreateAuthTokenParameters_to_mldev   s   r.   c                 C   r   )Nr-   z/config parameter is not supported in Vertex AI.r   r   r   r   r   $_CreateAuthTokenParameters_to_vertex   r   r/   c                 C   sl   i }t | dgd urtdt | dgd ur!t|dgt | dg t | dgd ur4t|dgt | dg |S )Nr   r   Zfile_uriZfileUrir   r   )r   r   r   r   r   r   r   _FileData_to_mldev   s   r0   c                 C   s   i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur;t|dgt | dg t | dgd urGtdt | dgd urStd|S )Nidargsnamepartial_argsz6partial_args parameter is not supported in Gemini API.Zwill_continuez7will_continue parameter is not supported in Gemini API.r   r   r   r   r   _FunctionCall_to_mldev   s   r5   c                 C   sZ   i }t | dgd urt|dgtt | dg| t | dgd ur+t|dgt | dg |S )NZauth_configZ
authConfigZenable_widgetZenableWidget)r   r   r   r   r   r   r   _GoogleMaps_to_mldev   s   r6   c                 C   s   i }t | dgd urt|dgt | dg t | dgd ur!tdt | dgd ur-tdt | dgd ur@t|dgt | dg |S )	NZsearch_typesZsearchTypesZblocking_confidencez=blocking_confidence parameter is not supported in Gemini API.Zexclude_domainsz9exclude_domains parameter is not supported in Gemini API.Ztime_range_filterZtimeRangeFilterr   r   r   r   r   _GoogleSearch_to_mldev   s    r7   c              
      s  i t |dgd urt|ddgt |dg t |dgd ur*t|g dt |dg t |dgd ur>t|g dt |dg t |dgd urRt|g d	t |dg t |d
gd urft|g dt |d
g t |dgd urzt|g dt |dg t |dgd urt|g dt |dg t |dgd urt|g dt |dg t |dgd urt|g dtt |dg t |dgd urt|g dt |dg t |dgd urt|g dt |dg t |dgd urt|ddgttt |dg t |dgd urt|ddg fddt t |dgD  t |dgd ur4t|ddgtt |dg t |dgd urLt|dd gtt |dg t |d!gd urdt|dd"gtt |d!g t |d#gd uryt|dd$gt |d#g t |d%gd urt|dd&gt |d%g t |d'gd urt|dd'gt |d'g t |d(gd urt	d)t |d*gd urt|dd+gt |d*g S ),NZgeneration_configsetupgenerationConfigZresponse_modalities)r8   r9   ZresponseModalitiestemperature)r8   r9   r:   Ztop_p)r8   r9   ZtopPZtop_k)r8   r9   ZtopKZmax_output_tokens)r8   r9   ZmaxOutputTokensmedia_resolution)r8   r9   mediaResolutionseed)r8   r9   r=   Zspeech_config)r8   r9   ZspeechConfigZthinking_config)r8   r9   ZthinkingConfigZenable_affective_dialog)r8   r9   ZenableAffectiveDialogZsystem_instructionZsystemInstructionZtoolsc                    s   g | ]}t t |qS r   )_Tool_to_mldevtZt_toolr"   r(   r   r   r   r&   h  s    z/_LiveConnectConfig_to_mldev.<locals>.<listcomp>Zsession_resumptionZsessionResumptionZinput_audio_transcriptionZinputAudioTranscriptionZoutput_audio_transcriptionZoutputAudioTranscriptionZrealtime_input_configZrealtimeInputConfigZcontext_window_compressionZcontextWindowCompressionZproactivityZexplicit_vad_signalz=explicit_vad_signal parameter is not supported in Gemini API.Zhistory_configZhistoryConfig)
r   r   r?   Zt_live_speech_configr'   Z	t_contentZt_tools!_SessionResumptionConfig_to_mldevr   r   )r(   r
   r   r   r@   r   _LiveConnectConfig_to_mldev  s  









	



rB   c              	   C   sf   i }t |dgd urt|ddgt| t |dg t |dgd ur1t|dgt| t |dg| |S )Nmodelr8   r-   )r   r   r?   Zt_modelrB   r+   r   r   r   r*     s    r*   c                 C   s
  i }t | dgd urt|dgt | dg t | dgd ur(t|dgt | dg t | dgd ur;t|dgt | dg t | dgd urQt|dgtt | dg| t | d	gd urgt|d
gtt | d	g| t | dgd urzt|dgt | dg t | dgd urt|dgtt | dg| t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg t | dgd urt|dgt | dg |S )Nr;   r<   Zcode_execution_resultZcodeExecutionResultZexecutable_codeZexecutableCode	file_dataZfileDataZfunction_callZfunctionCallZfunction_responseZfunctionResponseZinline_dataZ
inlineDatatextZthoughtZthought_signatureZthoughtSignatureZvideo_metadataZvideoMetadataZ	tool_callZtoolCallZtool_responseZtoolResponse)r   r   r0   r5   r   r   r   r   r   r!     sl   


r!   c                 C   sF   i }t | dgd urt|dgt | dg t | dgd ur!td|S )Nhandletransparentz5transparent parameter is not supported in Gemini API.r   r   r   r   r   rA     s   rA   c                 C   s  i }t | dgd urtdt | dgd ur!t|dgt | dg t | dgd ur4t|dgt | dg t | dgd urJt|dgtt | dg| t | d	gd ur`t|d
gtt | d	g| t | dgd urst|dgt | dg t | dgd urtdt | dgd urt|dgdd t | dgD  t | dgd urt|dgt | dg t | dgd urtdt | dgd urt|dgt | dg t | dgd urt|dgdd t | dgD  |S )NZ	retrievalz3retrieval parameter is not supported in Gemini API.Zcomputer_useZcomputerUseZfile_searchZ
fileSearchZgoogle_searchZgoogleSearchZgoogle_mapsZ
googleMapsZcode_executionZcodeExecutionZenterprise_web_searchz?enterprise_web_search parameter is not supported in Gemini API.Zfunction_declarationsZfunctionDeclarationsc                 S      g | ]}|qS r   r   r"   r   r   r   r&   E      z"_Tool_to_mldev.<locals>.<listcomp>Zgoogle_search_retrievalZgoogleSearchRetrievalZparallel_ai_searchz<parallel_ai_search parameter is not supported in Gemini API.Zurl_contextZ
urlContextZmcp_serversZ
mcpServersc                 S   rH   r   r   r"   r   r   r   r&   [  rI   )r   r   r   r7   r6   r   r   r   r   r>     sd   
r>   )N)!typingr   r   r    r   r?   Z_api_clientr   _commonr   r   r	   r   dictstrobjectr   r   r   r'   r,   r.   r/   r0   r5   r6   r7   rB   r*   r!   rA   r>   r   r   r   r   <module>   s  



$





,













 *



K


