mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
ebf998acb6
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: Lance Martin <lance@langchain.dev> Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
85 lines
2.1 KiB
Plaintext
85 lines
2.1 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "681a5d1e",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Connect to template\n",
|
|
"\n",
|
|
"`Context`\n",
|
|
" \n",
|
|
"* LangServe apps gives you access to templates.\n",
|
|
"* Templates LLM pipeline (runnables or chains) end-points accessible via FastAPI.\n",
|
|
"* The environment for these templates is managed by Poetry.\n",
|
|
"\n",
|
|
"`Create app`\n",
|
|
"\n",
|
|
"* Install LangServe and create an app.\n",
|
|
"* This will create a new Poetry environment /\n",
|
|
"```\n",
|
|
"pip install < to add > \n",
|
|
"langchain serve new my-app\n",
|
|
"cd my-app\n",
|
|
"```\n",
|
|
"\n",
|
|
"`Add templates`\n",
|
|
"\n",
|
|
"* When we add a template, we update the Poetry config file with the necessary dependencies.\n",
|
|
"* It also automatically installed these template dependencies in your Poetry environment\n",
|
|
"```\n",
|
|
"langchain serve add rag-pinecone\n",
|
|
"```\n",
|
|
"\n",
|
|
"`Start FastAPI server`\n",
|
|
"\n",
|
|
"```\n",
|
|
"langchain start\n",
|
|
"```\n",
|
|
"\n",
|
|
"Note, we can now look at the endpoints:\n",
|
|
"\n",
|
|
"http://127.0.0.1:8000/docs#\n",
|
|
"\n",
|
|
"And look specifically at our loaded template:\n",
|
|
"\n",
|
|
"http://127.0.0.1:8000/docs#/default/invoke_rag_pinecone_invoke_post\n",
|
|
" \n",
|
|
"We can also use remote runnable to call it:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "d774be2a",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from langserve.client import RemoteRunnable\n",
|
|
"rag_app_pinecone = RemoteRunnable('http://localhost:8000/rag-pinecone')"
|
|
]
|
|
}
|
|
],
|
|
"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
|
|
}
|