You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/templates
Lance Martin 237026c060
Cohere re-rank template (#12378)
11 months ago
..
anthropic-functions
anthropic-iterative-search
cassandra-entomology-rag
cassandra-synonym-caching
csv-agent
elastic-query-generator
extraction-openai-functions
neo4j-cypher
neo4j-cypher-ft
neo4j-generation
neo4j-parent
openai-functions-agent
rag-chroma
rag-chroma-private
rag-conversation Add template for Pinecone + Multi-Query (#12353) 11 months ago
rag-elasticsearch
rag-fusion
rag-pinecone Add template for Pinecone + Multi-Query (#12353) 11 months ago
rag-pinecone-multi-query Update multi query template README, ntbk (#12356) 11 months ago
rag-pinecone-rerank Cohere re-rank template (#12378) 11 months ago
rag-semi-structured
rag-supabase
rewrite-retrieve-read
self-query-supabase
sql-llama2
sql-llamacpp
sql-ollama
stepback-qa-prompting
summarize-anthropic
xml-agent
.gitignore Adds linter in templates (#12321) 11 months ago
CONTRIBUTING.md add docs for templates (#12346) 11 months ago
INDEX.md add docs for templates (#12346) 11 months ago
Makefile Adds linter in templates (#12321) 11 months ago
README.md add docs for templates (#12346) 11 months ago
poetry.lock Adds linter in templates (#12321) 11 months ago
pyproject.toml Adds linter in templates (#12321) 11 months ago

README.md

LangServe Templates

Templates for a fully functioning app that can be hosted by LangServe.

Usage

To use, first install the LangChain CLI.

pip install -U langchain-cli

Then, install langserve:

pip install "langserve[all]"

Next, create a new LangChain project:

langchain serve new my-app

This will create a new directory called my-app with two folders:

  • app: This is where LangServe code will live
  • packages: This is where your chains or agents will live

To pull in an existing template as a package, you first need to go into your new project:

cd my-app

And you can the add a template as a project

langchain serve add $PROJECT_NAME

This will pull in the specified template into packages/$PROJECT_NAME

You then need to install this package so you can use it in the langserve app:

pip install -e packages/$PROJECT_NAME

We install it with -e so that if we modify the template at all (which we likely will) the changes are updated.

In order to have LangServe use this project, you then need to modify app/server.py. Specifically, you should add something like:

from fastapi import FastAPI
from langserve import add_routes
# This depends on the structure of the package you install
from my_project import chain

app = FastAPI()

add_routes(app, chain)

You can then spin up production-ready endpoints, along with a playground, by running:

python app/server.py

Adding a template

See here