Module 3 · Your data

Talking to documents: RAG in plain language

Lesson 7 of 15 9 min lesson Updated on October 30, 2026
Progress in the course47%

In this lesson

RAG is the AI taking an open-book exam. It looks through your material before it answers.

You will understand how the AI answers based on your documents, without training anything, and how to check whether it got it right.

The open-book exam

Picture an exam where you are allowed to look at your notebook. Before answering, you find the right page. Then you write the answer in your own words and point to the page.

RAG does the same. The name means, roughly, "generation with search". There are three steps:

  1. The documents are cut into small pieces, and each piece gets a "fingerprint" that represents what it is about.
  2. When you ask a question, the system finds the pieces most similar to it.
  3. The model receives the question plus those pieces and writes the answer, pointing to where it came from.

Notice: the model did not learn anything new. It just read the right material at that moment.

Why this is good

You replace a document and the answer changes the same day, with no training. You can check it, because the answer comes with the passage. And the document stays on your machine.

Picture a real estate agency that uploaded its contract templates and internal rules. Now an agent asks "what is the notice period for termination?" and gets the right clause, with the file name.

How to use it with ready-made tools

In Open WebUI you create a collection of documents and attach it to the conversation. No programming needed. Start small: three documents, five questions.

Test the question with no answer

The most important test is asking something that is not written anywhere. The right behavior is for the AI to say "I did not find it in the documents". If it makes something up, adjust the fixed instructions and test again. A RAG that never says "I don't know" is dangerous, because it looks reliable.

When RAG is not the answer

RAG is good at finding one fact among many documents. It is bad at adding up numbers from spreadsheets or comparing a hundred contracts at once. There are other tools for that. Choose by the problem, not by the trend.

Also, do not expect it to cover what the document does not say. If the contract says nothing about a penalty, the AI must not invent one. The system's job is to find, not to guess.

A complete example

Picture a building supplies store that uploaded its catalog and its return policy. The salesperson asks: "customer wants to return an opened bag of cement, is that allowed?". The AI finds the passage in the policy about opened products, answers "no, only sealed packaging within seven days" and shows the file it took that from. The salesperson checks it in ten seconds and answers the customer with confidence.

Without RAG, the same question would get a generic answer, written with the same confidence, but about the policy of some other store.

What the pros know

When the system hands many passages to the model, position matters. A 2023 study showed that models make better use of information at the beginning or at the end of the text and worse use of what sits in the middle, even models built for long texts. So when the right answer was among the passages and the reply still came out wrong, it is worth testing a different number of passages and a different order.

Practice · 10 min

  1. Upload three test documents, with no real data, to an Open WebUI collection.
  2. Ask five questions and check the passage cited in each one.
  3. Ask something that is not in the documents and see whether it admits it did not find it.

Summary

Sources

Read on October 30, 2026.

  1. Liu et al. Lost in the Middle: models make better use of information at the beginning or at the end of a long input (2023).

Lesson quiz

Three situations to apply what you learned.

Lesson 7 of 15

Before moving on to the next lesson

Put what you saw into practice. The boxes stay checked in this browser, so you can come back later.

Have a question about this lesson? The IV Help team answers personally on WhatsApp.

Ask on WhatsApp