Skip to content
Lesson 5 of 8Writing Better Prompts

Shaping the response · Lesson 5 of 8

Providing examples

Choose examples that teach the right lesson: diverse, representative, well-ordered — and not so similar that the AI just copies them.

10 min readIntermediate
Sign in to bookmark

You're learning as a guest — everything is open. Sign in to save progress, earn XP and pick up where you left off.

Examples are powerful — and literal

Few-shot prompting works because the model picks up patterns from your examples. The catch is that it picks up all the patterns, including ones you didn't mean to teach. If every example is about shoes, it may drift toward shoe-related wording. If every example is exactly two sentences, you'll probably get two sentences. Choosing examples is about teaching the pattern you want and nothing else.

1. Make examples representative

Your examples should look like the real inputs the AI will face. If real customer emails are messy, rambling and full of typos, don't demonstrate with tidy, three-line emails. The model learns how to handle what it has seen.

2. Make examples diverse

Vary everything that should vary: topic, length, tone, difficulty. Keep constant only what must stay constant — usually the format.

Before

Rewrite these as friendly reminder texts. Input: Dentist appointment Tuesday 3pm Output: Hi! Just a reminder about your dentist appointment on Tuesday at 3pm. See you then! Input: Dentist appointment Friday 10am Output: Hi! Just a reminder about your dentist appointment on Friday at 10am. See you then! Input: Library book due Monday Output:

After

Rewrite these as friendly reminder texts under 25 words. Match the warmth, not the exact wording. Input: Dentist appointment Tuesday 3pm Output: Hi! Quick reminder: your dentist appointment is Tuesday at 3pm. Reply C to confirm. Input: Book club — bring your copy of the novel, Thursday Output: Book club is Thursday! Don't forget your copy of the novel. Can't wait to hear what you thought. Input: Car service overdue by two weeks Output: Heads up — your car is two weeks past its service date. Want us to book a slot this week? Input: Library book due Monday Output:

The first version teaches a template so rigid the AI will probably write "Hi! Just a reminder about your library book..." and may even add "See you then!", which makes no sense for a library book. The second varies the subject, structure and closing line, so the model learns the tone rather than a fill-in-the-blanks sentence.

3. Cover the tricky cases

If your task has edge cases, include at least one example of each. For a sentiment classifier, show a sarcastic review and a mixed one, not just obvious positives and negatives. For data extraction, show what to output when a field is missing.

Prompt
Extract the person's name and company. If a field isn't mentioned, write "unknown".

Text: "Thanks for the call — Priya from Northwind here."
Name: Priya | Company: Northwind

Text: "Got your invoice. Cheers, Marcus"
Name: Marcus | Company: unknown

Text: "Our team at Bluebird Logistics will review it."
Name: unknown | Company: Bluebird Logistics

Text: "[paste new text]"

Without the second and third examples, the model might guess a company, or invent a name, rather than writing "unknown".

4. Balance your labels

In classification tasks, roughly balance the examples across categories. If four out of five examples are labelled POSITIVE, the model may lean toward POSITIVE on borderline cases.

5. Think about order

Order can influence results. Models sometimes lean toward patterns in the most recent examples, so:

  • Mix categories rather than grouping all of one type together.
  • Don't end on an outlier unless you want the AI to treat it as typical.
  • If results seem oddly skewed, try shuffling the examples and compare.

6. Prevent over-copying

The model may borrow phrases, facts or structure from examples directly. To reduce this:

  • Say what to copy. "Match the format and tone, but write original content."
  • Vary the wording across examples so no single phrase looks like a required part of the pattern.
  • Use different subjects than your real input, so content can't leak across.
  • Keep examples short when only the format matters.
Illustrative example response — written by Promptly, not generated live
Library book due Monday! Pop it in the return slot before then to dodge any late fees.

That illustrative output is what you'd hope the improved reminder prompt produces: warm, short and specific to libraries — not a copy of the dentist template.

Watch out: Examples should be correct. A typo, a wrong calculation or an inconsistent label in an example is likely to be reproduced in the output.

Tip: Keep a small "example bank" for tasks you repeat. When an AI output turns out especially well, save it as a future example — real successes make the best demonstrations.

A quick quality check

Before sending a few-shot prompt, ask: If someone saw only these examples, what rule would they guess? If the answer includes anything you didn't intend — "always mention Tuesday," "always two sentences" — change the examples.

Common mistakes

  • Mistake: Using near-identical examples that differ only in one word.

    Fix: Vary subject, structure and length so the model learns the underlying pattern, not a template.

  • Mistake: Only showing easy, obvious cases.

    Fix: Add at least one example for each tricky situation you expect.

  • Mistake: Most examples share the same label or category.

    Fix: Balance examples across categories and interleave their order.

  • Mistake: Including an example with a mistake in it.

    Fix: Proofread examples carefully; errors get copied.

Practice exercise

Fix a lopsided example set

The starter prompt is a few-shot sentiment classifier for restaurant reviews, but its examples are too similar and unbalanced. Rewrite it with 4–5 examples that are diverse, balanced across POSITIVE, NEGATIVE and MIXED, include at least one tricky case, and are ordered so categories are mixed.

Your draft stays in this browser tab — it isn't sent anywhere.Try your draft in the Playground

Hints

Self-check

Tick each item your prompt covers.

0 of 5 checked

You can do the whole exercise as a guest.Sign in to save progress

Knowledge check

Test your understanding

Question 1 of 4

All your examples happen to be exactly two sentences long. What's the likely effect?

Finished reading?

Guests can read every lesson.Sign in to save progress

Continue to next lesson