
    3fi                        d Z ddlmZ ddlmZmZmZmZmZ ddl	m
Z
mZ ddlmZ ddlmZmZ ddlmZ erddlmZ d	d	eed	d	d
dd	ddd	f	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy	)zSpark SQL agent.    )annotations)TYPE_CHECKINGAnyDictListOptional)BaseCallbackManager	Callbacks)BaseLanguageModel)
SQL_PREFIX
SQL_SUFFIX)SparkSQLToolkitAgentExecutorN
      forceFc                P   ddl m} ddlm} ddlm} |j                         }|j                  |      }|d|ini } |j                  |f|||d|} || |||      }|D cg c]  }|j                   }} |d||d	|} |j                  d||||||	|
|d
|xs i S c c}w )a  Construct a Spark SQL agent from an LLM and tools.

    Args:
        llm: The language model to use.
        toolkit: The Spark SQL toolkit.
        callback_manager: Optional. The callback manager. Default is None.
        callbacks: Optional. The callbacks. Default is None.
        prefix: Optional. The prefix for the prompt. Default is SQL_PREFIX.
        suffix: Optional. The suffix for the prompt. Default is SQL_SUFFIX.
        format_instructions: Optional. The format instructions for the prompt.
            Default is None.
        input_variables: Optional. The input variables for the prompt. Default is None.
        top_k: Optional. The top k for the prompt. Default is 10.
        max_iterations: Optional. The maximum iterations to run. Default is 15.
        max_execution_time: Optional. The maximum execution time. Default is None.
        early_stopping_method: Optional. The early stopping method. Default is "force".
        verbose: Optional. Whether to print verbose output. Default is False.
        agent_executor_kwargs: Optional. The agent executor kwargs. Default is None.
        kwargs: Any. Additional keyword arguments.

    Returns:
        The agent executor.
    r   r   )ZeroShotAgent)LLMChain)top_kformat_instructions)prefixsuffixinput_variables)llmpromptcallback_manager	callbacks)	llm_chainallowed_tools)agenttoolsr   r   verbosemax_iterationsmax_execution_timeearly_stopping_method )langchain_classic.agents.agentr   "langchain_classic.agents.mrkl.baser   langchain_classic.chains.llmr   	get_toolsformatcreate_promptnamefrom_agent_and_tools)r   toolkitr   r   r   r   r   r   r   r%   r&   r'   r$   agent_executor_kwargskwargsr   r   r   r#   prompt_paramsr   r    tool
tool_namesr"   s                            o/var/www/auto_recruiter/arenv/lib/python3.12/site-packages/langchain_community/agent_toolkits/spark_sql/base.pycreate_spark_sql_agentr8      s   P =@5E]]]'F * 
 34 
 )](('	
 F )	I )..$)).J.RIZR6RE-=-- 
)%-3
 !&B
 
 /s   $B#) r   r   r1   r   r   zOptional[BaseCallbackManager]r   r
   r   strr   r9   r   zOptional[str]r   zOptional[List[str]]r   intr%   zOptional[int]r&   zOptional[float]r'   r9   r$   boolr2   zOptional[Dict[str, Any]]r3   r   returnr   )__doc__
__future__r   typingr   r   r   r   r   langchain_core.callbacksr	   r
   langchain_core.language_modelsr   3langchain_community.agent_toolkits.spark_sql.promptr   r   4langchain_community.agent_toolkits.spark_sql.toolkitr   r)   r   r8   r(       r7   <module>rE      s     " ; ; C < V P< 7;)-+/$&*.!(6:L	LL 4L 	L
 L L 'L )L L "L (L L L 4L L  !LrD   