← Back to courses

Course

RAG and Vector Databases

130 lessons across 17 modules

From why RAG exists to production systems: embeddings, vector databases, chunking, your first RAG app, frameworks, retrieval optimization, evaluation, security, scaling and deployment - plus four projects. Each lesson explains one idea in simple steps, with code you can run and the real output.

Module 1 of 177 lessons3 ready

RAG Fundamentals

Why RAG exists, before writing real systems

What is Generative AI?

1.1

Generative AI creates new content - text, images, code - instead of looking something up. Run llama3 on your own laptop, ask for the same slogan six times, and see why it can write anything: including a confident, invented phone number for a bakery that does not exist.

Beginnerfundamentals20 min
Lesson 1.1Open →

What is a Large Language Model (LLM)?

1.2

An LLM predicts the next piece of text, again and again. Watch llama3 choose " Paris" with 64% probability, count tokens (Telugu cost five times more than English), read the model’s size and limits, and see a long prompt silently cut to a third - the fact in the middle was lost.

Beginnerfundamentals25 min
Lesson 1.2Open →

What is Retrieval-Augmented Generation (RAG)?

1.3

RAG = find the right documents, put them in the prompt, then let the model answer. Build a working RAG app in 40 lines for a bakery: without it llama3 rambled; with it, correct answers with sources. Then watch the two ways it fails - too strict, then inventing a gift card - and the small fix in code.

Beginnerfundamentals30 min
Lesson 1.3Open →

Problems with LLM knowledge and hallucinations

1.4

Why models invent facts, and how often

Ten bakery questions, counted right and wrong

Lesson 1.4planned

RAG vs. fine-tuning

1.5

Teach the model vs give it the documents

When each one is the right choice

Lesson 1.5planned

RAG architecture and end-to-end workflow

1.6

Ingestion pipeline and query pipeline

The full path of one question

Lesson 1.6planned

Use cases and limitations of RAG

1.7

Where RAG shines and where it struggles

Support bot, policy search, code docs

Lesson 1.7planned
Module 2 of 177 lessonsComing soon

Embeddings and Semantic Search

How documents and questions become searchable vectors

What are vector embeddings?

2.1

Text as a list of numbers that captures meaning

"refund" and "return" close together

Lesson 2.1planned

Tokens and text preprocessing

2.2

Cleaning text before embedding

Whitespace, case and HTML leftovers

Lesson 2.2planned

How embedding models work

2.3

Encoder models vs chat models

Why llama3 could not embed

Lesson 2.3planned

Generating embeddings using an API

2.4

Local and hosted embedding models

Embed the bakery documents

Lesson 2.4planned

Vector dimensions and similarity

2.5

What 768 or 1536 dimensions mean

Comparing two sentences

Lesson 2.5planned

Cosine similarity, dot product, and Euclidean distance

2.6

Three ways to measure "close"

The same vectors, three scores

Lesson 2.6planned

Semantic search vs. keyword search

2.7

Meaning vs exact words

Where Lesson 1.3’s word search failed

Lesson 2.7planned
Module 3 of 177 lessonsComing soon

Vector Database Fundamentals

Storing and searching millions of vectors

What is a vector database?

3.1

A database built for nearest-neighbour search

From a Python list to a database

Lesson 3.1planned

Vector database vs. relational database

3.2

Similarity search vs exact queries

The same data in both

Lesson 3.2planned

Collections, records, vectors, and metadata

3.3

The parts of a vector record

A record for one document chunk

Lesson 3.3planned

Inserting and retrieving vectors

3.4

Upsert and top-k queries

Insert 100 chunks, find the best 3

Lesson 3.4planned

Metadata filtering

3.5

Similarity plus exact conditions

Only documents from 2026

Lesson 3.5planned

Indexing and approximate nearest-neighbor search

3.6

Trading a little accuracy for a lot of speed

Exact vs approximate on 100,000 vectors

Lesson 3.6planned

Measuring vector search quality

3.7

Recall@k and latency

Is the right chunk in the top 5?

Lesson 3.7planned
Module 4 of 177 lessonsComing soon

Choosing and Implementing a Vector Database

Five popular options, used hands-on and compared

PostgreSQL with pgvector

4.1

Vectors inside the database you already use

A vector column and an index

Lesson 4.1planned

Chroma

4.2

A simple embedded vector store

Local collection in a few lines

Lesson 4.2planned

FAISS

4.3

A fast vector search library

Search one million vectors in memory

Lesson 4.3planned

Qdrant

4.4

A dedicated vector database server

Collections with payload filters

Lesson 4.4planned

Pinecone

4.5

A fully managed hosted service

Serverless index setup

Lesson 4.5planned

Comparing deployment, cost, scalability, and features

4.6

The trade-offs side by side

One table, five databases

Lesson 4.6planned

Selecting a database for a real project

4.7

A decision checklist

Three projects, three choices

Lesson 4.7planned
Module 5 of 178 lessonsComing soon

Document Ingestion and Chunking

Turning real documents into searchable pieces

Supported document types: TXT, Markdown, PDF, DOCX, and HTML

5.1

What each format hides

One policy in five formats

Lesson 5.1planned

Extracting text from documents

5.2

Libraries and their pitfalls

Tables and headers in a PDF

Lesson 5.2planned

Why document chunking is necessary

5.3

Context limits and precise retrieval

A 40-page PDF as one chunk

Lesson 5.3planned

Fixed-size chunking

5.4

Split every N characters or tokens

Sentences cut in half

Lesson 5.4planned

Recursive character chunking

5.5

Split on paragraphs, then sentences

Cleaner chunks from the same text

Lesson 5.5planned

Chunk overlap and context preservation

5.6

Repeat a little text between chunks

An answer that spans two chunks

Lesson 5.6planned

Metadata design and document IDs

5.7

Source, page, section, version

Citations that point to a page

Lesson 5.7planned

Updating and deleting indexed documents

5.8

Keep the index in sync with the files

A policy changes - old chunks must go

Lesson 5.8planned
Module 6 of 1710 lessonsComing soon

Build Your First RAG Application

From documents to cited answers, step by step

Setting up the Python environment

6.1

Virtual environment, packages, configuration

A clean project layout

Lesson 6.1planned

Connecting to an LLM API

6.2

Local and hosted models behind one function

llama3 now, a hosted model later

Lesson 6.2planned

Generating document embeddings

6.3

Embed every chunk once

Embedding the bakery handbook

Lesson 6.3planned

Storing embeddings in a vector database

6.4

Records with vectors and metadata

Load the chunks into pgvector

Lesson 6.4planned

Converting user questions into embeddings

6.5

Same model for questions and documents

What happens if the models differ

Lesson 6.5planned

Retrieving relevant document chunks

6.6

Top-k search with scores

The best 3 chunks for a question

Lesson 6.6planned

Constructing the prompt with retrieved context

6.7

Instructions, context, question

A prompt template that works

Lesson 6.7planned

Generating answers grounded in documents

6.8

Answer only from the context

Checking faithfulness by hand

Lesson 6.8planned

Returning source citations

6.9

File, page and chunk in every answer

Clickable sources

Lesson 6.9planned

Handling questions with no relevant results

6.10

Thresholds and honest fallbacks

The gift card question, done properly

Lesson 6.10planned
Module 7 of 178 lessonsComing soon

RAG Frameworks

LangChain and LlamaIndex - and when to skip them

Building RAG without a framework

7.1

Everything in plain Python

The Module 6 app, reviewed

Lesson 7.1planned

Introduction to LangChain

7.2

Building blocks for LLM apps

The same app in LangChain

Lesson 7.2planned

LangChain document loaders and text splitters

7.3

Loading and chunking with ready-made parts

PDFs and Markdown in a few lines

Lesson 7.3planned

LangChain retrievers and vector stores

7.4

One interface for many databases

Swap Chroma for pgvector

Lesson 7.4planned

Building a RAG chain

7.5

Retriever, prompt, model, parser

A chain with sources

Lesson 7.5planned

Introduction to LlamaIndex

7.6

A data framework for LLM apps

Index a folder of documents

Lesson 7.6planned

Indexes, query engines, and retrievers

7.7

LlamaIndex’s main parts

A query engine with citations

Lesson 7.7planned

Choosing between custom code, LangChain, and LlamaIndex

7.8

Control vs speed of building

One feature, three ways

Lesson 7.8planned
Module 8 of 178 lessonsComing soon

Retrieval Optimization

Finding the right chunks more often

Top-k retrieval

8.1

How many chunks to send

k = 1, 3 and 10 compared

Lesson 8.1planned

Similarity thresholds

8.2

Drop weak matches

Choosing the cut-off from data

Lesson 8.2planned

Metadata-based filtering

8.3

Narrow the search before ranking

Only the user’s department

Lesson 8.3planned

Hybrid search: keyword plus vector search

8.4

Combine exact words and meaning

Product codes and natural questions

Lesson 8.4planned

Reranking retrieved documents

8.5

A second, more careful ranking

A cross-encoder reorders the top 20

Lesson 8.5planned

Query rewriting and expansion

8.6

Improve the question before searching

Short, vague questions made clear

Lesson 8.6planned

Multi-query retrieval

8.7

Several versions of one question

Merging their results

Lesson 8.7planned

Context compression and deduplication

8.8

Send less, but the right part

Remove repeated chunks

Lesson 8.8planned
Module 9 of 178 lessonsComing soon

Advanced RAG Patterns

Patterns for harder questions and bigger collections

Parent-child chunk retrieval

9.1

Search small, answer with the bigger section

Precise match, full context

Lesson 9.1planned

Multi-query RAG

9.2

Answer from several searches

A question with two parts

Lesson 9.2planned

Multi-document RAG

9.3

Combine and compare across documents

Old policy vs new policy

Lesson 9.3planned

Query routing

9.4

Send each question to the right source

HR docs, IT docs or the database

Lesson 9.4planned

Contextual retrieval

9.5

Add document context to each chunk

Chunks that know where they came from

Lesson 9.5planned

Graph RAG fundamentals

9.6

Entities and relationships as a graph

Who reports to whom

Lesson 9.6planned

Agentic RAG

9.7

An agent decides when and what to retrieve

A LangGraph agent with a search tool

Lesson 9.7planned

Choosing the right RAG architecture

9.8

From simple to agentic

Match the pattern to the problem

Lesson 9.8planned
Module 10 of 178 lessonsComing soon

Build APIs and Integrate the Frontend

A RAG service other apps can use

RAG service architecture

10.1

Ingestion, query and storage services

The parts of a production RAG service

Lesson 10.1planned

Creating FastAPI endpoints

10.2

Endpoints for documents and questions

/documents and /ask

Lesson 10.2planned

Uploading documents through an API

10.3

File uploads and validation

Upload a PDF, get a document ID

Lesson 10.3planned

Implementing background document processing

10.4

Ingest without blocking the request

Status: queued, processing, ready

Lesson 10.4planned

Creating a question-answering endpoint

10.5

Answer, sources and timing

A JSON response with citations

Lesson 10.5planned

Streaming LLM responses

10.6

Words appear as they are generated

Server-Sent Events to the browser

Lesson 10.6planned

Connecting a React frontend

10.7

A chat screen for the RAG API

Upload, ask, see sources

Lesson 10.7planned

Integrating RAG with Node.js and TypeScript

10.8

Calling the Python service from Node

A typed client for /ask

Lesson 10.8planned
Module 11 of 178 lessonsComing soon

Evaluation and Testing

Measuring quality instead of guessing

Why RAG evaluation matters

11.1

Answers that look right but are not

Two pipelines, same demo, different quality

Lesson 11.1planned

Creating a test dataset

11.2

Questions with known answers and sources

30 questions for the bakery

Lesson 11.2planned

Measuring retrieval precision and recall

11.3

Did we find the right chunks?

Recall@3 for every question

Lesson 11.3planned

Measuring answer relevance and faithfulness

11.4

Does the answer stick to the sources?

Catching invented details

Lesson 11.4planned

Evaluating context relevance

11.5

Was the retrieved text useful?

Noise in the context

Lesson 11.5planned

Comparing chunk sizes and retrieval strategies

11.6

Experiments with numbers

200 vs 500 vs 1000 tokens

Lesson 11.6planned

Automated RAG evaluation

11.7

LLM-as-judge and evaluation tools

An evaluation run in CI

Lesson 11.7planned

Regression testing after pipeline changes

11.8

Never get worse without knowing

A failing test after a new chunker

Lesson 11.8planned
Module 12 of 178 lessonsComing soon

Security and Production Readiness

Keeping data, users and the system safe

Protecting API keys and secrets

12.1

Keys out of code and logs

Environment variables and a secret store

Lesson 12.1planned

Authentication and authorization

12.2

Who is asking, and what may they see

JWT on the /ask endpoint

Lesson 12.2planned

Tenant isolation in multi-tenant RAG

12.3

One company never sees another’s data

tenant_id in every query

Lesson 12.3planned

Document-level access control

12.4

Filter by permission at retrieval

HR documents only for HR

Lesson 12.4planned

Prompt injection through retrieved documents

12.5

Documents that give the model orders

A poisoned PDF

Lesson 12.5planned

PII handling and data privacy

12.6

Personal data in documents and logs

Masking phone numbers before indexing

Lesson 12.6planned

Rate limits, retries, and timeouts

12.7

Survive slow and failing services

An embedding API that times out

Lesson 12.7planned

Logging, tracing, and error handling

12.8

Know what happened for every answer

A trace from question to citation

Lesson 12.8planned
Module 13 of 178 lessonsComing soon

Scaling Vector Databases

From thousands to millions of vectors

Vector indexing strategies

13.1

Flat, graph and cluster indexes

When each one fits

Lesson 13.1planned

HNSW and IVF indexes

13.2

The two most common ANN indexes

Tuning recall vs speed

Lesson 13.2planned

Batch embedding and ingestion

13.3

Embed and insert in batches

100,000 chunks in minutes, not hours

Lesson 13.3planned

Caching embeddings and query results

13.4

Never pay twice for the same work

A cache for repeated questions

Lesson 13.4planned

Database partitioning and sharding concepts

13.5

Split data across machines

Partition by tenant

Lesson 13.5planned

Replication, availability, and backups

13.6

Survive a failed server

Restore an index from backup

Lesson 13.6planned

Latency, throughput, and cost optimization

13.7

The three numbers that matter

Measuring p95 latency

Lesson 13.7planned

Scaling ingestion and retrieval independently

13.8

Separate the write and read paths

Big uploads without slow answers

Lesson 13.8planned
Module 14 of 177 lessonsComing soon

Observability and Cost Optimization

Seeing what the system does, and what it costs

Tracking LLM token usage

14.1

Tokens in and out per request

Cost per answer

Lesson 14.1planned

Estimating embedding costs

14.2

Ingestion cost before you start

10,000 documents, priced

Lesson 14.2planned

Monitoring retrieval latency

14.3

Where the milliseconds go

Embedding, search, generation

Lesson 14.3planned

Tracing the complete RAG pipeline

14.4

One trace per question

Retrieval and generation in one view

Lesson 14.4planned

Detecting retrieval failures and poor answers

14.5

Signals that something is wrong

Low scores and "I don’t know" rates

Lesson 14.5planned

Caching and model selection

14.6

Cheaper models where they are enough

A small model for easy questions

Lesson 14.6planned

Production dashboards and alerts

14.7

The numbers to watch daily

An alert when quality drops

Lesson 14.7planned
Module 15 of 179 lessonsComing soon

Deployment and Cloud Infrastructure

Running RAG in production

Containerizing a RAG application with Docker

15.1

One image for the API, one for workers

docker compose up

Lesson 15.1planned

Running PostgreSQL and pgvector

15.2

A production database with vectors

Settings, extensions, backups

Lesson 15.2planned

Deploying FastAPI

15.3

Workers, health checks, configuration

Zero-downtime deploys

Lesson 15.3planned

Managing document storage

15.4

Files in object storage

S3 for uploads

Lesson 15.4planned

Background workers and queues

15.5

Ingestion jobs that retry

A queue for document processing

Lesson 15.5planned

CI/CD for RAG applications

15.6

Tests and evaluations in the pipeline

Block a release that lowers quality

Lesson 15.6planned

Deploying on AWS

15.7

The services a RAG app needs

ECS, RDS and S3

Lesson 15.7planned

AWS Bedrock integration

15.8

Hosted models and knowledge bases on AWS

Swap the local model for Bedrock

Lesson 15.8planned

Production deployment checklist

15.9

Everything to check before launch

A go-live review

Lesson 15.9planned
Module 16 of 178 lessonsComing soon

Interview Preparation and System Design

Explaining and designing RAG systems

Explain RAG end to end

16.1

A clear two-minute explanation

From upload to cited answer

Lesson 16.1planned

Explain embeddings and vector similarity

16.2

Simple words for a deep idea

With one drawing

Lesson 16.2planned

Choose a vector database for a workload

16.3

Reasoning about the trade-offs

Three interview scenarios

Lesson 16.3planned

Troubleshoot poor retrieval quality

16.4

A step-by-step diagnosis

"The bot gives wrong answers"

Lesson 16.4planned

Design RAG for millions of documents

16.5

Ingestion, indexing and query at scale

A system design walkthrough

Lesson 16.5planned

Design a multi-tenant enterprise RAG platform

16.6

Isolation, permissions and cost

An enterprise design review

Lesson 16.6planned

RAG system design interview questions

16.7

Common questions and strong answers

Mock interview

Lesson 16.7planned

Project presentation and architecture review

16.8

Presenting your own RAG project

A ten-minute architecture talk

Lesson 16.8planned
Module 17 of 174 lessonsComing soon

Practical Projects

Four projects, from a beginner chatbot to a production agentic RAG system

Project 1: Document Q&A chatbot

17.1

Beginner - after Module 6: upload documents, ask questions, answers with sources

Python, FastAPI, embeddings, Chroma or FAISS

Lesson 17.1planned

Project 2: Enterprise knowledge assistant

17.2

Intermediate - metadata filters, hybrid search, reranking, document updates

FastAPI, PostgreSQL with pgvector, React, background workers

Lesson 17.2planned

Project 3: Multi-tenant RAG platform

17.3

Advanced - authentication, tenant isolation, access control, usage tracking, evaluation

React, Node.js/TypeScript, FastAPI, PostgreSQL/pgvector

Lesson 17.3planned

Project 4: Production-ready agentic RAG

17.4

Capstone - retrieves knowledge, selects tools, calls APIs, evaluates itself, traceable answers

Python, LangGraph, vector database, LLM API, Docker, AWS

Lesson 17.4planned