Module 2 of 7

Prompting & LLM APIs

Talk to models like an engineer: messages, prompts, JSON and tools.

~48 min6 lessons2 code walkthroughs3 click challenges8 Python exercises8 questions6 quizzes
Start module

What you'll learn

  1. 1

    Anatomy of an LLM API Call

    Roles, messages, and the fact that models remember nothing between calls.

    • A chat is just a list
    • Watch: why chatbots "forget"
    • Find the rules
    • Complete the request
    • Build the messages list
    • Debug the forgetful bot

    Take-home template: Production LLM Client (Anthropic + OpenAI)

  2. 2

    Streaming Responses

    Make AI apps feel instant: server-sent events, deltas and stop reasons.

    • Why streaming feels faster
    • Find the text
    • Parse raw SSE
    • Rebuild the message
    • Streaming in your backend

    Take-home template: Streaming Chat Endpoint (FastAPI + SSE)

  3. 3

    Prompt Engineering That Works

    Clear instructions, examples, delimiters and output formats.

    • Treat the model like a brilliant new hire
    • Which prompt is better?
    • Build a few-shot prompt
    • Why delimiters?
    • The leaked system prompt

    Take-home template: Production Prompt Template

  4. 4

    Reasoning Models & Chain of Thought

    When to pay for thinking, how to prompt reasoning models, and tricks that boost accuracy.

    • Models that think before they answer
    • Pick the right model
    • Separate thinking from the answer
    • Self-consistency: let answers vote
    • Prompting a reasoning model

    Take-home template: Self-Consistency Voting Wrapper

  5. 5

    Structured Output (JSON)

    Get machine-readable output and handle it safely when it breaks.

    • Your code needs data, not prose
    • Watch: catch a bad JSON reply and retry
    • Parse messy model output
    • A robust JSON pipeline
    • Production incident

    Take-home template: Validated JSON with Pydantic + Retry

  6. 6

    Tool Use (Function Calling)

    Let the model call your code: search, databases, APIs.

    • The model asks, your code acts
    • Read a tool call
    • Write a tool definition
    • One tool round trip
    • Dispatch a tool call
    • Designing good tools

    Take-home template: Tool Registry with Auto-Generated Schemas