AI development · Document search
What Is Retrieval-Augmented Generation (RAG)?
Retrieve → Augment → Generate → Verify
Learn how a RAG system searches documents and uses evidence to answer questions. Build a simple Python retriever, connect an optional local AI model and test what happens when information is missing.
Inside a RAG answer
Quick answer
What does RAG do?
Retrieval-augmented generation (RAG) finds relevant information outside a language model, adds that information to the question and asks the model to generate a response grounded in the retrieved passages. Retrieval alone is not the complete RAG pipeline. This lesson shows both stages and how to check the result.
Retrieval-augmented generation (RAG) is a way for an AI application to search external information before generating an answer. The application retrieves relevant document passages, adds them to a language model’s prompt and asks for a response supported by those passages. The model can still make mistakes: the cited text is evidence to check, not a guarantee of accuracy. [1] [2]
Here is the problem we will solve. A fictional technology training centre has separate documents for equipment loans, workshop times and laboratory rules. Someone asks: “When must borrowed laptops be returned on Fridays?” The search program should select the equipment-loan rule—not a vaguely related workshop notice—and show exactly where the time came from.
This article first explains the process using simple language, then walks through a Python project. You can reproduce retrieval without installing an AI model or buying an API subscription . The optional generation stage connects retrieved evidence to a separately installed local language model. Every institution, timetable and policy in the exercise is invented for teaching; none is an NIT policy.
What is retrieval-augmented generation (RAG)?
RAG has two cooperating parts: a retriever that looks up relevant material and a generator that explains what the retrieved material says. In between, the app adds the selected material to the model’s input. This is why a RAG application can answer questions using approved documents that were not part of the model’s original training data. [1] [2]
The three words describe three jobs:
- Retrieval: Search the available information and select useful passages.
- Augmented: Supply those passages with the user’s question as additional context.
- Generation: Ask the language model to compose a useful answer from that context.
Picture a learner asking a librarian a question. The librarian does not need to memorise every rule: they locate the handbook, read the relevant paragraph and explain it. A RAG application automates a similar workflow. The analogy is imperfect—the AI still needs testing and may misread the document—but it helps explain why retrieval and generation are separate steps.
Quick distinction: A search engine returns matching material. A RAG assistant attempts to formulate an answer using matching material. Finding a relevant passage is not yet the generation step.
The whole pipeline in one line: approved documents → searchable passages → user question → retrieve evidence → send evidence + question to an LLM → answer with inspectable source identifiers. If no passage supports the answer, the system should say so rather than fill the gap.
Why do AI systems use RAG?
A language model may be excellent at explaining a topic but lack the latest version of an organisation’s handbook, a current product manual, or a private knowledge base. A RAG application can retrieve those sources at question time instead of relying only on model training. Google Cloud and Microsoft describe this grounding pattern as an approach for answering questions about external or changing data. [2] [3]
Consider three situations:
- Workshop resource desk: A learner asks when borrowed laptops must be returned. The assistant checks the latest approved equipment-loan policy.
- Equipment maintenance: A technician asks which inspection step comes next. The assistant searches an authorised machine manual, while the technician still follows the manufacturer’s safety instructions.
- Customer support: Someone asks whether an item is covered by a warranty. The assistant retrieves the correct policy version rather than improvising a policy.
RAG can help produce more relevant answers, but it does not guarantee truth. Incorrect retrieval, outdated documents, misleading source material and model mistakes can still produce wrong answers. A cited answer must still be checked against its actual source.
How does a RAG system work, step by step?
Retrieve
Find the passage in the permitted document collection that best matches the question.
Output: Source text with an identifier.
Augment
Add that evidence to the question, clearly separated from instructions.
Output: An evidence-grounded prompt.
Generate
Ask the language model to answer using only the retrieved passages, and include source identifiers with its answer.
Output: A source-linked draft answer.
Verify
Compare each claim with the actual retrieved passage. Check that the citation exists and the source supports the claim; ask for review if it does not.
Output: A checked answer—or an honest statement that evidence is missing.
Most beginner systems have two phases: preparing documents and answering questions.
Phase A: Prepare the documents
- Collect permitted sources. These could be text documents, manuals or web pages you are authorised to use. Do not feed confidential student records into a public learning exercise.
- Extract readable text. An image-only scanned PDF may need text extraction before it becomes searchable. Our exercise uses plain .txt files so this step is simple.
- Split content into chunks. A chunk is a short passage. Keeping headings and source identifiers helps preserve meaning.
- Make chunks searchable. A small app can search words directly. Larger systems may build semantic or hybrid indexes, sometimes using embeddings and a vector database.
Phase B: Answer the user’s question
- Retrieve passages. Select chunks relevant to the question, ideally only from documents that the user has permission to read.
- Augment the prompt. Place the retrieved passages beside the question, clearly marking them as source data rather than instructions.
- Generate an answer. A language model uses the evidence to write a response, or acknowledges when the evidence does not answer the question.
- Verify and improve. Check whether the cited passage actually supports the answer, then test more questions.
This is a learning workflow, not a production security architecture. Deployed systems additionally need permissions enforced before retrieval, source-version control, monitoring, evaluation and appropriate safety controls; some add reranking. Microsoft explains that indexes may use keyword, semantic, vector or hybrid retrieval—not every RAG system requires the same database architecture. [3]
What are chunks, embeddings and vector databases?
These terms sound complicated until you separate their purposes.
| Term | Meaning for a beginner |
|---|---|
| Chunk | One searchable passage taken from a larger document. |
| Keyword search | Finds passages containing matching terms, such as “library” and “weekdays”. |
| Embedding | A numerical representation of text used to compare semantic similarity. |
| Vector database | A tool for storing and searching vectors; useful in some applications, not compulsory for RAG. |
| Reranking | Reorders candidate passages to put the most relevant evidence nearer the top. |
| Grounding | Giving the model external evidence to rely on. |
| Source attribution | Showing which document and passage were used to support an answer. |
On a narrow phone, swipe sideways inside the table to view every column without cutting off words.
For example, keyword search may struggle if the document says “Laptop returns are due before 4:30 p.m.” but the reader asks “When is the computer loan deadline?” Semantic retrieval aims to recognise related meanings despite different wording. That flexibility is useful, but semantic systems also require evaluation: related meaning is not always the same as a correct answer.
Beginner lesson: First understand the complete information flow. You can add embeddings later; otherwise it is easy to build a complicated search index without knowing whether its answers are correct.
Document search example: find the right evidence before generating an answer
A fictional technology centre keeps loan rules, workshop dates and lab guidance in separate documents. This is different from pasting one information sheet into a chatbot: our program searches a collection of files, chooses individual passages and displays the source of each match before any language model is called.
The first question is: “When must borrowed laptops be returned on Fridays?” The answer is in 01_equipment_loans.txt . A later question will require two different documents . All files below are sample materials invented for the exercise, not real NIT timetables or policies.
Step 1 — Create the project folder
Create document_search_demo , with rag_demo.py and test_rag_demo.py at the top level and a documents folder for the three .txt files. You need Python 3 and a text editor. The first retrieval exercise uses Python’s standard library only. The companion learning-code ZIP contains these same documents, source code, evaluation cases and tests. Start with the three simple files; the larger benchmark comes after the first successful search.
Step 2 — Add three fictional documents
Put the following content into the indicated file names. Keep the blank lines: our simple splitter treats each non-empty paragraph as a separate chunk. The effective dates are there so you can discuss version control; this beginner program does not automatically resolve conflicting policy versions.
Step 3 — See which passages match the question
The program splits each file at blank lines and stores every chunk with a traceable identifier such as 01_equipment_loans.txt#p2 . It compares non-trivial words from the question with those in each chunk, sorts by number of matches, and returns up to two passages. This is keyword-overlap retrieval , not embeddings, semantic search or a confidence score. The requirement of at least two matching words is only a teaching rule.
These lines contain the key retrieval idea; the complete runnable program follows.
Step 4 — Save the complete Python program
Copy the code below into rag_demo.py without changing indentation. It works with the supplied .txt files. The optional generation stage makes a local request to Ollama, but you do not need Ollama to run or understand the retrieval stage . If you are new to coding, first read the short explanation and expected result in Steps 3 and 5; return to the longer program when you are ready to run it.
Step 5 — Run the search and inspect the source
From the project folder, open a terminal and enter the following. Depending on your computer, Python may be called python , python3 or py .
The retrieved result in the supplied sample is:
The search selected the correct passage because the question shares words such as “borrowed”, “laptops” and “returned” with the equipment rule. This is only the retrieval component. The program has not generated an answer, decided which policy version is official or established that the passage authorises a real-world transaction.
Step 6 — Retrieve evidence from two documents
Try a compound question:
Run this complete terminal command
python rag_demo.py “When is the Python workshop and when must borrowed laptops be returned on Fridays?”
The program retrieves the equipment return rule and the Python workshop schedule:
This example illustrates why individual chunks need identifiable sources. The answer to a combined question may depend on more than one document . Our basic system can retrieve these two facts, but more complicated multi-part questions may require larger retrieval limits or better query processing.
Step 7 — Add the generation step (optional)
For a complete RAG application, a language model receives the user’s question together with the two retrieved passages, then generates an answer. The program’s make_prompt() function marks document text as untrusted data, asks the model to use only the evidence and requests source identifiers. This improves clarity; a prompt instruction alone cannot enforce correctness or stop every prompt-injection attack . [6]
For the first question, an illustrative target answer would be: “According to the fictional equipment-loan rule, borrowed training laptops must be returned by 4:30 p.m. on Fridays . [01_equipment_loans.txt#p2]” That is an example of the intended output, not an answer claimed from a model run .
The provided code can call a separately installed local Ollama model using its documented POST /api/generate interface. Install Ollama, obtain a suitable local model for your hardware and replace YOUR_MODEL with the model’s actual installed name. [4]
Run this complete terminal command
python rag_demo.py “When must borrowed laptops be returned on Fridays?” –generate –model YOUR_MODEL
The script shows the source passages and then the model’s answer. The code calls citation_diagnostics() to verify only the spelling and membership of citation identifiers . It cannot decide whether a cited sentence supports the generated claim. For example, a made-up Sunday return time followed by a genuine Friday-policy citation can still pass the identifier check. Compare every important claim with the displayed source. The local model was not installed or invoked during this editorial audit; an HTTP mock verified the request format, not model reasoning.
Step 8 — Ask a question with no supporting evidence
The script declines to generate when no passage passes its simple overlap threshold. This is useful for learning, not a proof that every unsupported question will be rejected. It sometimes retrieves a related passage even when the query asks something the passage does not answer.
Step 9 — Observe a failure instead of trusting the score
Ask: “When are laptops returned on Mondays?” The keyword matcher can retrieve the Friday return rule because it matches “laptops” and “returned”, even though the question asks about Monday. This is a deliberate failure test in the automated suite.
A careful answer would say that the supplied documents establish Friday returns only ; they do not specify Monday returns. An LLM might answer correctly, misleadingly or refuse. Retrieval scores alone cannot settle that question. The next section shows how to record this kind of problem systematically.
Step 10 — Run a larger retrieval benchmark
The nine original unit tests established that individual functions and a few expected examples behaved as programmed. That was useful, but it was not a representative quality evaluation. A later review added a 22-question, hand-labelled mini-benchmark , stored as evaluation_cases.json . Fifteen questions have one or two known supporting passages; seven deliberately have no answer in the supplied documents . Each expected passage is recorded by its source ID. These are editorial labels for a fictional teaching corpus, not a public benchmark.
Run the included evaluator from the project folder:
The observed results for the original two-passage keyword retriever were:
| Measure and result | What it means |
|---|---|
| 13/15 — Supporting-source coverage at top 2, for answerable questions | Both paraphrased laptop-deadline questions missed the expected passage. |
| 3/7 — Strict no-evidence detection | Four unanswered questions nevertheless returned a related passage. |
| 16/22 — All labelled cases correct under these rules | Useful demonstration, not a production RAG quality score. |
On a narrow phone, swipe sideways inside the table to view every column without cutting off words.
Important: “Top 2” means the first two retrieved passages, not Google’s search-result positions. The evaluation checks retrieval against a tiny fixed answer key. It neither calls a language model nor verifies generated claims. Formal evaluation distinguishes retrieval quality from answer relevance, groundedness and completeness. [8]
The six problematic cases are educationally valuable. Asking for a laptop loan deadline can fail to find a rule that says “borrowed training laptops must be returned”. Conversely, asking for Monday returns , a Wednesday Python workshop , a Sunday return deadline , or the lab’s closing time may retrieve passages that mention Friday returns, Thursday workshops, a power adapter or weekday opening . The passages are related to the topic but do not establish the requested facts.
Step 11 — Improve word matching, then re-test everything
The download includes a clearly labelled experimental retriever, retrieval_experiment.py . It normalises a few practice-specific words: for example computer and laptop can map to laptops , and loan can map to borrowed . This is a tiny handcrafted synonym map, not semantic embeddings or a general language understanding system.
The experiment improved the total from 16/22 to 17/22 , not to 22/22. It recovered the two previously missed laptop-deadline phrasings. However, it also introduced a regression: for the combined workshop-plus-loan question, two equipment-loan chunks occupied the two available retrieval slots, so the needed Python workshop passage was displaced . No-answer handling remained at 3/7. This is why changing a retriever requires re-testing multi-document coverage, relevance and false matches—not just the query that motivated the fix.
We then wrote 11 additional stress questions after the synonym experiment, without changing either retriever to fit them. On these questions, the basic retriever passed 7/11 , while the synonym variant passed 6/11 . In particular, the variant began returning laptop-policy passages for an unanswered inventory-count question. This is a small hand-written follow-up exercise, not an independent statistical benchmark, but it demonstrates why a change that scores better on its development set may perform worse on fresh questions.
To reproduce the second comparison:
A stronger future improvement would compare careful document-aware result diversification, structured date checks and semantic search against new questions not used for tuning , rather than continuing to adjust a synonym list against the same labels. Neither retrieval configuration is suitable for deciding real borrowing permissions or deadlines.
How do you test whether a RAG answer is reliable?
Test the retriever and the generator separately. A retriever can return the correct passage while a model misquotes it; a model can sound confident even when it has been given irrelevant evidence. A good evaluation record includes the question, the expected source, the actual retrieved source, the expected supported answer and any unsupported claim in the model output.
| Question or scenario | Retrieval expectation | Answer-checking expectation |
|---|---|---|
| Friday laptop returns | Select the equipment-loan passage | State 4:30 p.m. on Fridays , with the correct source |
| Thursday Python workshop | Select the workshop-schedule passage | State 2:00 p.m. Thursday, Room 4 |
| Combined workshop and return question | Select both source passages | Support each part with its own citation |
| Graduation ceremony | No relevant passage | Acknowledge that the documents do not say |
| Monday laptop returns | Recognise that a Friday match does not answer the question | Do not invent Monday hours; request better evidence |
| Lab closing time | A weekday opening passage is not an answer | Do not turn 8:30 a.m. opening into a closing time |
| Paraphrased loan deadline | Ideally identify the Friday return passage despite different terms | Detect missed retrieval before declaring the documents silent |
| Old vs new equipment rules | Retrieve or filter by the authoritative effective version | Do not treat higher word overlap as permission to use an old rule |
On a narrow phone, swipe sideways inside the table to view every column without cutting off words.
A small, useful evaluation method: Create a sheet with 10–20 diverse questions; include direct wording, synonyms, multiple facts, misleading wording, an absent answer and at least one conflict. Mark separately whether the expected passage appeared in the retrieved candidates and whether the final claim is actually supported. These are recommended practice cases, not measured benchmark results .
Ask whether the system offers a real improvement over plain document search. If the model adds irrelevant explanations or unsupported claims, returning the matching paragraph may be more reliable for that task.
Run the included automated retrieval checks
The expanded companion test program checks 15 function and integration-contract behaviours . Nine are the original retrieval and prompt-construction checks, including an assertion that the known wrong-weekday problem still occurs. Six additional checks cover citation identifiers and a mocked Ollama HTTP request. These tests do not assess language-model factual accuracy, PDF parsing, vector retrieval, real model availability, production access control or security under attack. Python’s unittest can run them without third-party dependencies. [5]
From the same folder, run:
Audit result: 15/15 unit tests passed. The separate 22-question benchmark exposed six baseline weaknesses . This is not contradictory: a unit test can successfully demonstrate a known defect, and a mocked HTTP response does not prove that a language model generates correct answers. No real Ollama inference was executed.
For a real deployment, you would also test documents with messy formatting, revised and withdrawn content, restricted access, malicious retrieved instructions, misleading citations and partial service outages. OWASP describes additional protections across ingestion, retrieval, source attribution and output handling. [6]
How can you improve this small document-search project?
The next upgrade should solve a failure you actually observed. Start with the Monday-versus-Friday test: record the question, the retrieved passage and the correct interpretation (“the source covers Friday only”). Inspect the evaluation_cases.json record rather than relying on the 15 green unit tests alone. The synonym experiment is an example of how improving one failure may introduce another. Then try these improvements one at a time:
- Check structured facts. For time and date questions, compare the requested day with the day explicitly stated in the passage. A retriever finding the same topic is not enough.
- Protect source versions. Record an effective date and active/inactive status for each document. Only use the approved current version for authoritative answers; the demonstration does not implement this policy automatically.
- Try semantic or hybrid retrieval. Compare it with the keyword baseline on paraphrased questions. Keep track of whether the expected source appears in the retrieved candidates; don’t assume adding embeddings improves every case.
- Evaluate answer support. Check that each generated claim follows from its cited passage. A citation pointing to a real file is not sufficient if that passage does not support the words of the answer.
This progression produces a stronger portfolio demonstration than simply installing more AI libraries: you have a visible problem, a measured baseline, a change and a re-test. It also explains what a production RAG team needs to monitor before relying on generated answers.
Keyword search vs semantic search vs RAG
These are related, but they are not synonyms:
- Keyword search: Returns text based on matching words. It can be transparent and inexpensive for a small collection, but misses many alternative phrasings.
- Semantic search: Uses a representation of meaning, often embeddings, to find related text even when exact terms differ. Retrieval can improve but may also surface thematically related yet incorrect information.
- RAG: Uses a retrieval method (keyword, semantic or hybrid) and then supplies selected evidence to a generative model. Retrieval and generation both need evaluation.
A vector database is a common implementation tool, not the definition of RAG. If a plain keyword retriever reliably finds the small number of relevant passages, it can form the retrieval component of a valid RAG workflow when connected to generation. [3]
RAG vs fine-tuning vs long-context prompting
These approaches solve different problems. RAG searches external sources at question time and adds selected passages to a model prompt. It suits knowledge collections that change or need inspectable sources. Fine-tuning changes a model through additional training to improve behaviours or specialised tasks; it does not automatically make every newly updated policy available. Long-context prompting puts all relevant documents directly into a model prompt, which may be simpler for a small set of materials that fit and are permitted to be shared with the model. [2]
| If your problem is… | Consider first… | Main trade-off |
|---|---|---|
| A few short, approved documents | Directly providing them as context | Simple, but every supplied passage consumes context |
| Many documents that change often | Retrieval plus generation (RAG) | Requires a search index, update rules and evaluation |
| Consistent output format or specialised model behaviour | Prompt design, structured output or fine-tuning | Does not replace up-to-date source lookup |
| A simple lookup with an exact source | Ordinary document search | May be safer than generating a paraphrase |
On a narrow phone, swipe sideways inside the table to view every column without cutting off words.
Do not build an expensive retrieval stack before testing whether it solves the user’s actual problem.
What can go wrong with RAG?
A fluent answer is not necessarily a supported answer. Watch for the following problems.
The retriever finds the wrong document
If the program selects a paragraph about admissions instead of library hours, the model receives weak evidence. Improve chunk boundaries, query handling, metadata or retrieval methods. Inspect the selected passages before changing the language model.
A relevant passage is outdated
Documents can contradict each other. Keep publication and effective dates, retire superseded versions and define which source is authoritative. Retrieval by similarity alone does not decide which policy is current.
The model invents a citation or adds unsupported details
A source identifier in an answer can look convincing even if the cited passage says something else. There are three independent questions to ask before trusting an answer:
- Does the cited ID exist among the retrieved passages? The demo can check this mechanically.
- Does the actual passage support the precise claim and requested date? The demo does not check this. Its unit suite deliberately proves that an incorrect Sunday time can carry a syntactically valid Friday citation.
- Is the passage current, authoritative and permitted for this reader? That requires document governance and access control, not just an LLM prompt.
Display the original evidence. For important uses, implement independently verifiable business rules, controls and human review rather than accepting a fluent answer with a plausible source label. [6]
Private documents are exposed
Document permissions must be checked before passages are supplied to the model. Storing a “restricted” label in a file is insufficient unless the application enforces that restriction at retrieval time.
A document contains malicious instructions
Retrieved text may tell the model to ignore earlier rules or reveal secrets. Treat retrieved passages as untrusted input, isolate data from instructions, restrict tool access and validate outputs. OWASP recommends defence across ingestion, storage, retrieval and generation, not just one warning sentence in the prompt. [6]
Where is RAG useful in real life?
Education and training: A learner searches course materials, workshop guidance and approved handbooks. The answer should link back to the passage, and any learner-specific records must be protected by access controls.
Software development: A developer asks which supported API parameter appears in a particular release of a product. The assistant retrieves the correct version of the documentation instead of blending older and newer instructions.
Equipment operations: A technician locates the relevant paragraph from a manufacturer’s authorised manual. The original instructions and competent human supervision still govern safety-critical actions; an AI paraphrase is not an operating authorisation.
Customer support: An agent searches approved warranty terms or return policies and checks whether the cited version applies to the customer’s product.
Research and administration: A team locates passages across reports. RAG can help them find evidence, but they should consult the cited originals before making decisions based on the answer.
In each case the essential design questions are the same: Which sources can this user see? Which version is authoritative? Does the answer actually follow from the retrieved passage?
Frequently asked questions about RAG
Does RAG need Python?
No. This tutorial uses Python because file handling and tests are easy to inspect. Other languages and managed platforms can implement retrieval and generation.
Does every RAG system use a vector database?
No. Keyword, semantic and hybrid search can all supply evidence for RAG. A vector database is one possible implementation choice, not part of the definition. [3]
Can RAG search PDF documents?
Yes, once the application can extract and organise the content accurately. An image-only PDF may need optical character recognition; tables, figures and page references require particular care. This teaching project intentionally uses plain-text files rather than claiming to parse PDFs.
Is uploading a PDF to an AI chatbot the same as RAG?
Not necessarily. A model may receive the whole file as direct context. In RAG, the application explicitly retrieves relevant external passages to supply as context when answering. The difference is most visible when you inspect the search and retrieval stages.
Is RAG the same as ChatGPT?
No. RAG is an application design pattern. A conversational product may support document retrieval, but that does not make the product name and the technique interchangeable.
Does RAG prevent hallucinations?
No. A retriever can select stale or irrelevant passages; a model can misstate even relevant evidence. Check both the retrieved source and what the model asserts. [2]
Must a RAG system search the public internet?
No. The knowledge collection may contain local text files, approved organisational documents, an internal database or authorised web content. Permissions and source trust matter more than whether the source is online.
Can this lesson run offline?
The Python keyword-retrieval exercise works locally. An optional compatible Ollama model can also run locally after installation and model download, subject to the computer’s hardware and model requirements. No external API subscription is needed for the text-search stage.
What should I learn after this example?
Begin with the included 22-question evaluation set, add fresh questions not used to tune the retriever, test source version filters, then compare keyword retrieval with embeddings or a hybrid index. Learn API integration and check citations against the original text. Do not treat a high similarity score as proof of a correct answer.
Learn practical artificial intelligence at Newton Institute of Technology
This tutorial brings together Python, file handling, information retrieval, APIs and responsible generative AI. If you’re still learning to write programs, begin with NIT’s beginner Python projects guide . For a broader selection of introductory AI exercises, read NIT’s AI projects guide ; this article goes deeper into the document-retrieval pipeline and how to test source-backed answers.
Newton Institute of Technology’s Artificial Intelligence course describes six months of institutional training followed by a compulsory three-month industrial attachment. Learners can develop programming and AI application skills through structured practical training. [7]
Ready to learn more? Explore NIT’s ICT courses and ask admissions about the next Artificial Intelligence intake.
You now have a testable starting project: retrieve source text, optionally generate an answer, inspect each supporting passage and compare both successful and failed queries . The most useful lesson is that “found a relevant document” and “answered correctly” are different achievements.
NIT · Practical ICT training
Learn to build useful AI applications
Explore artificial intelligence, Python, data analytics and software development pathways through NIT. Ask admissions about the current intake, learning mode and entry requirements.
References and further learning
- Lewis et al., Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks (NeurIPS 2020; arXiv). Original research background.
- Google Cloud — What is Retrieval-Augmented Generation? Definition, grounding and long-context considerations.
- Microsoft Learn — Retrieval augmented generation and indexes . Retrieval types and grounding architecture.
- Ollama — Generate a response API ; Ollama Quickstart . Optional local generation.
- Python Software Foundation — unittest documentation . Automated retrieval tests.
- OWASP — Retrieval Augmented Generation Security Cheat Sheet . Controls for source integrity, permissions and prompt injection.
- Newton Institute of Technology — Artificial Intelligence Course in Kenya . Published programme structure and training pathway.
- Microsoft Learn — Retrieval-Augmented Generation evaluators . Distinguishes retrieval quality, answer relevance, groundedness and answer completeness.
Editorial review: 16 November 2026. All equipment, workshop, and lab example data are fictional. Technical details can change; consult the linked official documentation before production deployment.