langchain/templates/sql-ollama/sql-ollama.ipynb

66 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-10-27 23:34:37 +00:00
{
"cells": [
{
"cell_type": "markdown",
"id": "d55f5fd9-21eb-433d-9259-0a588d9197c0",
"metadata": {},
"source": [
"## Run Template\n",
"\n",
"In `server.py`, set -\n",
"```\n",
"add_routes(app, chain, path=\"/sql_ollama\")\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": 1,
2023-10-27 23:34:37 +00:00
"id": "50c27e82-92d8-4fa1-8bc4-b6544e59773d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"AIMessage(content=' Sure! Here\\'s the natural language response based on the input:\\n\\n\"Klay Thompson plays for the Golden State Warriors.\"')"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
2023-10-27 23:34:37 +00:00
"source": [
"from langserve.client import RemoteRunnable\n",
"sql_app = RemoteRunnable('http://0.0.0.0:8001/sql_ollama')\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
}