Before You Start
This book is for engineers who build retrieval-augmented generation (RAG) systems: the assistants that answer questions from a company's own documents. Each chapter also ends with a short section for new grads and one for the managers who fund and run this work.
What a RAG engineer does
A language model only knows what was in its training data. Ask it about your refund policy, last week's release notes or a contract uploaded this morning and it has nothing to go on, so it guesses. A RAG system fixes that by searching your documents first and handing the model the passages it needs. The RAG engineer owns that search: how documents are split up, how they're indexed, how the right passages are found and ranked, and how you check that the final answer came from them.
If you've worked on search or recommendation systems, much of this will feel familiar. Recall, ranking and relevance judgments are the heart of the job. The new parts are the language model at the end of the pipeline and the specific ways it can go wrong even when retrieval works.
How each chapter is laid out
Chapters open with a short case about a team that ran into a real problem. The reading follows, with numbers worked out so you can check them, and then a lab: starter code you complete and run, followed by a worked solution and what the output means. A running story about Acme, a developer-tools company building an "ask the docs" bot, moves forward a step each chapter.
Two short sections close each chapter. If you're starting out fills in background a new grad might be missing and points out how the topic shows up in interviews. If you run the team is for managers, founders and PMs: what a healthy setup looks like and what question to ask your team. A five-question test comes last.
Running the labs
The labs use plain Python. A couple need pip install rank-bm25 or numpy, and none need an API key. Where a lab can call a real model, it ships with a free mock and a USE_REAL_API flag. The code examples use the Anthropic Python SDK when that flag is on.
Quiz · Before You Start
- Why does a language model need retrieval to answer questions about your documents?
- Which part of a RAG system does the RAG engineer mainly own?
- Which background carries over most directly into RAG work?
- What do you need to run the labs in this book?
- What is the "If you run the team" section for?