Process Images with Azure Computer Vision
Caption, tag, and OCR images from URLs in a LlamaIndex agent via Azure Computer Vision.
Why it matters
Leverage Azure's advanced computer vision capabilities to analyze images. This tool enables agents to extract insights like captions, tags, and text from image URLs.
Outcomes
What it gets done
Caption images using Azure Computer Vision.
Extract tags and objects from images.
Perform Optical Character Recognition (OCR) on images.
Integrate Azure Computer Vision into agent workflows.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-tool-tools-azure-cv | bash Overview
Azure Computer Vision Tool
A LlamaIndex tool that sends image URLs to Azure Computer Vision for captioning, object tagging, or OCR text extraction. Use when an agent needs to caption, tag, or read text from an image accessible by URL.
What it does
The Azure Computer Vision Tool connects a LlamaIndex agent to an Azure Computer Vision account, letting the agent perform computer vision tasks directly on image URLs. It exposes one function, process_image, which sends an image to Azure for classification of objects and tags, captioning, or OCR text extraction.
This is a thin wrapper: the agent is simply given the ability to point at any accessible image URL and ask Azure Computer Vision what is in it or what text it contains, without the developer building a separate vision-API integration for the agent to call.
When to use - and when NOT to
Use it when a LlamaIndex agent needs to reason about the visual content of an image that is accessible via URL - describing a picture, listing detected tags or objects, or reading text out of a screenshot or scanned document. Do not use it for images that are not reachable by URL (local-only files must be hosted or uploaded somewhere accessible first), and it depends entirely on an Azure Computer Vision resource being provisioned - it is not a standalone or self-hosted vision model.
Capabilities
process_image is the single tool: send an image URL and get back classification of objects and tags, an image caption, or OCR-extracted text, depending on what the agent asks for in its query.
How to install
from llama_index.tools.azure_cv import AzureCVToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
tool_spec = AzureCVToolSpec(api_key="your-key", resource="your-resource")
agent = FunctionAgent(
tools=tool_spec.to_tool_list(), llm=OpenAI(model="gpt-4.1")
)
Requires an Azure account with an API key and a Computer Vision resource set up in advance.
Who it's for
Developers building LlamaIndex agents that need to see and describe images - captioning, tagging, or reading text from a URL - without integrating a separate vision API by hand.
Source README
Azure Computer Vision Tool
This tool connects to a Azure account and allows an Agent to perform a variety of computer vision tasks on image urls.
You will need to set up an api key and computer vision instance using Azure, learn more here: https://azure.microsoft.com/en-ca/products/cognitive-services/computer-vision
Usage
This tool has a more extensive example usage documented in a Jupyter notebook here
Here's an example usage of the AzureCVToolSpec.
from llama_index.tools.azure_cv import AzureCVToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
tool_spec = AzureCVToolSpec(api_key="your-key", resource="your-resource")
agent = FunctionAgent(
tools=tool_spec.to_tool_list(), llm=OpenAI(model="gpt-4.1")
)
await agent.run(
"caption this image and tell me what tags are in it https://portal.vision.cognitive.azure.com/dist/assets/ImageCaptioningSample1-bbe41ac5.png"
)
await agent.run(
"caption this image and read any text https://portal.vision.cognitive.azure.com/dist/assets/OCR3-4782f088.jpg"
)
process_image: Send an image for computer vision classification of objects, tags, captioning or OCR.
This loader is designed to be used as a way to load data as a Tool in a Agent.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.