mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-31 03:59:25 +00:00
templates[patch]: Rag redis template dependency update (#13614)
- **Description:** Update RAG Redis template readme and dependencies.
This commit is contained in:
parent
a14cf87576
commit
dc31714ec5
@ -1,15 +1,19 @@
|
||||
|
||||
# rag-redis
|
||||
|
||||
This template performs RAG using Redis and OpenAI on financial 10k filings docs (for Nike).
|
||||
This template performs RAG using Redis (vector database) and OpenAI (LLM) on financial 10k filings docs for Nike.
|
||||
|
||||
It relies on the sentence transformer `all-MiniLM-L6-v2` for embedding chunks of the pdf and user questions.
|
||||
|
||||
## Environment Setup
|
||||
|
||||
Set the `OPENAI_API_KEY` environment variable to access the OpenAI models.
|
||||
Set the `OPENAI_API_KEY` environment variable to access the [OpenAI](https://platform.openai.com) models:
|
||||
|
||||
The following Redis environment variables need to be set:
|
||||
```bash
|
||||
export OPENAI_API_KEY= <YOUR OPENAI API KEY>
|
||||
```
|
||||
|
||||
Set the following [Redis](https://redis.com/try-free) environment variables:
|
||||
|
||||
```bash
|
||||
export REDIS_HOST = <YOUR REDIS HOST>
|
||||
@ -33,10 +37,10 @@ We use a variety of environment variables to configure this application
|
||||
|
||||
## Usage
|
||||
|
||||
To use this package, you should first have the LangChain CLI installed:
|
||||
To use this package, you should first have the LangChain CLI and Pydantic installed in a Python virtual environment:
|
||||
|
||||
```shell
|
||||
pip install -U langchain-cli
|
||||
pip install -U langchain-cli pydantic==1.10.13
|
||||
```
|
||||
|
||||
To create a new LangChain project and install this as the only package, you can do:
|
||||
@ -46,21 +50,20 @@ langchain app new my-app --package rag-redis
|
||||
```
|
||||
|
||||
If you want to add this to an existing project, you can just run:
|
||||
|
||||
```shell
|
||||
langchain app add rag-redis
|
||||
```
|
||||
|
||||
And add the following code to your `server.py` file:
|
||||
And add the following code snippet to your `app/server.py` file:
|
||||
```python
|
||||
from rag_redis.chain import chain as rag_redis_chain
|
||||
|
||||
add_routes(app, rag_redis_chain, path="/rag-redis")
|
||||
```
|
||||
|
||||
(Optional) Let's now configure LangSmith.
|
||||
LangSmith will help us trace, monitor and debug LangChain applications.
|
||||
LangSmith is currently in private beta, you can sign up [here](https://smith.langchain.com/).
|
||||
(Optional) Let's now configure LangSmith.
|
||||
LangSmith will help us trace, monitor and debug LangChain applications.
|
||||
LangSmith is currently in private beta, you can sign up [here](https://smith.langchain.com/).
|
||||
If you don't have access, you can skip this section
|
||||
|
||||
|
||||
@ -76,11 +79,11 @@ If you are inside this directory, then you can spin up a LangServe instance dire
|
||||
langchain serve
|
||||
```
|
||||
|
||||
This will start the FastAPI app with a server is running locally at
|
||||
This will start the FastAPI app with a server is running locally at
|
||||
[http://localhost:8000](http://localhost:8000)
|
||||
|
||||
We can see all templates at [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs)
|
||||
We can access the playground at [http://127.0.0.1:8000/rag-redis/playground](http://127.0.0.1:8000/rag-redis/playground)
|
||||
We can access the playground at [http://127.0.0.1:8000/rag-redis/playground](http://127.0.0.1:8000/rag-redis/playground)
|
||||
|
||||
We can access the template from code with:
|
||||
|
||||
|
@ -36,7 +36,7 @@ export_attr = "chain"
|
||||
[tool.templates-hub]
|
||||
use-case = "rag"
|
||||
author = "Redis"
|
||||
integrations = ["OpenAI", "Redis"]
|
||||
integrations = ["OpenAI", "Redis", "HuggingFace"]
|
||||
tags = ["vectordbs"]
|
||||
|
||||
[tool.poe.tasks.start]
|
||||
|
Loading…
Reference in New Issue
Block a user