Skip to content

RAG: Building AI That Uses Your Data

Build an assistant that answers from your own documents and shows where every answer comes from. You turn Larkfield's policy documents into a searchable knowledge base, measure what retrieval finds and misses, and make the assistant say "the documents do not say" when they do not.

Read every lesson as a guest, or sign in to enroll and track your progress.

What you'll learn

By the end of this course, you will be able to:

  • Build a traceable ingestion and retrieval pipeline.
  • Compare lexical, vector and hybrid retrieval.
  • Generate answers with verifiable source references.
  • Diagnose retrieval, context and generation failures separately.

About this course

A language model knows a lot, but it does not know your company’s documents, and it does not know which version is in force today. Ask it about Larkfield’s return policy, and it usually says that it does not know. Sometimes it answers with confidence, and it is wrong. It never shows where an answer comes from.

Retrieval-augmented generation fixes part of this. The application first finds the passages that matter, then asks the model to answer from them and to say where each claim comes from. Done well, every answer can be checked. Done badly, the assistant cites the wrong version, misses the table that held the answer, or follows an instruction hidden in a document.

In this course, you build Larkfield’s policy assistant step by step. You start with plain keyword search and a set of real questions, including questions the documents cannot answer. Then you add careful chunking, embeddings, hybrid search and reranking, and you measure each change instead of guessing. Finally, you keep the knowledge base honest as documents change, are deleted or are only for staff.

You do not need an account or a paid key. Search runs on your own computer, and every answer step has recorded responses from real models. Diagrams and explorers carry the main ideas, so the text stays short.

Before you start

You completed SQL and Data Preparation for AI and Building Reliable Applications with LLM APIs, or you have the same skills. You do not need an API key or a paid account. Search runs on your computer with SQLite and small open models, every answer step has recorded responses, and live calls with a free local model or your own key are optional.

Courses to take first: SQL and Data Preparation for AI, Building Reliable Applications with LLM APIs.

Who this is for

People who can prepare data with SQL and Python and have built an application on a model API, as in Building Reliable Applications with LLM APIs, and now want the model to answer from their own documents. Developers, data scientists and professionals moving into AI engineering.

Lead or use AI, but do not build it?

You can study the ideas of this course without writing code. Read modules 1 and 4–6 (about 10–13 hours), answer their knowledge checks, and get a free concepts certificate. You can come back for the practice later.

The paths for people who lead or use AI take this course this way. See the paths

How we made this course

Experienced AI practitioners designed this course. AI helped us draft the content; people chose the teaching approach and the examples, and reviewed every lesson. The outputs that you see are the actual results of running the code. How we make our courses

Inside the course

Module 2Ingest documents reproducibly

3 lessons

Turn documents into chunks you can trust. Extract text from Markdown, HTML and PDF, split it with care for headings and tables, and give every chunk an ID, a version and a source location.

  1. Parse and normalize50 min
  2. Chunk deliberately50 min
  3. Preserve metadata45 min

Module 4ConceptsConstruct grounded answers

3 lessons

Write answers that stay close to the evidence. Choose passages within a budget, link every claim to a passage and check it in code, and abstain when the documents are missing, conflicting or out of date.

  1. Assemble context45 min
  2. Answer and cite50 min
  3. Handle difficult evidence50 min

Module 5ConceptsEvaluate and debug the pipeline

3 lessons

Measure each part of the pipeline separately. Use recall at k for retrieval and separate checks for correctness and citation support, then locate each failure and change one thing at a time.

  1. Retrieval measures50 min
  2. Answer measures50 min
  3. Find where it fails50 min

Module 6ConceptsMaintain and protect the knowledge base

3 lessons

Keep the knowledge base correct and safe over time. Update and delete documents so that old text disappears from answers, carry access rules through every step, defend against instructions hidden in documents, and hand the system over.

  1. Updates and deletions50 min
  2. Permissions and isolation50 min
  3. Operational handoff45 min

Final module · choose at least oneCase studies

3 case studies

Three end-to-end case studies on open data. Answer questions from public guidance with citations, compare search methods on technical documentation, and answer from regulations that change over time. Complete at least one for the certificate; each one is a portfolio piece.

Complete at least one case study for the certificate. The others are optional. What each one covers

  1. Answer questions from public guidance240 min
  2. Search technical documentation120 min
  3. Answer from versioned regulations210 min

After the case studiesFinal assignment

Use every module in one practice project. You collect evidence, and check it against the course outcomes.

  1. Final assignment300 min

Case studies

Realistic projects from start to finish, on real data, with every output explained. Each one makes a portfolio piece. Complete at least one for the certificate; the others are optional.

  1. Answer questions from public guidance4 hr

    Build a cited question-answering assistant over open government guidance pages, with abstention for questions the guidance does not cover and a measured evaluation.

  2. Search technical documentation2 hr

    Compare keyword, vector and hybrid retrieval with reranking on openly licensed technical documentation, where exact names and paraphrases both matter.

  3. Answer from versioned regulations3 hr 30 min

    Answer questions about rules that change over time, retrieve the version in force on a given date, and cite it.

Reviews

Loading the reviews…

    Took this course? Sign in to review it. Learners can write a review after they complete 25% of the lessons.

    Share this course