"Thought:\u001b[32;1m\u001b[1;3m I now know the final answer\n",
"Final Answer: We had 450.58 sales and 450.58 revenue in 2013\u001b[0m\n",
"\u001b[1m> Finished chain.\u001b[0m\n"
]
},
{
"data": {
"text/plain": [
"'We had 450.58 sales and 450.58 revenue in 2013'"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mrkl.run(\"What was our total number of sales and total revenue in 2013?\")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "4e9c9b23",
"metadata": {},
"outputs": [],
"source": [
"from langchain.agents import ZeroShotAgent\n",
"from langchain import PromptTemplate\n",
"from langchain import LLMChain\n",
"TEMPLATE = \"\"\"You are a data engineer answering questions using a SQL database.\n",
"\n",
"Given an input question, first create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer. If a previous query produced an error, do NOT try it again.\n",
"\n",
"Only use the following tables:\n",
"\n",
"{table_info}\n",
"\n",
"Use the following format:\n",
"\n",
"Question: the input question you must answer\n",
"Thought: you should always think about what to do\n",
"Action: SQLDB\n",
"Action Input: the query to run against the SQL database\n",
"Observation: the result of the action\n",
"... (this Thought/Action/Action Input/Observation can repeat N times)\n",
"Thought: I now know the final answer\n",
"Final Answer: the final answer to the original input question\n",