langchain/libs/cli
2023-10-27 09:32:57 -07:00
..
langchain_cli Fix templates typos (#12428) 2023-10-27 09:32:57 -07:00
tests CLI CI 2 (#12387) 2023-10-26 17:01:31 -07:00
.gitignore CLI (#12284) 2023-10-25 11:06:58 -07:00
DOCS.md Fix templates typos (#12428) 2023-10-27 09:32:57 -07:00
Makefile CLI CI 2 (#12387) 2023-10-26 17:01:31 -07:00
poetry.lock CLI CI 2 (#12387) 2023-10-26 17:01:31 -07:00
pyproject.toml CLI CI 2 (#12387) 2023-10-26 17:01:31 -07:00
README.md Fix templates typos (#12428) 2023-10-27 09:32:57 -07:00

langchain-cli

Install CLI

pip install -U --pre langchain-cli

Create new langchain app

langchain serve new my-app

Go into app

cd my-app

Install a package

langchain serve add extraction-openai-functions

Install langserve

pip install "langserve[all]"

Install the langchain package

pip install -e packages/extraction-openai-functions

Edit app/server.py to add that package to the routes

from fastapi import FastAPI
from langserve import add_routes
from extraction_summary.chain import chain

app = FastAPI()

add_routes(app, chain)

Set env vars

export OPENAI_API_KEY=...
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
export LANGCHAIN_API_KEY="<your-api-key>"
export LANGCHAIN_PROJECT="extraction-openai-functions"

Run the app

python app/server.py