o
    Zh=	                     @  s   d 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 G dd dejZdS )zThe compile command.    )annotations)Sequence)command)command_utils)ipython_env)model_registry)parsed_args_lib)post_process_utils)py_utilsc                      s:   e Zd ZdZ	dd fddZdddZdddZ  ZS )CompileCommandz(Implementation of the "compile" command.Nmodelsmodel_registry.ModelRegistryenvipython_env.IPythonEnv | Nonec                   s   t    || _|| _dS )zyConstructor.

        Args:
          models: ModelRegistry instance.
          env: The IPythonEnv environment.
        N)super__init___models_ipython_env)selfr   r   	__class__ _/var/www/html/lang_env/lib/python3.10/site-packages/google/generativeai/notebook/compile_cmd.pyr      s   

zCompileCommand.__init__parsed_argsparsed_args_lib.ParsedArgscell_contentstrpost_processing_fns2Sequence[post_process_utils.ParsedPostProcessExpr]returnc                 C  s2   t j| j| j|||d}t|j| d|jS )N)r   r   r   r   r   z%Saved function to Python variable: {})r   Zcreate_llm_functionr   r   r
   Z
set_py_varZcompile_save_nameformat)r   r   r   r   Zllm_fnr   r   r   execute.   s   zCompileCommand.executetokensSequence[Sequence[str]]c                 C  s
   t |S N)r	   Zresolve_post_processing_tokens)r   r"   r   r   r   parse_post_processing_tokens?   s   
z+CompileCommand.parse_post_processing_tokensr$   )r   r   r   r   )r   r   r   r   r   r   r   r   )r"   r#   r   r   )__name__
__module____qualname____doc__r   r!   r%   __classcell__r   r   r   r   r      s    
r   N)r)   
__future__r   typingr   Zgoogle.generativeai.notebookr   r   r   r   r   r	   r
   Commandr   r   r   r   r   <module>   s   