Get Started
Prompt Engineering
- Introduction
- Model Basics
- Prompt Structures
- Clarity & Specificity
- Using Context
- Role Instructions
- Step-by-Step
- Handling Ambiguity
- Creativity vs Precision
- Using Examples
- Advanced Techniques
- Troubleshooting
- Common Pitfalls
- Evaluating Quality
- Real-World Examples
- Prompt Templates
- AI Tasks
- Safety & Ethics
- Multimodal Prompts
- Data Extraction
- Conversation
- Personalization
Using Examples in Prompts
Providing examples in your prompt helps the AI understand the format and style you want. Examples act as templates, showing the model what kind of output you expect. This is especially useful for complex tasks, formatting requirements, or when you want to match a specific tone.
Why Use Examples?
- Clarifies expectations: The AI can mimic the structure and style of your example.
- Reduces ambiguity: Examples show exactly what you want, leaving less room for misinterpretation.
- Improves consistency: The model is more likely to produce similar outputs across different runs.
Example
Translate the following sentences to French:
- Hello, how are you?
- What time is it?
Expanded Example:
Translate the following sentences to French. Provide the translation in a numbered list, and include a brief explanation for any idiomatic phrases:
- It's raining cats and dogs.
- Break a leg!
Show, don't just tell! Examples make your intent clear. Use them for formatting, tone, or to demonstrate how to handle edge cases.
Best Practices for Using Examples
- Include at least one example for complex or unfamiliar tasks.
- Use examples to demonstrate both correct and incorrect outputs if needed.
- Reference your example in the prompt (e.g., "Follow the format above").
