Start course

Week 1 · Day 2 of 10

Prompting as engineering

Students can write, version and test prompts, and get typed JSON out of a model that the app can trust.

Robert introduces today: what you'll learn, what you'll build, and why it matters. About two minutes.
In pink: what day 2 adds to the app.
Day 2 adds Typed JSON to the student's app, which already has Your user, FastAPI app, Model.
1LearnSystem prompts and typed output

System prompts, few-shot examples, prompt templates kept in Git, structured output validated with Pydantic models, and the usual reasons a model gets it wrong.

How it worksStep 1 of 5

How messy text becomes data you can trust

  1. Messy text
A job post arrives, written however the company felt like writing it.
Try it liveRuns on a real model

Try it live

Messy text in, typed JSON out

Paste any job post. The model has to return JSON that matches a schema, and it's validated before you see it.

Claude Haiku 5.5 through the AI Gateway
Check your understanding3 questions
  1. Why validate the model's JSON with a Pydantic model before using it?

  2. What are few-shot examples best used for?

  3. Why keep prompts in Git like code?

2BuildTurn messy text into typed JSON

Watch Robert add it to the app first, one short clip per step, then do each step yourself: messy job posts go in, typed JSON the app can trust comes out.

Done when: messy text goes in and clean, checked data comes out.

  1. 1 Write system prompt v1

    ⌃XSave and close the editor: press Control X, then Y, then Return

    Done when prompts/extract.md is committed in Git.

  2. 2 Give your agent the spec

    Done when main.py has a POST /extract route.

  3. 3 Run it on messy text

    Done when a messy job post comes back as clean, typed fields.

  4. 4 Break it, then fix it

    Done when the hourly job post comes back with yearly pay, and prompt v2 is committed.

  5. 5 Push to deploy

    Done when /extract works on your public link. If Vercel says the deploy is blocked, the email on your commits must match your Vercel account.

3CapstoneSystem prompt v1, versioned

System prompt v1, committed and versioned.

4HomeworkBreak your extractor, then fix it

Break your own extractor with ten hard inputs, then fix it.

For teachers: the day 2 teaching kit.