Redis
Perform similarity searches with in-memory or persistent Redis storage
Uses Redis Stack via the redisvl library for vector similarity search.
Installation
Note
The Redis instance started bydapr init is a vanilla Redis server and does not include the Search/vector modules required by Redis Stack. To use RedisVectorStore, you must run Redis Stack (or a Redis deployment with the RediSearch module enabled) separately.pip install redisvl
uv add redisvl
Usage
from dapr_agents.storage.vectorstores import RedisVectorStore
from dapr_agents.document.embedder.openai import OpenAIEmbedder # Replace with your embedding model
store = RedisVectorStore(
url="redis://localhost:6379",
index_name="my_agent",
embedding_function=OpenAIEmbedder(),
embedding_dimensions=1536,
distance_metric="cosine", # "cosine", "l2", or "ip"
storage_type="hash", # "hash" or "json"
)