Prompting like a proBeginnerLesson 934 min read

Give context and examples

The AI knows nothing about your situation unless you tell it. Background and a few examples can transform the answer.

Lesson in motion

In 60 seconds

Give context and examples

The AI knows nothing about your situation unless you tell it. Background and a few examples can transform the answer.

1/4
In simple words
If you want a friend to draw a cat in your style, you show them two of your drawings first. Showing examples to an AI works the same way.
Context is the background the AI needs: your situation, what has already happened, what you tried, and any limits. Examples show the pattern you want. Giving a few examples is often called few-shot prompting.

Adding context

Without contexttext
How do I ask for a refund?
With contexttext
I bought a mixer grinder online 5 days ago. It stopped working
on the second day. The seller's page says returns are allowed
within 7 days. Help me write a short, polite message to the
seller's support asking for a replacement or a refund.
The second prompt tells the model what product, what problem, what the rules say, and what you want. The answer can now fit your case.

Adding examples (few-shot)

When you need a certain style or pattern, show it. Two or three examples are usually enough.
Few-shot exampletext
Turn each shop product into a short, friendly WhatsApp line.

Product: Fresh methi, ₹20 per bunch
Line: Fresh methi just arrived! Only ₹20 a bunch. 🌿

Product: Alphonso mangoes, ₹600 per dozen
Line: Alphonso season is here! ₹600 a dozen, sweet and ripe. 🥭

Product: Homemade mango pickle, ₹150 per jar
Line:
The model sees the pattern and continues it for the new product, in the same length and tone.

What good context includes

  • Who you are, or who you are writing as
  • The situation and what has already happened
  • What you want to achieve, and what you don't want
  • Rules or limits (a budget, a deadline, a word limit)
  • Any text the answer should be based on (pasted notes, a paragraph) — but never secrets
Weak context
  • Assuming the AI knows your earlier chat in another app
  • Leaving out the key detail ("returns within 7 days")
  • One vague example that doesn't match what you want
Strong context
  • Repeating key facts in the prompt
  • Including the rules and dates that matter
  • Two or three clear examples in the same pattern
Watch out
Examples are copied closely. If your examples all have spelling mistakes, emojis or a certain length, the answer will too. Choose examples you are happy to see repeated.
Try this. Write two example lines in your own style (for example captions, product lines or greetings), then ask a chatbot to write three more in the same style.

Watch and read more

Lab

A few-shot prompt that reliably produces text in your style.

~20 min

The problem

Choose a small writing task you repeat often: shop messages, thank-you notes, social captions, class announcements.

  1. Write one prompt with no examples and send it.
  2. Write a second prompt with context (who, why, where it will be posted) and 2–3 examples in your style. Send it.
  3. Ask for 5 new items with the second prompt.
  4. Compare: which output sounds more like you? What did the examples change?

You are done when

Hard questions

Try to answer before you reveal. If you can answer these, you understood the lesson.

Q1Your examples are all about vegetables. You ask for a line about a phone charger and it sounds odd. Why?Reveal

The model learned the pattern from examples that were all fresh food, so it may copy food-related words ("fresh", "just arrived") that don't fit. Varied examples teach the general pattern (short, friendly, price included) instead of the topic. Choose examples that differ in topic but share the style you want.

Q2Why might pasting a whole 50-page document as context give worse answers than pasting the 2 relevant pages?Reveal

With very long input, the key details are mixed with lots of unrelated text, and models can overlook or mix up details, especially in the middle. Selecting the relevant part focuses the model and makes it easier for you to check the answer against the source.

Please sign in to continue.

Questions people ask

How many examples should I give?

Often two or three are enough. More examples can help for tricky patterns, but make them varied so the model learns the pattern, not one specific example.

Does the chatbot remember context from earlier chats?

Within one conversation, it usually remembers earlier messages up to a limit. Across separate chats, it depends on the app's memory features. To be safe, repeat important context in a new chat.

Can I paste a long document as context?

Many chatbots accept long text, but they can miss details in very long inputs. Point to what matters: "Focus on section 3." And never paste private or confidential documents into tools you are not allowed to use for them.

What is "zero-shot"?

A prompt with no examples, just instructions. It works for many simple tasks. Add examples when the output style or format matters.

Lesson test

5 questions. Get 3 right (60%) to pass and complete this lesson.

Sign in to take the test and save your progress