o
    €j6h  ã                   @  s`   d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z
 G dd„ dejƒZG d	d
„ d
ƒZdS )z=Maintains set of LLM models that can be instantiated by name.é    )ÚannotationsN)ÚCallable)Ú
text_model)Úmodelc                   @  s   e Zd ZdZdZdS )Ú	ModelNameÚechoÚtextN)Ú__name__Ú
__module__Ú__qualname__Ú
ECHO_MODELÚ
TEXT_MODEL© r   r   úz/var/www/html/chefvision.cloud.itp360.com/venv/lib/python3.10/site-packages/google/generativeai/notebook/model_registry.pyr      s    r   c                   @  s(   e Zd ZdZejZdd„ Zddd	„Zd
S )ÚModelRegistryz-Registry that instantiates and caches models.c                 C  s    i | _ tjtjtjtji| _d S )N)	Ú_model_cacher   r   Ú	model_libÚ	EchoModelr   r   Ú	TextModelÚ_model_constructors)Úselfr   r   r   Ú__init__#   s   
þzModelRegistry.__init__Ú
model_namer   Úreturnúmodel_lib.AbstractModelc                 C  s&   || j vr| j| ƒ | j |< | j | S )a  Given `model_name`, return the corresponding Model instance.

        Model instances are cached and reused for the same `model_name`.

        Args:
          model_name: The name of the model.

        Returns:
          The corresponding model instance for `model_name`.
        )r   r   )r   r   r   r   r   Ú	get_model*   s   

zModelRegistry.get_modelN)r   r   r   r   )	r	   r
   r   Ú__doc__r   r   ÚDEFAULT_MODELr   r   r   r   r   r   r      s
    r   )r   Ú
__future__r   ÚenumÚtypingr   Úgoogle.generativeai.notebookr   Ú google.generativeai.notebook.libr   r   ÚEnumr   r   r   r   r   r   Ú<module>   s   