Skip to main content
Analyse, describe, compare, and read text from images with the VisionAgent and its dedicated methods.
VisionAgent provides dedicated methods for image understanding tasks like analysis, description, comparison, and text extraction.

How It Works


Quick Start

1

Install

2

Create Agent

3

Analyze Image


Methods

Analyze an image with optional custom prompt.
str
required
Image URL or local file path
str
Custom analysis prompt
str
default:"auto"
Detail level: low, high, or auto
Generate detailed description of an image.
Returns comprehensive description including:
  • Main subject and composition
  • Colors, lighting, mood
  • Background and setting
  • Text, symbols, notable details
Compare multiple images.
List[str]
required
List of image URLs or paths (minimum 2)
Extract text from images (OCR-like).
Use detail="high" for better text extraction accuracy.

Configuration

VisionConfig Parameters


Supported Models

OpenAI

  • gpt-4o (default)
  • gpt-4o-mini
  • gpt-4-turbo

Anthropic

  • claude-3-5-sonnet-20241022
  • claude-3-opus-20240229

Google

  • gemini/gemini-1.5-pro
  • gemini/gemini-1.5-flash

Examples

Analyze Chart Data

Compare Product Images

Extract Document Text

Async Usage


Comparison with ImageAgent

VisionAgent is for image analysis/understanding.
ImageAgent is for image generation.

Best Practices

Use analyze for open-ended questions, describe for captions, compare for two images, and text extraction for OCR. The dedicated methods prompt the model more precisely than a raw call.
VisionAgent needs a multimodal model (GPT-4o, Claude, Gemini). Point it at a text-only model and it cannot see the image.
analyze(image, prompt="Count the people") beats a bare analyze(image). A focused question yields a focused, useful answer.
VisionAgent understands existing images. To create new images from a text prompt, use the ImageAgent instead.
Generate images from text prompts.
Extract text from images with OCR.