6. Using examples
One of the most powerful techniques: showing concrete examples of the kind of response you expect.
The principle of learning by demonstration
It's easier to show than to explain. You can describe the desired style over paragraphs, or show 2-3 examples and let the AI identify the pattern.
Basic example
With examples:
Answer children's questions following this style:
Question: Is the tooth fairy real? Answer: Of course, sweetheart. Wrap your little tooth up tight tonight and leave it under your pillow. Maybe you'll find a little surprise in the morning.
Question: Why is the sky blue? Answer: The sky is like a big canvas where the sun paints with its light. During the day it chooses blue because it's its favorite color.
Now answer this one: Question: Is Santa Claus real?
Examples for a specific format
Extract names and professions following this format:
Input: "In the village lived Dr. Liam Patel, a neurosurgeon who revolutionized surgical techniques." Output: Dr. Liam Patel [NEUROSURGEON]
Input: "Olivia Chen was an innovative architect who transformed the landscape." Output: Olivia Chen [ARCHITECT]
Now process this one: Input: "Isabella Torres, a self-taught chef, created a culinary sensation."
How many examples you need
- 1 example: For very simple tasks
- 2-3 examples: Optimal for most cases
- 4-5 examples: For complex tasks with variations
Even a single example is infinitely better than none.
Examples with variation
When your task has different cases or types, include examples of each variant:
Classify emails into categories:
<example>Email: "My device makes a strange noise and smells like burning. I need a replacement." Category: (B) Defective product</example>
<example>Email: "Can I use the product to mix paint?" Category: (A) Pre-sale question</example>
<example>Email: "I've been waiting 4 months for my charges to be canceled. WHAT'S GOING ON?" Category: (C) Billing question</example>Now classify this one: Email: "The product arrived damaged. Several parts are broken."
Examples for tone and style
Examples are ideal for capturing subtle nuances of tone:
Write product descriptions with personality and humor:
Product: Wireless headphones Description: Forget tangled cables and interrupted meetings. These headphones give you 40 hours of battery life and noise cancellation so effective you could work in the middle of a rock concert. They include a charging case that fits in your pocket because we know space is gold.
Product: Automatic coffee maker Description: Freshly made coffee in 30 seconds, exactly the time it takes to convince yourself that today you WILL go to the gym. Programmable so your first cup is ready when you open your eyes. Because no one should have to think before coffee.
Now write for: Product: LED desk lamp
Negative examples (what NOT to do)
Sometimes showing what to avoid is as valuable as showing what to do:
Respond to customer complaints. Contrast these approaches:
❌ BAD EXAMPLE: Customer: "My order arrived late and cold." Answer: "Delays are normal at this time of year. You should have ordered earlier."
✓ GOOD EXAMPLE: Customer: "My order arrived late and cold." Answer: "I'm very sorry your order didn't arrive in good condition. This doesn't reflect our standard. I'm sending you a €20 coupon for your next order and I'll personally speak with the delivery team."
Now respond: Customer: "The product I received doesn't match the photo on the website."
Real cases: headline generator
Generate technology news headlines that are informative but engaging:
News: New version of AI software Headline: "ChatGPT 5 arrives with advanced reasoning and cuts errors by 40%"
News: Tech company lays off employees Headline: "Tesla cuts 3,000 jobs while refocusing its strategy on AI"
News: Study on social media use Headline: "16-24 year olds spend 6 hours a day on TikTok, according to MIT"
Generate a headline for: News: Apple announces a new iPhone with a battery that lasts 3 days
Showing examples is one of the most effective prompting techniques. It's easier to demonstrate than to explain, and the AI identifies patterns quickly when you show it 2-3 examples of the result you expect.
You have now mastered clarity, context, separating data, and using examples. But for complex tasks that require reasoning, there is a technique that multiplies the precision of responses. In the next lesson you will discover how to ask the AI to think out loud before answering.
This work is under a Attribution-NonCommercial-NoDerivatives 4.0 International license.
Desafíos de programación atemporales y multiparadigmáticos
Te encuentras ante un librillo de actividades, divididas en 2 niveles de dificultad. Te enfrentarás a los casos más comunes que te puedes encontrar en pruebas técnicas o aprender conceptos elementales de programación.
Buy the bookWill you buy me a coffee?
This is how I keep writing without ads or paywalls.
Sure, it's on me!
Comments
There are no comments yet.