|
|
|
@ -266,7 +266,7 @@
|
|
|
|
|
"metadata": {},
|
|
|
|
|
"outputs": [],
|
|
|
|
|
"source": [
|
|
|
|
|
"from langchain.chains.sql_database.base import SQLDatabaseSequentialChain"
|
|
|
|
|
"from langchain.chains import SQLDatabaseSequentialChain"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -293,14 +293,22 @@
|
|
|
|
|
"\n",
|
|
|
|
|
"\u001b[1m> Entering new SQLDatabaseSequentialChain chain...\u001b[0m\n",
|
|
|
|
|
"Table names to use:\n",
|
|
|
|
|
"\u001b[33;1m\u001b[1;3m['Employee', 'Customer']\u001b[0m\n",
|
|
|
|
|
"\u001b[33;1m\u001b[1;3m['Customer', 'Employee']\u001b[0m\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"\u001b[1m> Entering new SQLDatabaseChain chain...\u001b[0m\n",
|
|
|
|
|
"How many employees are also customers? \n",
|
|
|
|
|
"SQLQuery:\u001b[32;1m\u001b[1;3m SELECT COUNT(*) FROM Customer c INNER JOIN Employee e ON c.SupportRepId = e.EmployeeId;\u001b[0m\n",
|
|
|
|
|
"SQLResult: \u001b[33;1m\u001b[1;3m[(59,)]\u001b[0m\n",
|
|
|
|
|
"Answer:\u001b[32;1m\u001b[1;3m There are 59 employees who are also customers.\u001b[0m\n",
|
|
|
|
|
"\u001b[1m> Finished chain.\u001b[0m\n",
|
|
|
|
|
"\n",
|
|
|
|
|
"\u001b[1m> Finished chain.\u001b[0m\n"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"data": {
|
|
|
|
|
"text/plain": [
|
|
|
|
|
"' 0 employees are also customers.'"
|
|
|
|
|
"' There are 59 employees who are also customers.'"
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
"execution_count": 5,
|
|
|
|
|