Few-Shot Prompting: Teach AI with Examples (Copy-Paste Prompts)
Generative AI course · Chapter 6 · Estimated reading time: 14 minutes
In chapter 2 you learned the 4-part prompt: Role, Task, Context and Format. But sometimes it is very hard to describe the style you want in words. "Short and catchy" means something different to every person. The easy fix is to show the AI 2 or 3 examples of exactly what you want, and then give it the new item. This is called few-shot prompting, and it is one of the most useful tricks in this course. In this chapter you will use it to write product titles for an online shop, to tag customer complaints into fixed groups, and to keep the same caption style for a bakery's posts.
What you will learn in this chapter
- What zero-shot and few-shot mean
- Why examples beat long instructions
- Write product titles in one style
- Tag complaints into fixed labels
- Count the tags in Excel
- Keep one caption style every day
- Choose good examples
- Fix common few-shot problems
1. Suppose we sell kurtas online
Suppose we are Farhan. We sell cotton kurtas from Jaipur on Meesho and Amazon. Every week we add 20 new products, and each one needs a product title. The marketplace search works best when titles follow one pattern: brand, product, material, key feature, colour, size range.
First we try a normal prompt, with no examples:
Write a product title for a blue cotton kurta for men with a mandarin collar, sizes S to XXL. Brand: Rangrez.
Expected output (yours will be similar, not the same):
Rangrez Men's Stylish Blue Cotton Kurta – Comfortable Mandarin Collar Ethnic Wear for Festivals and Daily Use (S-XXL)
Not bad, but it added words we did not ask for ("Stylish", "for Festivals and Daily Use"). The next title will have a different order, and the one after that will be different again. 20 titles, 20 patterns.
Now we show the AI 2 titles we already like, and then ask for the new one:
Write a product title in exactly the same style as the examples.
Product: red cotton kurta, men, Nehru collar, sizes M to XL, brand Rangrez
Title: Rangrez Men Cotton Kurta | Nehru Collar | Red | M-XL
Product: white linen kurta, men, button placket with pocket, sizes S to XXL, brand Rangrez
Title: Rangrez Men Linen Kurta | Pocket Button Placket | White | S-XXL
Product: blue cotton kurta, men, mandarin collar, sizes S to XXL, brand Rangrez
Title:
Expected output:
Rangrez Men Cotton Kurta | Mandarin Collar | Blue | S-XXL
Same pattern, same separators, no extra words. We did not explain the pattern. The examples explained it.
2. Zero-shot, one-shot and few-shot
A "shot" simply means one example.
| Name | What you give the AI | Example |
|---|---|---|
| Zero-shot | Only the instruction, no examples | "Write a product title for a blue kurta." |
| One-shot | The instruction plus 1 example | One finished title, then the new product |
| Few-shot | The instruction plus 2 to 5 examples | Two or three finished titles, then the new product |
How few-shot prompting works, from top to bottom
Why it works: remember from chapter 1 that the AI guesses the next words. When it sees 2 or 3 examples with the same pattern, the most likely next words are the same pattern again. You are not training the model; you are giving it a very clear clue inside this one prompt.
When to use few-shot:
- When you want a fixed style (titles, captions, subject lines).
- When you want fixed labels (tags, categories, yes or no).
- When you want a fixed shape (one line, a certain order, certain separators).
When you do not need it: for a one-time email or a simple question, a clear 4-part prompt is enough.
3. The few-shot template
[Instruction: what to do, in one or two lines]
[Input label]: [example input 1]
[Output label]: [example output 1]
[Input label]: [example input 2]
[Output label]: [example output 2]
[Input label]: [your new input]
[Output label]:
Three rules make it work:
- Use the same labels every time (for example
Product:andTitle:). - Keep the examples in the same format, with the same separators and order.
- End with the label for the answer (
Title:) and leave it empty. The AI fills it in.
Ravindra Bagale's Tip
Students write a long paragraph like "make it catchy but professional, not too long, use a separator..." and still get a different style each time. Stop describing. Paste 2 good examples you already like. Two examples teach the style better than ten lines of instructions.
4. Worked example 1: 5 product titles in one go
You can also give many new products at once.
- Open ChatGPT, Gemini, Claude or Copilot.
-
Paste this full prompt:
Write one product title for each new product, in exactly the same style as the examples. Use only the facts given. Do not add words like "stylish", "best" or "premium". Product: red cotton kurta, men, Nehru collar, sizes M to XL, brand Rangrez Title: Rangrez Men Cotton Kurta | Nehru Collar | Red | M-XL Product: white linen kurta, men, button placket with pocket, sizes S to XXL, brand Rangrez Title: Rangrez Men Linen Kurta | Pocket Button Placket | White | S-XXL New products: 1. green cotton kurta, women, A-line with side slits, sizes S to L, brand Rangrez 2. black rayon kurta, women, straight cut with three-quarter sleeves, sizes M to XXL, brand Rangrez 3. yellow cotton kurta, boys, mandarin collar, ages 4 to 10 years, brand Rangrez Kids 4. maroon silk blend kurta, men, embroidered neck, sizes M to XXL, brand Rangrez 5. beige khadi kurta, men, short length with pocket, sizes S to XL, brand Rangrez Format: a numbered list with only the titles.
Expected output (yours will be similar, not the same):
1. Rangrez Women Cotton Kurta | A-Line Side Slits | Green | S-L
2. Rangrez Women Rayon Kurta | Straight Cut Three-Quarter Sleeves | Black | M-XXL
3. Rangrez Kids Boys Cotton Kurta | Mandarin Collar | Yellow | 4-10 Years
4. Rangrez Men Silk Blend Kurta | Embroidered Neck | Maroon | M-XXL
5. Rangrez Men Khadi Kurta | Short Length Pocket | Beige | S-XL
- Check each title against the product facts: material, colour and size range. One wrong size range in a listing means returns.
- Check the marketplace's own title rules too (length and banned words). Each marketplace publishes its own listing guidelines for sellers, and they change.
5. Worked example 2: tag customer complaints into fixed labels
Situation: suppose we are Meera, and we work in the support team of a food delivery app like Zomato. Every day we get many complaints. Our manager wants to know how many are about delivery, refunds, food quality and the app. We will make the AI tag each complaint with one label from a fixed list.
-
Paste this prompt:
Tag each complaint with exactly one label from this list: Delivery, Refund, Food quality, App problem, Other. Reply with only the label, nothing else. Complaint: The delivery partner took 70 minutes and the food was cold. Label: Delivery Complaint: I cancelled the order 2 days ago and still have not got my money back. Label: Refund Complaint: The paneer was sour and smelled bad. Label: Food quality Complaint: The app crashes every time I open the payment page. Label: App problem Now tag these. Format: a table with columns No., Complaint, Label. 1. My order was marked delivered but I never got it. 2. The coupon code is not applying at checkout. 3. The biryani had very little rice and too much oil. 4. I was charged twice for one order and only one refund came. 5. The rider called me 8 times and was very rude. 6. Can you add a vegetarian-only filter? 7. The dal was too salty to eat. 8. Refund was promised in 3 days, it has been 6 days.
Expected output (yours will be similar, not the same):
| No. | Complaint | Label |
|---|---|---|
| 1 | My order was marked delivered but I never got it. | Delivery |
| 2 | The coupon code is not applying at checkout. | App problem |
| 3 | The biryani had very little rice and too much oil. | Food quality |
| 4 | I was charged twice for one order and only one refund came. | Refund |
| 5 | The rider called me 8 times and was very rude. | Delivery |
| 6 | Can you add a vegetarian-only filter? | Other |
| 7 | The dal was too salty to eat. | Food quality |
| 8 | Refund was promised in 3 days, it has been 6 days. | Refund |
Look at complaint 2. Is a coupon problem an "App problem" or "Other"? The AI chose one, but a human might choose the other. Read every label that could go two ways. If your team decides coupons are "App problem", add a coupon example to the prompt next time, and the AI will follow it.
Now count the labels in Excel
- Copy the table into Excel or Google Sheets, so the labels are in column
C, fromC2toC9. - In cell
E2typeDelivery, inE3Refund, inE4Food quality, inE5App problem, inE6Other. - In cell
F2type=COUNTIF($C$2:$C$9,E2)and press Enter. - Copy
F2down toF6.
Result for the 8 complaints above:
| Label | Count |
|---|---|
| Delivery | 2 |
| Refund | 2 |
| Food quality | 2 |
| App problem | 1 |
| Other | 1 |
- In
F7type=SUM(F2:F6). It must show8. If it shows less, one label is written differently, for example "Food-quality", "Quality" or "Food quality" with an extra space at the end. That is why the prompt says "exactly one label from this list".
Ravindra Bagale's Tip
Students let the AI invent its own labels, and then get "Late delivery", "Delivery delay" and "Slow rider" for the same problem. Counting becomes impossible. Always give a fixed list, give one example per label, and say "reply with only the label". Then Excel can count it.
6. Worked example 3: the same caption style every day
Situation: suppose we run Shree Bakery in Aurangabad and post one Instagram caption every day. Customers like our style: one short line about the item, one line with the price, and a fixed sign-off with 2 hashtags. Different staff write the captions, so the style keeps changing. We fix it with few-shot.
-
Paste this prompt:
Write an Instagram caption in exactly the same style as the examples. Item: chocolate truffle cake, 500 g, ₹550, fresh today Caption: Rich, soft and fresh out of the oven today 🍫 Chocolate truffle, 500 g, just ₹550. See you at Shree Bakery! #ShreeBakery #FreshToday Item: whole wheat bread, 400 g, ₹60, no maida Caption: Our everyday bread, now made with whole wheat and no maida 🍞 Whole wheat bread, 400 g, just ₹60. See you at Shree Bakery! #ShreeBakery #FreshToday Item: coconut cookies, 250 g box, ₹120, baked with real coconut Caption:
Expected output:
Crunchy, golden and baked with real coconut 🥥
Coconut cookies, 250 g box, just ₹120.
See you at Shree Bakery! #ShreeBakery #FreshToday
-
Check the facts: the weight, the price and the claim ("real coconut"). Never let the AI add a claim like "sugar-free" or "healthy" that you did not give.
-
Save this prompt in your notes (or as a project from chapter 4). Every day, change only the last
Item:line.
7. How to choose good examples
| Good examples are... | Why | Example |
|---|---|---|
| Correct | The AI copies mistakes too | A title with the wrong size range teaches wrong size ranges |
| Different from each other | So the AI learns the pattern, not the item | One red cotton kurta and one white linen kurta, not two red cotton kurtas |
| Same format | So the shape is clear | Same separators, same order, same labels |
| Short | Long examples use more of the AI's reading space | One line each for titles and labels |
| Covering hard cases | So tricky items go to the right label | Add a coupon complaint if your team calls it "App problem" |
How many examples? Start with 2. If the style is still not right, add a 3rd that shows the part it got wrong. More than 5 is rarely needed for everyday work.
8. Few-shot problems and fixes
| Problem | Why it happens | Fix |
|---|---|---|
| The AI copies words from the examples into the new answer | The examples are too similar to the new item | Use examples that differ from the new item |
| All answers get the same label | Examples show only one or two labels | Give one example for every label |
| It explains its answer when you wanted only the label | No rule about the output | Add "Reply with only the label, nothing else" |
| It adds extra words like "premium" | It falls back to its usual style | Add "Use only the facts given" and keep the examples plain |
| The style drifts after many items | Long lists in one chat | Send 10 to 20 items at a time, and repeat the examples in a new chat |
| A wrong fact in the output | The AI guessed a missing detail | Give every fact in the input; tell it to write "missing" if a fact is not given |
9. Few-shot plus the 4 parts
Few-shot does not replace Role, Task, Context and Format. It adds examples to them. A full prompt can look like this:
Role: You are a support team lead at a food delivery company.
Task: Tag each complaint with one label.
Context: Labels: Delivery, Refund, Food quality, App problem, Other. Coupon problems count as App problem.
Format: Reply with only the label.
Examples:
Complaint: The rider took 70 minutes. -> Label: Delivery
Complaint: The coupon is not working. -> Label: App problem
Complaint: [new complaint]
Label:
10. Beginner mistakes and quick fixes
| Mistake | What happens | Fix |
|---|---|---|
| Describing the style in a long paragraph | A different style every time | Show 2 examples instead |
| Using only 1 example for labels | Most items get that one label | One example per label |
| Examples with mistakes | The AI repeats the mistakes | Check your examples first |
| Letting the AI invent labels | Counting in Excel fails | Fixed list, "only the label" |
| Not checking facts in titles and captions | Wrong size, price or claim goes live | Check every fact before you post |
| Very long examples | Slow, and the pattern is less clear | Keep examples short |
11. Try at home
Try at home
Task 1: titles in one style
- Pick 5 things you could sell (books, phone covers, plants).
- Write 2 example titles in a style you like.
- Use the template from section 3 to make titles for the other 3.
Task 2: tag and count
- Write 10 short complaints or reviews (from your own experience with any app).
- Make a fixed label list of 4 labels plus "Other".
- Tag them with few-shot and count the labels in Excel with
=COUNTIF(). - Check that the total with
=SUM()equals 10.
Task 3: one caption style
- Write 2 captions for any small business near you, in one fixed style.
- Use them as examples for 3 new captions.
- Check every price and claim.
Recap
In short
- A "shot" is one example. Zero-shot has no examples; few-shot has 2 to 5.
- Examples teach a style or a label set better than a long description.
- Use the same labels and format in every example, and leave the last answer empty.
- For tagging, give a fixed list, one example per label, and "reply with only the label".
- Count the tags in Excel with
=COUNTIF()and check the total with=SUM(). - Good examples are correct, short, different from each other and in the same format.
- Always check the facts in titles and captions before they go live.
Find 2 messages, titles or captions you already like, and use them as examples today. You will see the AI follow your style from the very first try.
Previous chapter: How to Use AI on Your Phone: Voice, Camera and Gemini Live
Next chapter: Step-by-Step Prompts: How to Make AI Think Before It Answers
Ravindra Bagale, trainer: linkedin.com/in/ravindra-bagale. The people, brands (Rangrez, Shree Bakery), products, complaints and prices on this page are made up for learning. Meesho, Amazon and Zomato are named only to make the situations real; nothing here describes how those companies work or their listing rules. AI answers change every time, so your output will be similar, not the same.