Skip to main content

PromptExpanderAgent

PromptExpanderAgent expands prompts with more detail and context.

Quick Start

import { createPromptExpanderAgent } from 'praisonai';

const agent = createPromptExpanderAgent({
  llm: 'openai/gpt-4o-mini'
});

const result = await agent.expand('write a story');
console.log(result.expanded);

Configuration

interface PromptExpanderConfig {
  name?: string;
  llm?: string;
  defaultStrategy?: ExpandStrategy;
  verbose?: boolean;
}

type ExpandStrategy = 'detail' | 'context' | 'examples' | 'constraints' | 'auto';

Strategies

StrategyDescription
detailAdd specific details
contextAdd background context
examplesAdd example outputs
constraintsAdd requirements and constraints
autoAutomatically detect best strategy

Response Format

interface ExpandResult {
  original: string;
  expanded: string;
  strategy: ExpandStrategy;
  additions: string[];
}

Example

import { createPromptExpanderAgent } from 'praisonai';

const agent = createPromptExpanderAgent({
  llm: 'openai/gpt-4o-mini',
  defaultStrategy: 'detail'
});

const result = await agent.expand('write a story');
// Result contains a detailed prompt with:
// - Genre requirements
// - Length specifications
// - Character development guidelines
// - Plot structure
// - Theme requirements

CLI Usage

praisonai-ts prompt-expand "write a story"
praisonai-ts prompt-expand "create an app" --strategy detail --json