PromptExpanderAgent Module
ThePromptExpanderAgent class expands short prompts into detailed, comprehensive prompts for better task execution.
Key Difference from QueryRewriterAgent
- QueryRewriterAgent: Optimizes queries for search/retrieval (RAG)
- PromptExpanderAgent: Expands prompts for detailed task execution
Supported Strategies
- BASIC: Simple expansion with clarity improvements
- DETAILED: Rich expansion with context, constraints, and examples
- STRUCTURED: Expansion with clear structure (task, format, requirements)
- CREATIVE: Expansion with creative flair and vivid language
- AUTO: Automatically selects the best strategy based on prompt analysis
Import
Quick Example
Constructor
PromptExpanderAgent()
Creates a new PromptExpanderAgent instance.
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | "Prompt Expander" | Agent name |
model | str | "gpt-4o-mini" | LLM model to use |
verbose | bool | False | Enable verbose logging |
temperature | float | 0.7 | Temperature for generation (higher = more creative) |
tools | list | [] | Optional tools for context gathering |
Methods
expand(prompt, strategy)
Expands a prompt using the specified strategy.
Parameters:
prompt(str): The original short promptstrategy(ExpandStrategy): Expansion strategy to use (default: AUTO)
ExpandResult - Contains expanded prompt and metadata
ExpandStrategy Enum
ExpandResult
Examples
Creative Expansion
With Tools for Context
Structured Expansion
Related
- Agent Module - Base Agent class
- QueryRewriterAgent Module - Query optimization for RAG
- Task Module - Task definition

