U
    “öh	  ã                   @  sR   d Z ddlmZ ddlZddlmZmZmZ eeeef  Z	G dd„ dej
ƒZdS )zLLMFnInputsSource.é    )ÚannotationsN)ÚCallableÚMappingÚSequencec                   @  s>   e Zd ZdZdd„ Zddddœdd	„Zejd
dœdd„ƒZdS )ÚLLMFnInputsSourcez¿Abstract class representing a source of inputs for LLMFunction.

  This class could be extended with concrete implementations that read data
  from external sources, such as Google Sheets.
  c                 C  s   d | _ dd„ | _d S )Nc                   S  s   d S )N© r   r   r   úX/tmp/pip-unpacked-wheel-doshhd5e/google/generativeai/notebook/lib/llmfn_inputs_source.pyÚ<lambda>"   ó    z,LLMFnInputsSource.__init__.<locals>.<lambda>)Ú_cached_inputsÚ_display_status_fn©Úselfr   r   r   Ú__init__    s    zLLMFnInputsSource.__init__FÚboolÚNormalizedInputsList)Úsuppress_status_msgsÚreturnc                 C  s,   | j dkr|  ¡ \| _ | _|s&|  ¡  | j S )a¢  Returns a sequence of normalized inputs.

    The return value is a sequence of dictionaries of (placeholder, value)
    pairs, e.g. [{"word": "hot"}, {"word: "cold"}, ....]

    These are used for keyword-substitution for prompts in LLMFunctions.

    Args:
      suppress_status_msgs: If True, suppress status messages regarding the
        input being read.

    Returns:
      A sequence of normalized inputs.
    N)r   Ú_to_normalized_inputs_implr   )r   r   r   r   r   Úto_normalized_inputs$   s    
ÿ
z&LLMFnInputsSource.to_normalized_inputsz/tuple[NormalizedInputsList, Callable[[], None]])r   c                 C  s   dS )zûReturns a tuple of NormalizedInputsList and a display function.

    The display function displays some status about the input (e.g. where
    it is read from). This way the status continues to be displayed
    even though the results are cached.
    Nr   r   r   r   r   r   =   s    z,LLMFnInputsSource._to_normalized_inputs_implN)F)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚabcÚabstractmethodr   r   r   r   r   r      s    ÿr   )r   Ú
__future__r   r   Útypingr   r   r   Ústrr   ÚABCr   r   r   r   r   Ú<module>   s
   