"LangChain makes it easy to build diverse chains from building blocks.\n",
"[LangChain Expression Langugae (LCEL)](https://python.langchain.com/docs/expression_language/) makes it easy to build diverse chains \"from scratch.\"\n",
"# Set the system_prompt so that LLaMA will generate only the SQL statement, instead of being wordy and adding something like\n",
"# \"Sure! Here's the SQL query for the given input question: \" before the SQL query; otherwise custom parsing will be needed.\n",
"llm = Replicate(\n",
"llm = Replicate(\n",
" model=llama2_13b_chat,\n",
" model=llama2_13b_chat,\n",
" input={\"temperature\": 0.01, \n",
" input={\"temperature\": 0.01, \n",
@ -87,12 +86,14 @@
"source": [
"source": [
"## DB\n",
"## DB\n",
"\n",
"\n",
"Connect to a SQLite DB."
"Connect to a SQLite DB.\n",
"\n",
"To create this particular DB, you can use the code and follow the steps shown [here](https://github.com/facebookresearch/llama-recipes/blob/main/demo_apps/StructuredLlama.ipynb)."
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 28,
"execution_count": 2,
"id": "025bdd82-3bb1-4948-bc7c-c3ccd94fd05c",
"id": "025bdd82-3bb1-4948-bc7c-c3ccd94fd05c",
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
@ -119,7 +120,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 72,
"execution_count": 3,
"id": "5a4933ea-d9c0-4b0a-8177-ba4490c6532b",
"id": "5a4933ea-d9c0-4b0a-8177-ba4490c6532b",
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
@ -129,7 +130,7 @@
"\" SELECT * FROM nba_roster WHERE NAME = 'Klay Thompson';\""
"\" SELECT * FROM nba_roster WHERE NAME = 'Klay Thompson';\""