A language model does not know your price list or policies. Retrieval-augmented generation (RAG) fixes that by fetching the right text first.
The idea
- Split your documents into small pieces.
- Convert each piece into numbers called embeddings, which capture meaning.
- Store them in a vector store.
- When a question arrives, find the most similar pieces.
- Give those pieces to the model with the question and ask it to answer from them.
In n8n
n8n has nodes for document loading, text splitting, embeddings and several vector stores. You build one workflow to load documents and another to answer questions, often as an agent tool (agent tools).
Quality tips
- Clean documents first; messy text gives messy answers.
- Test with real questions and check the sources used.
- Tell the model to say when the answer is not in the documents.
Limits
RAG reduces wrong answers but does not remove them. Keep sensitive data safe and review outputs where it matters.
Related
Memory remembers the chat; RAG supplies knowledge.
Quick answers
What does RAG stand for?
Retrieval-augmented generation.
Do I need a vector store?
Usually yes, to find relevant text by meaning.
Does RAG remove wrong answers?
It reduces them but does not remove them.
Related reading
- What Is an AI Agent in n8n and How Is It Different from a Workflow?
- How to Build Your First AI Agent in n8n, Step by Step
- n8n AI Agent Memory Explained: How an Agent Remembers a Conversation
Prefer feedback on your own workflows?
In our live n8n classes you build workflows alongside a trainer who reviews your work. It is a practical 15-day program for beginners to advanced learners.
See the 15-day n8n training | Find your city | Book free counselling