Image Agent

Agent for image analysis and generation

Analyse and generate images with a dedicated vision Agent.

Diagram

Image Agent

Analysis

Quick Start

  1. Simple Usage
    bash
    npm install praisonai
    typescript
    import { ImageAgent } from 'praisonai';
    
    const agent = new ImageAgent();
    
    const analysis = await agent.analyze({
      imageUrl: 'https://example.com/image.jpg',
      prompt: 'Describe this image in detail'
    });
    
    console.log(analysis);
  2. With Configuration
    typescript
    import { ImageAgent } from 'praisonai';
    
    const agent = new ImageAgent({
      name: 'VisionAgent',
      llm: 'openai/gpt-4o',
      verbose: true
    });

Analyze Image

typescript
import { ImageAgent } from 'praisonai';

const agent = new ImageAgent();

const result = await agent.analyze({
  imageUrl: 'https://example.com/photo.jpg',
  prompt: 'What objects are in this image?',
  detail: 'high'
});

console.log(result);

Chat with Image Context

typescript
import { ImageAgent } from 'praisonai';

const agent = new ImageAgent();

// Chat with image
const response = await agent.chat(
  'What colors are prominent in this image?',
  'https://example.com/image.jpg'
);

// Chat without image
const textResponse = await agent.chat('What is machine learning?');

Compare Images

typescript
import { ImageAgent } from 'praisonai';

const agent = new ImageAgent();

const comparison = await agent.compare(
  'https://example.com/image1.jpg',
  'https://example.com/image2.jpg',
  'What are the differences between these images?'
);

console.log(comparison);

Detail Levels

typescript
import { ImageAgent } from 'praisonai';

const agent = new ImageAgent();

// Low detail - faster, less tokens
await agent.analyze({
  imageUrl: 'https://example.com/image.jpg',
  detail: 'low'
});

// High detail - more accurate
await agent.analyze({
  imageUrl: 'https://example.com/image.jpg',
  detail: 'high'
});

// Auto - let the model decide
await agent.analyze({
  imageUrl: 'https://example.com/image.jpg',
  detail: 'auto'
});

Factory Function

typescript
import { createImageAgent } from 'praisonai';

const agent = createImageAgent({
  name: 'MyImageAgent',
  verbose: true
});

Related