Redis is an in-memory data platform with vector search, full-text search, and semantic caching capabilities, designed for real-time AI applications.This notebook shows how to use functionality related to the
RedisVectorStore.
Setup
To use theRedisVectorStore you first need to install the partner package, as well as the other packages used throughout this notebook.
Credentials
Configure your Redis connection by setting the following environment variable:rediss://) and high-availability Redis Sentinel deployments (redis+sentinel://). See the langchain-redis README for full connection options.
Set your OpenAI API key:
Initialization
The
metadata_schema parameter tells Redis which metadata fields to index. Fields not listed here cannot be used in filters. Use "tag" for categorical string values and "numeric" for numbers.Manage vector store
Add items to vector store
add_documents with LangChain Document objects:
Delete items from vector store
Query vector store
Once your vector store has been created and the relevant documents have been added you will most likely wish to query it during the running of your chain or agent.Query directly
Performing a simple similarity search can be done as follows:Similarity search with score
Similarity search with filtering
Maximum marginal relevance search
Other search methods
There are more search methods not listed in this notebook, to find all of them be sure to read theAPI reference.
Query by turning into retriever
You can also transform the vector store into a retriever for easier usage in your chains.Usage for retrieval-augmented generation
For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections: For a full RAG walkthrough usinglangchain-redis, see this example notebook.
API reference
For detailed documentation ofRedisVectorStore features and configurations head to the API reference.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

