create_pbi_chat_agent#

langchain_community.agent_toolkits.powerbi.chat_base.create_pbi_chat_agent(llm: BaseChatModel, toolkit: PowerBIToolkit | None = None, powerbi: PowerBIDataset | None = None, callback_manager: BaseCallbackManager | None = None, output_parser: AgentOutputParser | None = None, prefix: str = 'Assistant is a large language model built to help users interact with a PowerBI Dataset.\n\nAssistant should try to create a correct and complete answer to the question from the user. If the user asks a question not related to the dataset it should return "This does not appear to be part of this dataset." as the answer. The user might make a mistake with the spelling of certain values, if you think that is the case, ask the user to confirm the spelling of the value and then run the query again. Unless the user specifies a specific number of examples they wish to obtain, and the results are too large, limit your query to at most {top_k} results, but make it clear when answering which field was used for the filtering. The user has access to these tables: {{tables}}.\n\nThe answer should be a complete sentence that answers the question, if multiple rows are asked find a way to write that in a easily readable format for a human, also make sure to represent numbers in readable ways, like 1M instead of 1000000. \n', suffix: str = "TOOLS\n------\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\n\n{{tools}}\n\n{format_instructions}\n\nUSER'S INPUT\n--------------------\nHere is the user's input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\n\n{{{{input}}}}\n", examples: str | None = None, input_variables: List[str] | None = None, memory: BaseChatMemory | None = None, top_k: int = 10, verbose: bool = False, agent_executor_kwargs: Dict[str, Any] | None = None, **kwargs: Any) AgentExecutor[source]#

从Chat LLM和工具构建一个Power BI代理。

如果您只提供工具包而不提供Power BI数据集,则两者使用相同的LLM。

Parameters:
  • llm (BaseChatModel) – 使用的语言模型。

  • toolkit (可选[PowerBIToolkit]) – 可选。Power BI 工具包。默认值为 None。

  • powerbi (可选[PowerBIDataset]) – 可选。Power BI 数据集。默认值为 None。

  • callback_manager (Optional[BaseCallbackManager]) – 可选。回调管理器。默认值为 None。

  • output_parser (可选[AgentOutputParser]) – 可选。输出解析器。默认为 None。

  • prefix (str) – 可选。提示的前缀。默认值为 POWERBI_CHAT_PREFIX。

  • suffix (str) – 可选。提示的后缀。默认值为 POWERBI_CHAT_SUFFIX。

  • 示例 (可选[str]) – 可选。提示的示例。默认值为 None。

  • input_variables (Optional[List[str]]) – 可选。提示的输入变量。默认为 None。

  • memory (可选[BaseChatMemory]) – 可选。内存。默认值为 None。

  • top_k (int) – 可选。提示的top k。默认值为10。

  • verbose (bool) – 可选。是否打印详细输出。默认为 False。

  • agent_executor_kwargs (Optional[Dict[str, Any]]) – 可选。代理执行器的参数。默认值为 None。

  • kwargs (Any) – 任意。额外的关键字参数。

Returns:

代理执行器。

Return type:

AgentExecutor