verbose=True)smart_llm = ChatOpenAI(temperature=0, max_tokens=100, model_name="gpt-4", verbose=True)toolkit = PowerBIToolkit(    powerbi=PowerBIDataset(        dataset_id="<dataset_id>",        table_names=["table1", "table2"],        credential=DefaultAzureCredential(),    ),    llm=smart_llm,)agent_executor = create_pbi_agent(    llm=fast_llm,    toolkit=toolkit,    verbose=True,)Example: describing a table‚Äãagent_executor.run("Describe table1")Example: simple query on a table‚ÄãIn this example, the agent actually figures out the correct query to get a row count of the table.agent_executor.run("How many records are in table1?")Example: running queries‚Äãagent_executor.run("How many records are there by dimension1 in table2?")agent_executor.run("What unique values are there for dimensions2 in table2")Example: add your own few-shot prompts‚Äã# fictional examplefew_shots = """Question: How many rows are in the table revenue?DAX: EVALUATE ROW("Number of rows", COUNTROWS(revenue_details))----Question: How many rows are in the table revenue where year is not empty?DAX: EVALUATE ROW("Number of rows", COUNTROWS(FILTER(revenue_details, revenue_details[year] <> "")))----Question: What was the average of value in revenue in dollars?DAX: EVALUATE ROW("Average", AVERAGE(revenue_details[dollar_value]))----"""toolkit = PowerBIToolkit(    powerbi=PowerBIDataset(        dataset_id="<dataset_id>",        table_names=["table1", "table2"],        credential=DefaultAzureCredential(),    ),    llm=smart_llm,    examples=few_shots,)agent_executor = create_pbi_agent(    llm=fast_llm,    toolkit=toolkit,    verbose=True,)agent_executor.run("What was the maximum of value in revenue in dollars in 2022?")PreviousPlayWright BrowserNextPythonNotes:InitializationExample: describing a tableExample: simple query on a tableExample: running queriesExample: add your own few-shot promptsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
This notebook showcases an agent interacting with a Power BI Dataset. The agent is answering more general questions about a dataset, as well as recover from errors.
This notebook showcases an agent interacting with a Power BI Dataset. The agent is answering more general questions about a dataset, as well as recover from errors. ->: verbose=True)smart_llm = ChatOpenAI(temperature=0, max_tokens=100, model_name="gpt-4", verbose=True)toolkit = PowerBIToolkit(    powerbi=PowerBIDataset(        dataset_id="<dataset_id>",        table_names=["table1", "table2"],        credential=DefaultAzureCredential(),    ),    llm=smart_llm,)agent_executor = create_pbi_agent(    llm=fast_llm,    toolkit=toolkit,    verbose=True,)Example: describing a table‚Äãagent_executor.run("Describe table1")Example: simple query on a table‚ÄãIn this example, the agent actually figures out the correct query to get a row count of the table.agent_executor.run("How many records are in table1?")Example: running queries‚Äãagent_executor.run("How many records are there by dimension1 in table2?")agent_executor.run("What unique values are there for dimensions2 in table2")Example: add your own few-shot prompts‚Äã# fictional examplefew_shots = """Question: How many rows are in the table revenue?DAX: EVALUATE ROW("Number of rows", COUNTROWS(revenue_details))----Question: How many rows are in the table revenue where year is not empty?DAX: EVALUATE ROW("Number of rows", COUNTROWS(FILTER(revenue_details, revenue_details[year] <> "")))----Question: What was the average of value in revenue in dollars?DAX: EVALUATE ROW("Average", AVERAGE(revenue_details[dollar_value]))----"""toolkit = PowerBIToolkit(    powerbi=PowerBIDataset(        dataset_id="<dataset_id>",        table_names=["table1", "table2"],        credential=DefaultAzureCredential(),    ),    llm=smart_llm,    examples=few_shots,)agent_executor = create_pbi_agent(    llm=fast_llm,    toolkit=toolkit,    verbose=True,)agent_executor.run("What was the maximum of value in revenue in dollars in 2022?")PreviousPlayWright BrowserNextPythonNotes:InitializationExample: describing a tableExample: simple query on a tableExample: running queriesExample: add your own few-shot promptsCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.