CourseRetrieval-Augmented Generation: The Complete Course · Module 10: RAG Architectures and Patterns · part 71 of 95
Part 71 · Module 10: RAG Architectures and Patterns

Lab: Four patterns behind one search

82 min read·13 Oct 2026
Module 10 · Lab · About 90 minutes · Needs: lessons 1 to 4 of this module, the Module 7 lab (or the cells in Step 1), and a free Groq or Gemini key

What you are building

FOUR PATTERNS, ONE SEARCH, ONE GUARD retrieve, score Modules 6 and 8 crag.py Ellie: is it covered? sql.py Grace: cases per partner agent.py Ellie: my open repair conversation.py Ellie: where is it now? ask(): one retry a refusal becomes provider_error, never a crash
Every pattern takes the same retrieve and score (blue), so none can widen what a user sees, and every model call (amber) goes through the course guard.

On Friday 9 October Ellie sends "I did that last month too. Is it covered?", then asks whether the repair she has open is covered, and later "Where is it now?". Grace wants a count of unfinished cases per partner. The one-pass pipeline handles none of these well. This lab moves the module's four patterns into hollin/patterns/: crag.py (Lesson 1), sql.py (Lesson 3), agent.py (Lesson 2) and conversation.py (Lesson 4). Every pattern takes the same two functions, retrieve and score, so each runs on Hollin's own search and none can widen what a user sees. Every model call goes through the course guard, and every loop stops with a reason. The real model is called in Steps 3 to 6; everything else runs with no key.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.