Summary audio
No audio recap for this lesson.
Study notes
Core Concept
- One-shot prompting: Providing a single example in your prompt
- Multi-shot prompting: Providing multiple examples in your prompt
- This is one of the most effective prompt engineering techniques for guiding Claude's behavior
How It Works
- Include sample input-output pairs directly in your prompt
- Wrap examples in XML tags to clearly structure the prompt and distinguish examples from instructions
- Claude learns from these examples and applies the pattern to your actual input
Use Cases
Corner Cases
- Highlight tricky scenarios that Claude might mishandle (e. g. , sarcasm in sentiment analysis)
- Add context explaining what to watch for, then provide an example immediately after
- Helps Claude recognize similar patterns in your actual input
Complex Output Formats
- Show Claude the exact structure you need (e. g. , complex JSON objects)
- Provides a concrete template for the output format
Best Practices
- Use examples from your own eval results—find high-scoring test cases (ideally perfect 10s)
- Include reasoning or explanation of why an example is ideal output
- This reinforces what makes output good and helps Claude understand your standards better
Practical Application
- Extract high-quality input-output pairs from your evaluation results
- Add them to your prompt with clear labels and XML tags
- Include explanatory notes about why each example is ideal
- Rerun evaluations to measure improvement
Takeaways
- One-shot and multi-shot prompting involve providing example input-output pairs in your prompt to guide Claude's behavior
- Wrap examples in XML tags to clearly structure the prompt and help Claude distinguish examples from instructions
- Use high-scoring examples from your own evaluation results (ideally perfect scores) and include reasoning for why they're ideal output
- Include examples of corner cases and tricky scenarios to help Claude recognize and handle similar patterns correctly
- Rerun evaluations after adding examples to measure improvement in Claude's performance
Flashcards 9 cards
Question
click to reveal · ←/→
Answer
click to flip back
Knowledge check 1 questions