🛠️ Redis RAG Workbench is a development playground for exploring Retrieval-Augmented Generation (RAG) techniques with Redis. Upload a PDF and begin building a RAG app to chat with the document, taking full advantage of Redis features like vector search, semantic caching, LLM memory, and semantic routing.
- Prerequisites
- Getting started
- Using Google VertexAI
- Project Structure
- Contributing
- License
- Connecting to Redis Cloud
- Troubleshooting
- Learn more
- Make sure you have the following tools available:
- Setup one or more of the following:
- OpenAI API
- You will need an API Key
- Azure OpenAI
- You will need an API Key
- Google VertexAI
- OpenAI API
- Get a Cohere API key (for optional reranking features)
Clone the repository:
git clone https://github.com/redis-developer/redis-rag-workbench.git
cd redis-rag-workbench
Copy and edit the .env
file:
cp .env.example .env
Your .env
file should contain your Redis connection string as well as necessary API keys based on which platform(s) you want to use.
Your .env.docker
file will look similar to .env
, but should use the appropriate docker internal URLs. Here is
an example:
REDIS_URL="redis://redis:6379"
To spin up docker containers:
make docker
This will start the server, and you can access the workbench by navigating to
http://localhost:8000
in your web browser.
The first time the application runs, it will have to download model weights from huggingface and may take a few minutes.
To run the server outside of docker you need to first create a .venv
:
make install && source .venv/bin/activate
From then on, you can run a dev server:
make dev
Or a production server:
make serve
Get help for all make
commands:
make
Formatting code:
make format
Cleaning up files:
make clean
The Workbench can be used with VertexAI, but requires you to set up your credentials using the gcloud
CLI. The easiest way to do this is as follows:
- Make sure you have a gcloud project setup with the VertexAI API enabled.
- Install the gcloud CLI
- Follow the instructions to run the
gcloud auth application-default login
command - Copy the JSON from the generated
application_default_credentials.json
into your.env
file using theGOOGLE_APPLICATION_CREDENTIALS
variable - Set the
GOOGLE_CLOUD_PROJECT_ID
environment variable in your.env
file to the associated gcloud project you want to use.
main.py
: The entry point of the applicationdemos/
: Contains workbench demo implementationshared_components/
: Reusable utilities and componentsstatic/
: Static assets for the web interface
🤝 Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you don't yet have a database setup in Redis Cloud get started here for free.
To connect to a Redis Cloud database, log into the console and find the following:
- The
public endpoint
(looks likeredis-#####.c###.us-east-1-#.ec2.redns.redis-cloud.com:#####
) - Your
username
(default
is the default username, otherwise find the one you setup) - Your
password
(either setup through Data Access Control, or available in theSecurity
section of the database page.
Combine the above values into a connection string and put it in your .env
and .env.docker
accordingly. It should
look something like the following:
REDIS_URL="redis://default:<password>@redis-#####.c###.us-west-2-#.ec2.redns.redis-cloud.com:#####"
If you find that docker
will not work, it's possible you need to add the following line in the Dockerfile (commented out in the Dockerfile for ease-of-use):
RUN apt-get update && apt-get install -y build-essential
To learn more about Redis, take a look at the following resources:
- Redis Documentation - learn about Redis products, features, and commands.
- Learn Redis - read tutorials, quick starts, and how-to guides for Redis.
- Redis Demo Center - watch short, technical videos about Redis products and features.