ImageAgent
ImageAgent provides image generation and analysis capabilities.Quick Start
Copy
import { createImageAgent } from 'praisonai';
const agent = createImageAgent({
llm: 'openai/gpt-4o-mini'
});
// Generate an image
const images = await agent.generate({
prompt: 'A sunset over mountains',
size: '1024x1024'
});
// Analyze an image
const analysis = await agent.analyze({
imageUrl: 'https://example.com/image.jpg',
prompt: 'Describe this image'
});
Configuration
Copy
interface ImageAgentConfig {
name?: string;
llm?: string;
imageModel?: string; // Default: 'dall-e-3'
verbose?: boolean;
}
Image Generation
Copy
interface ImageGenerationConfig {
prompt: string;
size?: '256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792';
quality?: 'standard' | 'hd';
style?: 'vivid' | 'natural';
n?: number; // Number of images
}
const images = await agent.generate({
prompt: 'A futuristic city',
size: '1024x1024',
quality: 'hd',
style: 'vivid'
});
Image Analysis
Copy
interface ImageAnalysisConfig {
imageUrl: string;
prompt?: string;
detail?: 'low' | 'high' | 'auto';
}
const analysis = await agent.analyze({
imageUrl: 'https://example.com/photo.jpg',
prompt: 'What objects are in this image?',
detail: 'high'
});
CLI Usage
Copy
# Generate image
praisonai-ts image generate "A sunset over mountains"
praisonai-ts image generate "A cat" --size 1024x1024 --quality hd
# Analyze image
praisonai-ts image analyze https://example.com/image.jpg
praisonai-ts image analyze https://example.com/image.jpg "What is this?"

