Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on. You've got this! 🚀
Examples
Including examples in your prompt is one of the most powerful techniques available. This section explains how to use examples effectively as part of the prompt structure.
Why Examples Are Powerful
An example in your prompt shows AI exactly what you expect.
Words like 'professional', 'friendly', 'concise', and 'clear' mean different things to different people.
An example bypasses this problem by showing AI directly.
One good example can replace many words of description and produce better results.
Deep Learning ⊂ Machine Learning ⊂ Artificial Intelligence
Using Examples in the Structure
# Examples section in a structured prompt
structured_prompt_with_examples = """
Role: You are a customer support email writer.
Task: Write a reply to this customer complaint email.
Context: The customer ordered a product 3 weeks ago and it has not arrived.
The shipping delay was caused by a supplier issue.
We cannot confirm a new delivery date.
Examples of our tone:
---
Example 1 (Tone):
"Hi Sarah, thank you for reaching out.
We completely understand how frustrating this situation is,
and we sincerely apologize for the delay..."
---
Example 2 (Closing):
"We truly appreciate your patience.
A member of our team will follow up within 24 hours."
---
Requirements:
- Match the warm, empathetic tone of the examples
- Keep the email under 100 words
- Do not make promises about delivery dates
Output: A complete customer reply email
"""
print("Examples show AI the style faster than any description.")
print("One or two examples is usually enough.")Key Takeaways
- Examples in prompts show AI the expected style, tone, and format directly
- One or two examples is usually sufficient
- Examples work better than trying to describe style in words
- Include examples for tone, format, and length, not just content
- This technique is called few-shot prompting (covered next)
Key Takeaways
- Including examples in your prompt is one of the most powerful techniques available.
- Examples in prompts show AI the expected style, tone, and format directly
- One or two examples is usually sufficient
- Examples work better than trying to describe style in words