Learn AI. Do. Grow.
← All modules

Deep dive · module 14 of 100

Use your own knowledge with RAG

Let AI consult relevant documents and return sources.

After this lesson

You explain how searching plus generating works and why source and access control remain necessary.

In view · How it connects

RAG: search first, then answer

  1. A search layer gets access to allowed documents.

  2. When a question is asked, relevant text passages are searched.

  3. The model uses the passages; you compare the answer with the source.

Remember: A retrieved passage is useful when it supports the conclusion. Open het volledige schema ↗

First search, then answer

Retrieval-augmented generation, briefly RAG, searches for relevant fragments from a knowledge source and provides them as context to the model. The model then formulates an answer. This is not the same as retraining the model; the quality also depends on what the search step finds.

Keep the knowledge source in order

Work with clear documents, titles, version dates, and owners. Do not allow outdated or withdrawn pieces to stand alongside the current version as an equivalent source. Through the search layer, a user should only receive documents that they themselves are permitted to read.

Keep searching back to the source

Ask for references and a notification when the answer is not in the sources. Check whether the found passage truly supports the conclusion. RAG can retrieve incorrect fragments and does not completely prevent hallucinations or prompt injection.

New practice example

From explanation to a usable result.

RAG first searches for relevant passages and uses them as a source for an answer.

Fictional practice situation

Fictitious internal manual: a meeting room can be booked a maximum of two weeks in advance. An old version mentions four weeks.

View a possible solution

This is how it can be done

Use the current manual and cite the passage about two weeks. Make it visible that the older version differs. If it is not clear which version applies, ask for confirmation first instead of choosing yourself.

Why this works

Good source selection comes before formulating. The presence of documents does not automatically make an answer current or correct.

Make it slightly more difficult

Ask a question for which the answer is not in the manual. What honest answer do you expect then?

Extra practice, at your own pace. You do not need to submit anything. This does not count towards an automatic assessment.

Read more: Google Cloud: background for RAG. The situation above is a fictional lesson example of your own.

Your workplace · learning by doing

Make something. See what changes.

Ende, your light pink practice buddy

The fictitious source is included. Only when selecting ‘Let Ende answer’ do you send your assignment to the AI service. Do not use private data.

Checking the AI connection… You can already view the written example.

Your result

No answer yet

Present your assignment to Ende.
Read the answer, change one thing, and compare.

You remain in control

What do you want to improve in your next attempt?

My own check

On this device only. AI answers remain only in this page memory. This is self-review, not a grade.

Why this approach works

Good source selection comes before formulating. The presence of documents does not automatically make an answer current or correct.

A step further

Ask a question for which the answer is not in the manual. What honest answer do you expect then?

Try & discover · no obligation

Search in a small document bank

Compare small and larger text pieces. Do you also find the exception in the answer?

Change search settings
2 pieces shown from 7. Size and overlap change what is retrieved together.
7text pieces in the search bank
0words overlap

Found text pieces (maximum three)

  1. Openingsuren2 keywords found
    o'clock. Note the exception: on Friday, the closing is at sixteen o'clock.
  2. Openingsuren1 keywords found
    The fictitious workshop is open Monday to Friday from nine to eighteen
Compare with the full original documents

Openingsuren

The fictitious workshop is open Monday to Friday from nine to eighteen o'clock. Note the exception: on Friday, the closing is at sixteen o'clock. On Saturday and Sunday, the workshop is closed.

Bezoekers

Visitors report to the reception. An appointment is required for a tour. An appointment for a visit does not change the opening hours.

Materiaal

Tools remain in the workshop. Return borrowed equipment on the agreed day. For questions about materials, speak to the manager.

Find the exception yourself: the workshop closes at sixteen o'clock on Friday. Is that information fully present in a found piece? Try 12 words with 4 words overlap.

This example ranks by exact keywords. Real embeddings and vector databases compare numerical representations; these are not performed here. A match is not proof that the entire question has been answered.

This trial works locally with fictitious data and does not count towards your lesson completion. It starts anew with a new lesson or reload.

A prompt to get you started

Answer the question solely based on the two provided fictitious procedures. Mention the document title, version, and relevant passage. Note contradictions. If the answer is missing, say "not found in the sources" and provide one targeted follow-up question. Procedures: [practice documents]. Question: [question].

Apply it

A knowledge assistant finds procedure v1 and v2. V1 mentions 10 days, v2 mentions 15 days. You do not yet know if v1 has been withdrawn.

Which approach prevents an unfounded answer?

  • Take 10 days, because that is more favourable for the user.
  • State the contradiction, check which version applies, and only then refer to the correct passage.
  • Make it an average of 12,5 days.

With JavaScript, you can check your approach and receive immediate feedback.

Test your insight

What does RAG guarantee?

  • That every answer is error-free.
  • That everyone is allowed to read all documents.
  • No error-free guarantee; searching, source quality, and answer checking remain necessary.
Extra practice

Choose three types of documents for an internal knowledge assistant. Describe how you recognise the current version, who may have access, and how you check an answer.

Sources: product FAQ, internal work instruction, and contact procedure. Each document gets an owner and version date; withdrawn versions disappear from the search index. Access follows existing team rights. I compare the main answers with the actually cited passages.

A question? I'll help you on your way.

Drag Aldo to move it. Use the arrow keys on Aldo with the keyboard, Enter to save the position and Escape to cancel.