cli updates 2 (#12447)

- extras group
- readme
- another readme

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
Erick Friis
2023-10-27 13:37:03 -07:00
committed by GitHub
parent 3afa68e30e
commit 38cee5fae0
5 changed files with 76 additions and 95 deletions

View File

@@ -1,54 +1,5 @@
# langchain-cli
Install CLI
[Docs](./DOCS.md)
`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
```markdown
from fastapi import FastAPI
from langserve import add_routes
from extraction_summary.chain import chain
app = FastAPI()
add_routes(app, chain)
```
Set env vars
```shell
export OPENAI_API_KEY=...
```
```shell
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`
[LangServe Templates Quickstart](../../templates/README.md)