Skip to content

Commit

Permalink
templates[patch]: Rag redis template dependency update (#13614)
Browse files Browse the repository at this point in the history
- **Description:** Update RAG Redis template readme and dependencies.
  • Loading branch information
tylerhutcherson committed Nov 30, 2023
1 parent a14cf87 commit dc31714
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions templates/rag-redis/README.md
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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:
Expand All @@ -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


Expand All @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion templates/rag-redis/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit dc31714

Please sign in to comment.