Build your own RAG pipeline
Setup & orientation·4 min

What you're building

0 / 1

RAG — Retrieval-Augmented Generation — is the most-deployed LLM pattern and the most-misdiagnosed. The idea is simple: retrieve relevant text from your documents, stuff it into the prompt, and let the model answer grounded in it. You're going to build the retrieval + assembly half of that system — the half that decides whether the answer is even reachable — end to end in TypeScript.

The thesis

When "chat with your docs" gives a wrong answer, the model is the last suspect. Usually one of two things happened: the chunk holding the answer never made the top-k, or the citation pointed at the wrong chunk. Teams blame the model and tune prompts for weeks when the bug was in retrieval. This course makes both failure modes measurable — and separable.

The pipeline you build
docs -> [chunk] -> [embed] -> [index]
                                  |   query -> [embed]
                                  v      |
                             [retrieve top-k] <-+
                                  |
                             [MMR dedup] -> [assemble + cite] -> [LLM (cassette)] -> answer + [doc i]
                                  |                                                     |
                             recall@k / MRR              hit-rate@k          citation-correctness
The number you walk away with

By the end you'll have a number — hit-rate@5 = 0.94 on this corpus — that you proved without ever asking an LLM whether it was right. That, plus a citation-integrity check most production systems don't have, is the deliverable.