Skip to main content
The --expand-prompt flag expands short prompts into detailed, actionable prompts using the PromptExpanderAgent.

Quick Start

praisonai "write a movie script in 3 lines" --expand-prompt

Usage

Basic Expansion

praisonai "write a movie script in 3 lines" --expand-prompt
Expected Output:
✨ Expanding prompt...

╭─ Original Prompt ────────────────────────────────────────────────────────────╮
│  write a movie script in 3 lines                                            │
╰──────────────────────────────────────────────────────────────────────────────╯

╭─ Expanded Prompt ────────────────────────────────────────────────────────────╮
│  Write a compelling 3-line movie script that includes:                      │
│  1. A hook that establishes the setting and protagonist                     │
│  2. A conflict or turning point that creates tension                        │
│  3. A resolution or cliffhanger that leaves an impact                       │
│                                                                              │
│  Format: Each line should be a complete scene description with dialogue     │
│  if appropriate. Use present tense and vivid imagery.                       │
╰──────────────────────────────────────────────────────────────────────────────╯

With Verbose Output

praisonai "blog about AI" --expand-prompt -v

With Tools for Context

praisonai "latest AI trends" --expand-prompt --expand-tools tools.py

Combine with Query Rewrite

praisonai "AI news" --query-rewrite --expand-prompt

Key Difference

FlagPurposeBest For
--query-rewriteOptimizes queries for search/retrieval (RAG)Search, RAG, retrieval
--expand-promptExpands prompts for detailed task executionContent creation, coding

Expansion Strategies

StrategyDescription
BASICSimple expansion with context
DETAILEDComprehensive expansion with structure
STRUCTUREDAdds formatting and organization
CREATIVEAdds creative elements and suggestions
AUTOAutomatically selects best strategy

Examples

Content Creation

praisonai "blog about AI" --expand-prompt
Expanded to: “Write a comprehensive blog post about Artificial Intelligence that includes: an engaging introduction, key concepts explained for beginners, current trends and applications, future predictions, and a conclusion with actionable takeaways. Use headers, bullet points, and examples.”

Code Generation

praisonai "REST API" --expand-prompt
Expanded to: “Create a REST API with the following specifications: endpoints for CRUD operations, proper HTTP methods (GET, POST, PUT, DELETE), error handling with appropriate status codes, input validation, authentication middleware, and documentation comments.”

Research Task

praisonai "quantum computing" --expand-prompt
Expanded to: “Research quantum computing covering: fundamental principles (qubits, superposition, entanglement), current hardware implementations, major players and their approaches, practical applications, challenges and limitations, and future outlook.”

Programmatic Usage

from praisonaiagents import PromptExpanderAgent, ExpandStrategy

# Basic usage
agent = PromptExpanderAgent()
result = agent.expand("write a movie script in 3 lines")
print(result.expanded_prompt)

# With specific strategy
result = agent.expand("blog about AI", strategy=ExpandStrategy.DETAILED)

# Available strategies: BASIC, DETAILED, STRUCTURED, CREATIVE, AUTO

How It Works

  1. Analyze: PromptExpanderAgent analyzes the short prompt
  2. Strategy: Selects appropriate expansion strategy
  3. Expand: Generates detailed, actionable prompt
  4. Execute: Uses expanded prompt for the task

Best Practices

Use --expand-prompt for content creation and coding tasks where detailed instructions improve output quality.
Prompt expansion adds an LLM call. Use --metrics to monitor token usage.
DoDon’t
Use for vague or short promptsUse for already detailed prompts
Combine with --query-rewrite for researchUse alone for simple lookups
Use --expand-tools for contextSkip context for complex topics