Skip to main content

Tutorial series

Build a RAG app from scratch

Chunk documents, store vectors in PostgreSQL, answer questions and measure the result.

  1. How to Split Documents into Chunks for a RAG App

    You will write a Python chunker with no dependencies that splits Markdown help pages at their headings and sentences into overlapping pieces, saves them with their source and heading, and checks that no text was lost and no piece is too long.

    Beginner · 18 min

  2. How to Do Vector Similarity Search in PostgreSQL with pgvector

    You will install PostgreSQL 18 with the pgvector extension on Ubuntu 26.04, store and compare vectors with SQL, load the chunks from the previous tutorial into a table, and add an HNSW index to make nearest-neighbour search fast.

    Intermediate · 22 min

  3. How to Build a RAG Question-Answering Endpoint in Python

    You will embed your document chunks with Voyage AI, store the vectors in PostgreSQL, and serve a FastAPI endpoint that retrieves the closest chunks and has Claude answer from them with cited sources, and you will make the endpoint fail safely.

    Intermediate · 30 min

  4. How to Evaluate and Improve a RAG App with a Test Set

    You will write a test set of questions with known answers, measure retrieval with hit rate and mean reciprocal rank and the full pipeline with pass or fail checks, then use the results to add a distance cutoff that makes the app decline questions it cannot answer.

    Advanced · 28 min