Lesson 5 of 6
Chat with your data
7 min read
Ask a general AI about your company's refund policy and it'll guess. Point it at your own documents first, and it answers from them — with a receipt.
Answer from your docs, not its memory
A model only knows what it learned in training — not your handbook, your notes, or last week's meeting. [RAG](glossary://rag) — retrieval-augmented generation — fixes that. In n8n you feed your documents in, the agent retrieves the relevant lines when a question comes in, and answers from those — a technique called [grounding](glossary://grounding). The answer comes with a citation you can check.
Grounded, the agent quotes your document and cites the line. Ungrounded, it falls back to a vague guess from general memory.
How the docs get in
Behind the toggle is a simple pipeline. Your documents are split into chunks and turned into embeddings — a way of storing text so similar meanings sit near each other. When a question arrives, n8n finds the closest chunks and hands them to the agent as context. You wire this once; after that, every answer is grounded in your material.
RAG is retrieve-then-answer: find the relevant chunks of your text first, then let the model answer using them — so it can't just make things up.
Grounding cuts made-up answers, but it doesn't erase them — the agent can still misread a chunk. For anything that matters, click through to the cited source and check it yourself.
The shape of it
- —RAG lets an agent answer from your documents, not just its training.
- —Your docs are stored as embeddings; the relevant chunks are retrieved per question.
- —Grounded answers come with a citation you can open and verify.
You build a support agent with RAG over your help docs. A customer asks about refunds. Why is the answer trustworthy?
Continue in the app
Take the whole n8n for AI course — tracked
Get your personalized path, progress and streaks in the app — this lesson and every next one, in order.