|
|
@ -55,14 +55,16 @@
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"outputs": [],
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"llm = AzureOpenAI(temperature=0, deployment_name=\"text-davinci-003\", verbose=True)\n",
|
|
|
|
"fast_llm = AzureOpenAI(temperature=0.5, max_tokens=1000, deployment_name=\"gpt-35-turbo\", verbose=True)\n",
|
|
|
|
|
|
|
|
"smart_llm = AzureOpenAI(temperature=0, max_tokens=100, deployment_name=\"gpt-4\", verbose=True)\n",
|
|
|
|
|
|
|
|
"\n",
|
|
|
|
"toolkit = PowerBIToolkit(\n",
|
|
|
|
"toolkit = PowerBIToolkit(\n",
|
|
|
|
" powerbi=PowerBIDataset(None, \"<dataset_id>\", ['table1', 'table2'], DefaultAzureCredential()), \n",
|
|
|
|
" powerbi=PowerBIDataset(dataset_id=\"<dataset_id>\", table_names=['table1', 'table2'], credential=DefaultAzureCredential()), \n",
|
|
|
|
" llm=llm\n",
|
|
|
|
" llm=smart_llm\n",
|
|
|
|
")\n",
|
|
|
|
")\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"agent_executor = create_pbi_agent(\n",
|
|
|
|
"agent_executor = create_pbi_agent(\n",
|
|
|
|
" llm=llm,\n",
|
|
|
|
" llm=fast_llm,\n",
|
|
|
|
" toolkit=toolkit,\n",
|
|
|
|
" toolkit=toolkit,\n",
|
|
|
|
" verbose=True,\n",
|
|
|
|
" verbose=True,\n",
|
|
|
|
")"
|
|
|
|
")"
|
|
|
@ -141,6 +143,56 @@
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"agent_executor.run(\"What unique values are there for dimensions2 in table2\")"
|
|
|
|
"agent_executor.run(\"What unique values are there for dimensions2 in table2\")"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"attachments": {},
|
|
|
|
|
|
|
|
"cell_type": "markdown",
|
|
|
|
|
|
|
|
"id": "6fd950e4",
|
|
|
|
|
|
|
|
"metadata": {},
|
|
|
|
|
|
|
|
"source": [
|
|
|
|
|
|
|
|
"## Example: add your own few-shot prompts"
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
|
|
|
"id": "87d677f9",
|
|
|
|
|
|
|
|
"metadata": {},
|
|
|
|
|
|
|
|
"outputs": [],
|
|
|
|
|
|
|
|
"source": [
|
|
|
|
|
|
|
|
"#fictional example\n",
|
|
|
|
|
|
|
|
"few_shots = \"\"\"\n",
|
|
|
|
|
|
|
|
"Question: How many rows are in the table revenue?\n",
|
|
|
|
|
|
|
|
"DAX: EVALUATE ROW(\"Number of rows\", COUNTROWS(revenue_details))\n",
|
|
|
|
|
|
|
|
"----\n",
|
|
|
|
|
|
|
|
"Question: How many rows are in the table revenue where year is not empty?\n",
|
|
|
|
|
|
|
|
"DAX: EVALUATE ROW(\"Number of rows\", COUNTROWS(FILTER(revenue_details, revenue_details[year] <> \"\")))\n",
|
|
|
|
|
|
|
|
"----\n",
|
|
|
|
|
|
|
|
"Question: What was the average of value in revenue in dollars?\n",
|
|
|
|
|
|
|
|
"DAX: EVALUATE ROW(\"Average\", AVERAGE(revenue_details[dollar_value]))\n",
|
|
|
|
|
|
|
|
"----\n",
|
|
|
|
|
|
|
|
"\"\"\"\n",
|
|
|
|
|
|
|
|
"toolkit = PowerBIToolkit(\n",
|
|
|
|
|
|
|
|
" powerbi=PowerBIDataset(dataset_id=\"<dataset_id>\", table_names=['table1', 'table2'], credential=DefaultAzureCredential()), \n",
|
|
|
|
|
|
|
|
" llm=smart_llm,\n",
|
|
|
|
|
|
|
|
" examples=few_shots,\n",
|
|
|
|
|
|
|
|
")\n",
|
|
|
|
|
|
|
|
"agent_executor = create_pbi_agent(\n",
|
|
|
|
|
|
|
|
" llm=fast_llm,\n",
|
|
|
|
|
|
|
|
" toolkit=toolkit,\n",
|
|
|
|
|
|
|
|
" verbose=True,\n",
|
|
|
|
|
|
|
|
")"
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"cell_type": "code",
|
|
|
|
|
|
|
|
"execution_count": null,
|
|
|
|
|
|
|
|
"id": "33f4bb43",
|
|
|
|
|
|
|
|
"metadata": {},
|
|
|
|
|
|
|
|
"outputs": [],
|
|
|
|
|
|
|
|
"source": [
|
|
|
|
|
|
|
|
"agent_executor.run(\"What was the maximum of value in revenue in dollars in 2022?\")"
|
|
|
|
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"metadata": {
|
|
|
|