langchain/templates/sql-llama2/sql_llama2.ipynb
2023-10-29 15:50:09 -07:00

67 lines
1.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "22f3f9f9-80ee-4da1-ba12-105a0ce74203",
"metadata": {},
"source": [
"## Run Template\n",
"\n",
"In `server.py`, set -\n",
"```\n",
"add_routes(app, chain, path=\"/sql_llama2\")\n",
"```\n",
"\n",
"This template includes an example DB of 2023 NBA rosters.\n",
"\n",
"We can ask questions related to NBA players. "
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "4545c603-77ec-4c15-b9c0-a70529eebed0",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\" Sure thing! Here's the natural language response based on the given SQL query and response:\\n\\nKlay Thompson plays for the Golden State Warriors.\""
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from langserve.client import RemoteRunnable\n",
"\n",
"sql_app = RemoteRunnable(\"http://0.0.0.0:8001/sql_llama2\")\n",
"sql_app.invoke({\"question\": \"What team is Klay Thompson on?\"})"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 5
}