Leanpub Header

Skip to main content

AI Engineering Visualized, Volume 3: RAG & Knowledge Systems

A Visual Guide to RAG and Knowledge Systems

AI Engineering Visualized, Volume 3: RAG & Knowledge Systems
This book is 100% completeLast updated on 2026-11-04

RAG answers you can trace to a source: ingestion, permissions, hybrid search, reranking, evals and regression gates, drawn and built in Python.

Minimum price

$19.99

$29.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

The best match was true once. Now it's wrong.

Asha asks whether order #2001 can still be refunded. The best match in the assistant's new search index is an old ticket saying the parcel is still on its way. That ticket was true when it closed. Now it's stale: the order record says #2001 was delivered. A better search would still find that ticket. The code around the search decides which sources may answer, and this book builds that code.

For a retrieval feature whose answers you now have to trust. The sources are manuals with tables, an order database, past tickets and rules that change by region. Volume 1 built the Northwind Goods support assistant with a small hybrid search over one policy page and nine handbook passages. Volume 2 put a harness around it so it could act. Volume 3 gives it real knowledge and makes every answer traceable to a source.

One assistant, carried forward. Chapter by chapter you build the knowledge system behind the model:

- a contract and an access path for every source, and an ingestion pipeline with stable ids, provenance and safe reruns

documents with tables and scans, cut into chunks that know where they apply

permissions from the session, checked at search and at every later step, with poisoned pages treated as a signal and never as the boundary

embeddings and vector indexes, hybrid search with an exact-match lane, reranking, and queries that are rewritten, routed and decomposed

a clear rule for which source wins when two disagree, when to abstain, and an evidence pack the model can cite

safe, scoped SQL over records, and multi-hop retrieval over a knowledge graph

index updates, deletes and rebuilds, retrieval metrics and faithfulness judges, and test sets with a regression gate

A capstone appendix then sends one ticket through every stage on one corpus.

Visual first. Every idea is one of 35 named mental models, such as The Ingestion Conveyor, Small to Find, Big to Read, The Two-Stage Funnel, The Evidence Pack, The Stale Index or The Regression Gate. Each one has a hand-drawn doodle, a plain definition, a failure you can trigger and the fix.

Real code, no API key. The examples are short Python excerpts from the free companion repository (MIT licence), built from plain stages on the Python standard library with no framework. By default they run on a stubbed model, with no API key, no network and no cost. You can point a chapter at a real local model with Ollama if you like. Each Model experiment reports one real llama3.2 run with its settings and log, not a rate; runs not made yet are marked [TO MEASURE].

Chapters 3, 7 and 10 are in the free sample.

Share this book

Bundle

Bundles that include this book

Author

About the Author

Prateek Singh

Prateek Singh is an Infrastructure Developer, an avid PowerShell blogger, and a community contributor. In 2017 and 2018, FeedSpot and SQLHack recognized his blog RidiCurious.com as among the “Top 50 PowerShell blogs in the world.” Find his open-sourced at GitHub, and reach out to him on Twitter at @singhprateik.

Prateek has written more than 250 articles on his blog and several other websites such as 4SysOps.com, IPSwitch.com, and TechTarget.com and also runs a YouTube channel. He is a published author of 3 books and contributing author of 2 Book and currently writing the 6th one, following is the complete list:

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub