Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 3.1 — Prompts Are Specifications
LLM Engineering · Example 1 of 1

A vague prompt fixed step by step

A fake model answers differently depending on what the prompt says. A one-line check counts the words.

A prompt is the requirements document for a very literal worker. A vague prompt gets a vague answer; a prompt that states the audience, length and format gets output your program can rely on.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 6 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write short_enough(reply, max_words) that returns True when the reply has at most max_words words. Test it with a 3-word and a 12-word reply and max_words=10.

02

Write spec_check(reply) that returns a list of failed requirements for a reply that must be at most 10 words and must not contain the word "overview". Return an empty list when everything passes.

Explain it without notes

01

Why should you think of a prompt as a specification rather than a question?

02

What makes a requirement in a prompt "checkable", and why does it matter?

03

A model's summary is too long. List three things you try before blaming the model.

A vague prompt fixed step by step
Sign in to run this example in your browser.

Expected output

vague: 36 words, FAIL
  This is an email from a customer. It mentions a parcel, a delay and some feelings. There is a lot that could be said, so here is a general overview of what the email is about.
with audience: 24 words, FAIL
  The customer says the parcel is two weeks late and asks for a refund or a new one. They sound upset about the wait.
full spec: 8 words, pass
  Late parcel; customer wants a refund or resend.