📚 Few-Shot Prompting
Provide 2-5 examples before asking for the response. The model learns the pattern and replicates it accurately.
What Is Few-Shot?
"Few-shot examples" to guide the model
In Few-Shot Prompting, you show the model a few input → output examples before asking it to do your actual task. The model identifies the pattern and replicates it in its response.
📝 Basic Structure
// Example 1
Input: [example 1]
Output: [response 1]
// Example 2
Input: [example 2]
Output: [response 2]
// Your task
Input: [your question]
Output: ?
Example: Data Extraction
Extract the name and job title:
Text: "João Silva is the company's new marketing director."
Name: João Silva | Title: Marketing Director
Text: "CEO Maria Santos announced the expansion."
Name: Maria Santos | Title: CEO
Text: "Pedro Lima, project coordinator, presented the report."
Name: ? | Title: ?
→ Model responds: Name: Pedro Lima | Title: Project Coordinator
Best Practices
🚀 Next: Chain of Thought
Learn how to make the model "think out loud" about complex problems!
Go to Chain of Thought