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()
analyze()
describe()
describe()
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()
compare()
extract_text()
extract_text()
Extract text from images (OCR-like).
Configuration
- Basic
- With Config
- Dict Config
VisionConfig Parameters
Supported Models
OpenAI
gpt-4o(default)gpt-4o-minigpt-4-turbo
Anthropic
claude-3-5-sonnet-20241022claude-3-opus-20240229
gemini/gemini-1.5-progemini/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.
ImageAgent is for image generation.
Best Practices
Pick the method that matches the task
Pick the method that matches the task
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.Use a vision-capable model
Use a vision-capable model
VisionAgent needs a multimodal model (GPT-4o, Claude, Gemini). Point it at a text-only model and it cannot see the image.
Give a specific prompt for analysis
Give a specific prompt for analysis
analyze(image, prompt="Count the people") beats a bare analyze(image). A focused question yields a focused, useful answer.Reach for ImageAgent to generate, not analyse
Reach for ImageAgent to generate, not analyse
VisionAgent understands existing images. To create new images from a text prompt, use the ImageAgent instead.
Related
Generate images from text prompts.
Extract text from images with OCR.

