Toggle Menu
Prev Up Next

# `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

  Construct a Power BI agent from an LLM and tools.

  Parameters

    - llm (BaseLanguageModel) –

    - toolkit (Optional[PowerBIToolkit]) –

    - powerbi (Optional[PowerBIDataset]) –

    - callback_manager (Optional[BaseCallbackManager]) –

    - prefix (str) –

    - suffix (str) –

    - format_instructions (Optional[str]) –

    - examples (Optional[str]) –

    - input_variables (Optional[List[str]]) –

    - top_k (int) –

    - verbose (bool) –

    - agent_executor_kwargs (Optional[Dict[str, Any]]) –

    - kwargs (Any) –

  Return type

    AgentExecutor

# Examples using create_pbi_agent

- fictional example