Build one RAG system from first principles¶
I built this Course for developers who know basic Python, terminal commands, and how APIs work. You do not need experience with machine learning, SQL, Docker, embeddings, or vector databases.
I follow one question-answering application throughout the Course instead of starting a new example in every lesson. You can read the chapters without cloning or running a separate exercise. The code is shown directly where each concept is explained.
Some lesson titles below may be new to you. That is expected. Each lesson explains the concept before asking you to use it.
Main Path¶
Foundations¶
- RAG is more than a vector database
- Meet the example Sources
- Discover Sources with glob
- Search and read Sources with ripgrep
- See how coding agents retrieve context
- See the complete learning path
Build the retrieval pipeline¶
- Model and ingest Sources
- Parse and normalize Sources
- Chunk without losing context
- Add ranked lexical search
- Retrieve structured facts
- Understand embeddings and cosine similarity
- Build brute-force vector search
- Persist retrieval in PostgreSQL and pgvector
- Combine lexical and vector retrieval
- Rerank retrieved candidates
- Assemble Evidence and verified Citations
- Generate grounded Answers
- Evaluate retrieval and Answers separately
- Connect the complete PostgreSQL-backed system
Let the model choose retrieval tools¶
Prepare the system for production¶
- Secure retrieved content and agent tools
- Cache expensive stages safely
- Monitor a request from start to finish
- Serve the pipeline with FastAPI
- Test RAG-specific behavior
- Harden and deploy the service
Advanced RAG¶
After the Main Path, you can add retrieval for follow-up questions, advanced database retrieval, webpage parsing, and PDF parsing for text or scanned pages.