
    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
 ddlmZ ddlmZmZ ddlmZ ddlmZ erdd	lmZ dd
lmZ ddlmZ ddddeeddddddf	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)zPower BI agent.    )annotations)TYPE_CHECKINGAnyDictListOptional)BaseCallbackManager)BaseChatModel)POWERBI_CHAT_PREFIXPOWERBI_CHAT_SUFFIX)PowerBIToolkit)PowerBIDatasetAgentExecutor)AgentOutputParser)BaseChatMemoryN
   Fc                   ddl m} ddlm} ddlm} ||t        d      t        || |      }|j                         }|r|j                  n|j                  j                  } |j                  d| ||j                  |
      j                  |      |||||d	|} |j                  d||||	xs
  |d
d      |d|xs i S )a  Construct a Power BI agent from a Chat LLM and tools.

    If you supply only a toolkit and no Power BI dataset, the same LLM is used for both.

    Args:
        llm: The language model to use.
        toolkit: Optional. The Power BI toolkit. Default is None.
        powerbi: Optional. The Power BI dataset. Default is None.
        callback_manager: Optional. The callback manager. Default is None.
        output_parser: Optional. The output parser. Default is None.
        prefix: Optional. The prefix for the prompt. Default is POWERBI_CHAT_PREFIX.
        suffix: Optional. The suffix for the prompt. Default is POWERBI_CHAT_SUFFIX.
        examples: Optional. The examples for the prompt. Default is None.
        input_variables: Optional. The input variables for the prompt. Default is None.
        memory: Optional. The memory. Default is None.
        top_k: Optional. The top k for the prompt. Default is 10.
        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   )ConversationalChatAgent)ConversationBufferMemoryz0Must provide either a toolkit or powerbi dataset)powerbillmexamples)top_k)tables)r   toolssystem_messagehuman_messageinput_variablescallback_manageroutput_parserverbosechat_historyT)
memory_keyreturn_messages)agentr   r    memoryr"    )langchain_classic.agentsr   1langchain_classic.agents.conversational_chat.baser   langchain_classic.memoryr   
ValueErrorr   	get_toolstable_namesr   from_llm_and_toolsformatfrom_agent_and_tools)r   toolkitr   r    r!   prefixsuffixr   r   r'   r   r"   agent_executor_kwargskwargsr   r   r   r   r   r&   s                       r/var/www/auto_recruiter/arenv/lib/python3.12/site-packages/langchain_community/agent_toolkits/powerbi/chat_base.pycreate_pbi_chat_agentr8      s    N 7 B?OPP cHME$+W  1L1LF6#66 
}}5}1888G')#
 
E .=-- ) U#~tT !&B     )r   r
   r2   zOptional[PowerBIToolkit]r   zOptional[PowerBIDataset]r    zOptional[BaseCallbackManager]r!   zOptional[AgentOutputParser]r3   strr4   r:   r   zOptional[str]r   zOptional[List[str]]r'   zOptional[BaseChatMemory]r   intr"   boolr5   zOptional[Dict[str, Any]]r6   r   returnr   )__doc__
__future__r   typingr   r   r   r   r   langchain_core.callbacksr	   *langchain_core.language_models.chat_modelsr
   1langchain_community.agent_toolkits.powerbi.promptr   r   2langchain_community.agent_toolkits.powerbi.toolkitr   %langchain_community.utilities.powerbir   r)   r   langchain_classic.agents.agentr   $langchain_classic.memory.chat_memoryr   r8   r(   r9   r7   <module>rH      s     " ; ; 8 D N @6@C
 )-(,6:15%%"+/'+6:F	F%F &F 4	F
 /F F F F )F %F F F 4F F Fr9   