
    rh=	                        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ej                        Zy)zThe compile command.    )annotations)Sequence)command)command_utils)ipython_env)model_registry)parsed_args_lib)post_process_utils)py_utilsc                  V     e Zd ZdZ	 d	 	 	 d fdZ	 	 	 	 	 	 	 	 ddZ	 	 	 	 ddZ xZS )	CompileCommandz(Implementation of the "compile" command.c                >    t         |           || _        || _        y)zyConstructor.

        Args:
          models: ModelRegistry instance.
          env: The IPythonEnv environment.
        N)super__init___models_ipython_env)selfmodelsenv	__class__s      {/var/www/html/ai-insurance-compliance-backend/venv/lib/python3.12/site-packages/google/generativeai/notebook/compile_cmd.pyr   zCompileCommand.__init__   s     	    c                    t        j                  | j                  | j                  |||      }t	        j
                  |j                  |       dj                  |j                        S )N)r   r   parsed_argscell_contentpost_processing_fnsz%Saved function to Python variable: {})r   create_llm_functionr   r   r   
set_py_varcompile_save_nameformat)r   r   r   r   llm_fns        r   executezCompileCommand.execute.   s\     22<<!!#% 3
 	K996B6==k>[>[\\r   c                ,    t        j                  |      S N)r
   resolve_post_processing_tokens)r   tokenss     r   parse_post_processing_tokensz+CompileCommand.parse_post_processing_tokens?   s     "@@HHr   r$   )r   zmodel_registry.ModelRegistryr   zipython_env.IPythonEnv | None)r   zparsed_args_lib.ParsedArgsr   strr   2Sequence[post_process_utils.ParsedPostProcessExpr]returnr(   )r&   zSequence[Sequence[str]]r*   r)   )__name__
__module____qualname____doc__r   r"   r'   __classcell__)r   s   @r   r   r      sk    2
 .2 ,  + ]/] ] P	]
 
]"I-I	;Ir   r   N)r.   
__future__r   typingr   google.generativeai.notebookr   r   r   r   r	   r
   r   Commandr    r   r   <module>r5      s7     "  0 6 4 7 8 ; 1&IW__ &Ir   