Quick overview
This workflow loads a document knowledge base into a Redis vector index with metadata, then runs an OpenAI-powered chat agent that answers questions by retrieving only documents the user is permitted to read using Redis metadata filters.
How it works
- Runs manually to generate a sample set of knowledge base documents with access, type, title, and publication-date metadata.
- Creates embeddings with OpenAI and stores the documents in a Redis Vector Store index with a typed metadata schema for filtering.
- Triggers when a chat message is received through the public n8n Chat interface.
- Resolves the requester’s allowed groups (for example, everyone and engineering) and attaches them to the chat session.
- Uses an OpenAI chat agent with Redis chat memory to answer the question by calling a Redis Vector Store search tool.
- Searches Redis with a mandatory access filter plus optional agent-supplied filters (document type, title keywords, and published-after date) and returns only matching passages for the agent to cite in its response.
Setup
- Add Redis credentials and ensure you have Redis 8.x (or Redis with the Redis Query Engine module) available for vector search.
- Add OpenAI credentials for both the embeddings model and the chat model, and optionally adjust the chat model selection.
- Run the manual “load documents” path once to populate the Redis index (or replace the sample documents with your own source content).
- Update the Redis index name, key prefix, and metadata schema consistently in both the insert and search steps if you change them.
- Copy the Chat trigger URL from n8n and send messages there, and replace the hardcoded group list with your own user/group lookup logic for production.