Skip to main content

Padding Tutorials

AI and machine learning

Put models to work: APIs, retrieval, evaluation and the plumbing around them.

7 tutorials

All in this category

  • 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 · AI and machine learning

  • How to Get Reliable JSON Output from an LLM

    You will make Claude Haiku 5.5 return a support ticket as typed data with Anthropic's structured outputs and a Pydantic model, see the schema the API receives, and handle the three ways a reply can still fail to match.

    Intermediate · 20 min · AI and machine learning

  • 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 · AI and machine learning

  • How to Defend an LLM App Against Prompt Injection

    You will build the layers that limit the damage of prompt injection in a mail-summarising assistant, which are separated data, a tool allowlist per task, validated actions, filtered output and human approval of side effects, and write tests that check each layer without a model.

    Advanced · 28 min · AI and machine learning

  • 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 · AI and machine learning

  • How to Call a Large Language Model API from Python

    You will store an API key safely, install Anthropic's Python SDK 2.8.0, send Claude Sonnet 5.5 a first request, give it instructions and a conversation history, handle the errors an API call can raise, and work out what each call costs.

    Beginner · 18 min · AI and machine learning

  • 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 · AI and machine learning