langchain_community.agent_toolkits.powerbi.base.create_pbi_agent

langchain_community.agent_toolkits.powerbi.base.create_pbi_agent(llm: BaseLanguageModel, toolkit: Optional[PowerBIToolkit] = None, powerbi: Optional[PowerBIDataset] = None, callback_manager: Optional[BaseCallbackManager] = None, prefix: str = 'You are an agent designed to help users interact with a PowerBI Dataset.\n\nAgent has access to a tool that can write a query based on the question and then run those against PowerBI, Microsofts business intelligence tool. The questions from the users should be interpreted as related to the dataset that is available and not general questions about the world. If the question does not seem related to the dataset, return "This does not appear to be part of this dataset." as the answer.\n\nGiven an input question, ask to run the questions against the dataset, then look at the results and return the answer, the 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. Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results.\n', suffix: str = 'Begin!\n\nQuestion: {input}\nThought: I can first ask which tables I have, then how each table is defined and then ask the query tool the question I need, and finally create a nice sentence that answers the question.\n{agent_scratchpad}', format_instructions: Optional[str] = None, examples: Optional[str] = None, input_variables: Optional[List[str]] = None, top_k: int = 10, verbose: bool = False, agent_executor_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Any) AgentExecutor[source]

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

参数
  • llm (BaseLanguageModel) - 要使用的语言模型。

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

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

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

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

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

  • format_instructions (可选[str]) – 可选。提示的格式说明。默认值为 None。

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

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

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

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

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

  • kwargs (Any) – 任何。附加关键字参数。

返回值

代理执行器。

返回类型

AgentExecutor

使用 create_pbi_agent 的示例