Black Friday50% off your first month on any monthly plan with EARLY50 See plans
All 29 lessons
  1. Foundations: what RAG is and a working pipeline

    1. 1. Getting started: what RAG is and when to use it
    2. 2. Types of RAG: a map from naive to agentic
    3. 3. Lab: build the smallest RAG pipeline end to end
    4. 4. How embeddings and vector search find meaning
    5. 5. Document types: what each one breaks, and how to prepare it
  2. Better retrieval: chunking and search

    1. 6. Chunking documents so answers survive
    2. 7. Chunking strategies compared: which to use when
    3. 8. Keyword search vs vector search, and fusing both
    4. 9. Retrieval algorithms compared: which to use when
    5. 10. Reranking the top results before the model reads them
    6. 11. Rewriting the question before you search
  3. Answers you can trust, measure and debug

    1. 12. Lab: grounded answers with citations and refusals
    2. 13. Measuring a RAG system with an evaluation set
    3. 14. Lab: evaluation methods and frameworks: Ragas and DeepEval
    4. 15. Troubleshooting a RAG system, symptom by symptom
  4. Production in a company

    1. 16. Access control: only retrieve what the user may see
    2. 17. Defending against prompt injection in retrieved text
    3. 18. Running RAG in production: freshness, cost and monitoring
    4. 19. Real-world RAG: what worked, what failed, and why
  5. Agentic RAG

    1. 20. Lab: from a fixed pipeline to an agent with a search tool
    2. 21. Self-correcting retrieval: grade, retry, fall back
    3. 22. GraphRAG and routing across many sources
    4. 23. Lab: numbers, tables and financial documents
  6. Frameworks: LangChain, LangGraph and LangSmith

    1. 24. The RAG toolbox: what each library does and why you import it
    2. 25. The framework landscape: LangChain, LangGraph, LlamaIndex, Haystack
    3. 26. Lab: Ask Brightline in LangChain
    4. 27. Lab: agentic RAG as a LangGraph graph
    5. 28. Lab: tracing, evaluating and monitoring with LangSmith
    6. 29. Wrap-up: your production agentic RAG checklist
See the leaderboard

8 min

Getting started: what RAG is and when to use it

Explain what retrieval-augmented generation does, where it fits next to a plain model call, and when to skip it.

By the end of this lesson you can

  • Explain what RAG does in one sentence
  • Name the three stages of every RAG request
  • Decide when RAG, long context or a plain model call fits a company question

What RAG is

Retrieval-augmented generation (RAG) is a pattern for answering from your own documents. Your code finds the passages that match a question, puts them in the prompt, and asks a language model to answer from them.

The model writes the answer. Your documents supply the facts. That split is the whole idea, and every lesson in this course improves one side of it.

[1]

The problem it solves

Meet Brightline Logistics, a fictional 4,000-person freight company. Its employees ask the same questions every day. How much can I spend on a hotel in Chicago? How do I reset my VPN token?

Ask a general model that question and it answers confidently with a number it made up. It has never seen Brightline's travel policy. This is a hallucination: fluent text that isn't supported by any real source.

A model's knowledge lives in its weights, called parametric memory. It's fixed at training time and you can't point to where a fact came from. RAG adds non-parametric memory: an index of your documents that you can update tonight and cite tomorrow. The original RAG paper (Lewis et al., 2020) named this pairing.

[1]

Where RAG fits

One RAG request, end to endCompany documentsSearch indexEmployee questionRetrieverPrompt: question + passagesLanguage modelAnswer with citationsbuilt ahead of time, refreshedas documents changepicks the few passages worthreadingevery claim points back to apassage

Every RAG request has three stages: retrieve (find passages), augment (place them in the prompt) and generate (the model answers from them). Building the index happens earlier, offline.

This course calls the Brightline assistant Ask Brightline. It answers employee questions from four policy sets: HR, travel, IT and security. Every lab builds on it.

A mental model: the open-book exam

Think of RAG as an open-book exam. The model is a capable student who has never read your company's handbook. The retriever decides which pages the student may open.

If the retriever hands over the wrong pages, even a brilliant student writes a wrong answer. If it hands over the right ones, an average student does fine. So most RAG quality problems are retrieval problems, and that's where this course spends most of its time.

When not to use RAG

RAG is not always the answer. Three common cases call for something else:

  • The knowledge base is small. Anthropic's 2024 contextual retrieval post suggests that under about 200,000 tokens (roughly 500 pages), you can put everything in the prompt. Prompt caching then cuts the cost of resending it.
  • You need behaviour, not facts. If the model should write in your support team's tone or follow a format, use prompting or fine-tuning. RAG adds facts; it doesn't change style.
  • The answer lives in a database. Counting trucks in Denver is a SQL query, not a document search. Lesson 22 routes these.

That 200,000-token figure comes from one vendor's guidance in 2024. Context windows keep growing, so check the current limits of the model you use.

[2]

Take a guess

Ask Brightline retrieves the right travel policy page, but the answer is still wrong. What's the most likely cause?

No pressure. Guess now, and the lesson will show you if you were right.

Brightline has 300 pages of policies, about 120,000 tokens, that change twice a year. What's the simplest design that works?

Pick one answer.

[2]

FlashcardsIndex cardsFlashcards ⚡

Card 1 of 5

Worth keeping

  1. RAG splits the job: documents supply facts, the model writes the answer.
  2. Every request runs retrieve, augment, generate; indexing happens ahead of time.
  3. Most wrong answers trace back to what retrieval handed the model.
  4. If everything fits in the prompt, try that first; add RAG when it doesn't.

"RAG" now names a whole family: naive pipelines, graph-based, corrective, multimodal and agentic systems. Next lesson maps every type, so you know which one each later lesson builds.

Leaderboard

Loading…

50 XP for each lesson you finish, 10 for each right answer. Names show only for learners who turn on Show me on leaderboards.

Sources for this lesson (2)

Each fact in the lesson is marked with the number of the page it comes from.

  1. [1]Lewis et al. (2020), Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
  2. [2]Anthropic (2024), Introducing Contextual Retrieval