> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt Expander Agent

> Expand and enhance prompts with more detail and context

## Installation

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
npm install praisonai
```

## Basic Usage

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { PromptExpanderAgent } from 'praisonai';

const agent = new PromptExpanderAgent();

const result = await agent.expand('Write code');
console.log(result.expanded);
```

## With Custom Configuration

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { PromptExpanderAgent } from 'praisonai';

const agent = new PromptExpanderAgent({
  name: 'MyExpander',
  llm: 'openai/gpt-4o',
  defaultStrategy: 'detail',
  verbose: true
});

const result = await agent.expand('Create a function');
console.log(result);
```

## Expansion Strategies

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { PromptExpanderAgent } from 'praisonai';

const agent = new PromptExpanderAgent();

// Detail strategy - adds specific details
const detail = await agent.expand('Write code', 'detail');

// Context strategy - adds background context
const context = await agent.expand('Explain this', 'context');

// Examples strategy - adds concrete examples
const examples = await agent.expand('Show me how', 'examples');

// Constraints strategy - adds requirements
const constraints = await agent.expand('Build a system', 'constraints');

// Auto strategy - detects best approach
const auto = await agent.expand('Do something', 'auto');
```

## Strategy Detection

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { PromptExpanderAgent } from 'praisonai';

const agent = new PromptExpanderAgent();

// Automatically detects appropriate strategy
const strategy = agent.detectStrategy('Write code');
console.log(strategy); // 'detail'

const strategy2 = agent.detectStrategy('Explain why this matters');
console.log(strategy2); // 'context'
```

## Result Structure

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
interface ExpandResult {
  original: string;      // Original prompt
  expanded: string;      // Expanded prompt
  strategy: ExpandStrategy;  // Strategy used
  additions: string[];   // New elements added
}
```

## Factory Function

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { createPromptExpanderAgent } from 'praisonai';

const agent = createPromptExpanderAgent({
  name: 'Expander',
  verbose: true
});
```
