few-shot-example-gen
npx machina-cli add skill a5c-ai/babysitter/few-shot-example-gen --openclawFiles (1)
SKILL.md
1.2 KB
Few-Shot Example Generation Skill
Capabilities
- Generate diverse few-shot examples
- Implement example selection strategies
- Optimize example ordering for performance
- Create dynamic example retrieval
- Design example formats for specific tasks
- Implement example quality validation
Target Processes
- prompt-engineering-workflow
- intent-classification-system
Implementation Details
Example Selection Strategies
- Semantic Similarity: Select similar examples
- MMR Selection: Diverse example selection
- N-Gram Overlap: Lexical similarity
- Random Sampling: Baseline selection
- Length-Based: Control example sizes
Configuration Options
- Number of examples
- Selection algorithm
- Example format (input/output structure)
- Max token limits
- Example store backend
Best Practices
- Cover edge cases in examples
- Balance example diversity
- Optimize example ordering
- Test with varied inputs
- Monitor token usage
Dependencies
- langchain
- sentence-transformers (for semantic selection)
Source
git clone https://github.com/a5c-ai/babysitter/blob/main/plugins/babysitter/skills/babysit/process/specializations/ai-agents-conversational/skills/few-shot-example-gen/SKILL.mdView on GitHub Overview
This skill generates diverse few-shot examples, selects and orders them to improve LLM performance. It enables dynamic example retrieval, formats tailored to tasks, and validates example quality, supporting prompt-engineering workflows and intent-classification systems.
How This Skill Works
It builds pools of candidate examples, applies selection strategies such as semantic similarity, MMR, n-gram overlap, random sampling, and length-based ordering, and then formats and orders them for optimal impact. It supports configuration options including the number of examples, selection algorithm, example format, max tokens, and a backend store for retrieval.
When to Use It
- In a prompt-engineering workflow to boost LLM accuracy on tasks with limited labeled data
- When building an intent-classification system that benefits from representative edge cases
- To create dynamic, task-specific example sets retrieved at runtime
- When evaluating how different example formats and orders affect performance and cost
- When you need repeatable experiments comparing selection strategies (semantic similarity vs MMR vs random)
Quick Start
- Step 1: Define the task, data sources, and success metrics
- Step 2: Choose a selection algorithm, number of examples, and format
- Step 3: Run evaluations, iterate on ordering, and deploy with monitoring
Best Practices
- Cover edge cases with diverse intents and inputs
- Balance example diversity to avoid bias
- Optimize ordering to improve early-token influence
- Test with varied inputs and prompts to measure robustness
- Monitor token usage and cost as you scale examples
Example Use Cases
- Crafting few-shot prompts for a customer-support chatbot to handle varied inquiries
- Optimizing an intent-classifier's prompts with MMR-selected examples
- Developing dynamic example retrieval for a FAQ bot
- Comparing semantic similarity against random sampling in production prompts
- Reducing total token usage while maintaining accuracy through careful example sizing
Frequently Asked Questions
Add this skill to your agents