docs/providers/redis/setup.md
Redis is a real-time data platform that supports a variety of use cases for everyday applications as well as AI/ML workloads. Use Redis as a low-latency vector engine by creating a Redis database with the Redis Stack docker container. For a hosted/managed solution, try Redis Cloud. See more helpful examples of Redis as a vector database here.
docker compose up -d in this dir.Environment Variables:
| Name | Required | Description | Default |
|---|---|---|---|
DATASTORE | Yes | Datastore name, set to redis | |
BEARER_TOKEN | Yes | Secret token | |
OPENAI_API_KEY | Yes | OpenAI API key | |
REDIS_HOST | Optional | Redis host url | localhost |
REDIS_PORT | Optional | Redis port | 6379 |
REDIS_PASSWORD | Optional | Redis password | none |
REDIS_INDEX_NAME | Optional | Redis vector index name | index |
REDIS_DOC_PREFIX | Optional | Redis key prefix for the index | doc |
REDIS_DISTANCE_METRIC | Optional | Vector similarity distance metric | COSINE |
REDIS_INDEX_TYPE | Optional | Vector index algorithm type | FLAT |
In order to test your changes to the Redis Datastore, you can run the following commands:
# Run the Redis stack docker image
docker run -it --rm -p 6379:6379 redis/redis-stack-server:latest
# Run the Redis datastore tests
poetry run pytest -s ./tests/datastore/providers/redis/test_redis_datastore.py