Skip to content
Clear guides. Useful tools. Sourced reporting.InfoBets Campaigns

What do you want to understand?

RAG explained: how AI searches a document library

Published: 3 min read4 views

Share this article

WhatsAppLinkedInTelegram

Three RAG stages: a document library, retrieved passages, then an answer. Check the retrieved evidence & the answer separately.
Retrieval finds material. Generation turns that material into an answer. Each stage needs checking.

RAG stands for retrieval-augmented generation. It is a way to give an AI model relevant source material when answering a question. Think of it as searching a document library before writing the answer.

In an iGaming business, that library might contain product documentation or support policies. RAG does not mean that the model automatically knows every current document, or that every answer is correct.

Three stages

  1. Prepare the library. Documents are commonly divided into smaller passages. A search index stores information that helps find those passages.
  2. Retrieve relevant passages. The system uses the question to find material likely to answer it.
  3. Generate an answer. Selected passages are supplied to the model as context. The application may also show citations back to the sources.

Some systems use embeddings: numerical representations that help search for related meaning rather than identical words. AWS’s RAG explanation describes this common document workflow. Other retrieval methods can also be used.

Finding a document is only half the job

Imagine a fictional help centre containing an April policy & its September replacement. A customer asks which documents are required to correct an account detail.

If the search returns only the April policy, the model could summarise that passage accurately while giving outdated instructions. If it retrieves the current policy but invents an additional requirement, retrieval worked while the answer failed.

These are different faults. Buying a more capable model would not, by itself, remove the outdated document from the search results.

Test retrieval & the answer separately

Check which passages were retrieved, whether they contain the necessary answer & whether the response stays within them. Google’s RAG evaluation guidance recommends representative test questions, reference answers & repeatable comparisons.

For our fictional help centre, a small test set could include:

  • A question answered by the current policy.
  • The same question phrased differently.
  • A question where an archived policy conflicts with the current one.
  • A question the library does not answer.

Write the expected source & acceptable answer before running the test. Record both retrieved material & final response. For the unanswered question, a useful outcome identifies the gap instead of inventing a policy.

What to ask about an AI document assistant

Ask how new documents enter the index, how replaced versions are handled, which documents each user can access & how incorrect answers are reported. These are application questions, not facts implied by the label “RAG”.

The practical promise is access to relevant evidence at answer time. Reliability still depends on the library, retrieval, permissions & how faithfully the answer uses that evidence.

Sources checked 14 September 2026. The help-centre example is fictional.

Related reading

Discussion

Ask a question, add useful context or share a source. Keep it relevant & respectful.

Comments are reviewed before publication.

Add a comment

Your email address will not be published. Required fields are marked .

The InfoBets Brief

A clearer view.
Once a week.

Three useful reads & one takeaway. Betting, padel & industry information, every Friday at 12:00 Madrid time. Free.

Read the Brief

We will email a confirmation link before subscribing you. Privacy policy.