Ë
    ümxi  ã                  ó¤   — d Z ddlmZ ddlmZmZ ddlmZ ddlmZ ddl	m
Z
 ddl	mZ  G d„ d	ej                  «      Z	 	 	 	 dd
„Z	 d	 	 	 	 	 dd„Zy)z'Utilities for handling input variables.é    )Úannotations)ÚCallableÚMapping)Úparsed_args_lib)Úpy_utils)Úllmfn_input_utils)Úllmfn_inputs_sourcec                  ó0   ‡ — e Zd ZdZdˆ fd„Z	 	 dd„Zˆ xZS )Ú_NormalizedInputsSourceaŒ  Wrapper around NormalizedInputsList.

    By design LLMFunction does not take NormalizedInputsList as input because
    NormalizedInputsList is an internal representation so we want to minimize
    exposure to the caller.

    When we have inputs already in normalized format (e.g. from
    join_prompt_inputs()) we can wrap it as an LLMFnInputsSource to pass as an
    input to LLMFunction.
    c                ó0   •— t         ‰| �  «        || _        y ©N)ÚsuperÚ__init__Ú_normalized_inputs)ÚselfÚnormalized_inputsÚ	__class__s     €ú_/home/htdocs/ttos/venv/lib/python3.12/site-packages/google/generativeai/notebook/input_utils.pyr   z _NormalizedInputsSource.__init__&   s   ø€ Ü‰ÑÔØ"3ˆÕó    c                ó    — | j                   d„ fS )Nc                  ó   — y r   © r   r   r   ú<lambda>zD_NormalizedInputsSource._to_normalized_inputs_impl.<locals>.<lambda>-   s   � r   )r   )r   s    r   Ú_to_normalized_inputs_implz2_NormalizedInputsSource._to_normalized_inputs_impl*   s   € ð ×&Ñ&©Ð4Ð4r   )r   z(llmfn_inputs_source.NormalizedInputsList)ÚreturnzCtuple[llmfn_inputs_source.NormalizedInputsList, Callable[[], None]])Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__classcell__)r   s   @r   r   r      s   ø„ ñ	õ4ð5à	L÷5r   r   c                ó¤   — t        j                  | «      }t        |t        j                  «      r|S t        j                  |«      }t        |«      S r   )r   Ú
get_py_varÚ
isinstancer	   ÚLLMFnInputsSourcer   Úto_normalized_inputsr   )Úvar_nameÚdatar   s      r   Úget_inputs_source_from_py_varr(   0   sG   € ô ×Ñ˜xÓ(€DÜ�$Ô+×=Ñ=Ô>àˆÜ)×>Ñ>¸tÓDÐÜ"Ð#4Ó5Ð5r   c                óä   — g }| j                   D ]#  }|j                  |j                  |¬«      «       Œ% | j                  D ]#  }|j                  |j                  |¬«      «       Œ% t	        |«      S )z5Get a single combined input source from `parsed_args.)Úsuppress_status_msgs)ÚinputsÚextendr%   Úsheets_input_namesr   )Úparsed_argsr*   Úcombined_inputsÚsources       r   Újoin_inputs_sourcesr1   ;   s‚   € ð
 02€OØ×$Ñ$ò 
ˆØ×ÑØ×'Ñ'Ð=QÐ'ÓRõ	
ð
ð ×0Ñ0ò 
ˆØ×ÑØ×'Ñ'Ð=QÐ'ÓRõ	
ð
ô # ?Ó3Ð3r   N)r&   Ústrr   ú%llmfn_inputs_source.LLMFnInputsSource)F)r.   zparsed_args_lib.ParsedArgsr*   Úboolr   r3   )r   Ú
__future__r   Útypingr   r   Úgoogle.generativeai.notebookr   r   Ú google.generativeai.notebook.libr   r	   r$   r   r(   r1   r   r   r   ú<module>r9      sh   ðñ .Ý "ç $å 8Ý 1Ý >Ý @ô5Ð1×CÑCô 5ð,6Øð6à*ó6ð "'ð4Ø+ð4àð4ð +ô4r   