Function
Tool identifierocr.
ocr uses the configured vision model to transcribe the text visible in an image verbatim, without translating or summarizing; an image without text returns an empty string. The image can be a local path or a publicly accessible http(s) URL.
The tool is an async function (async def) and shares its model configuration, API key, and size limits with image_understand.
Import path: from veadk.tools.builtin_tools.ocr import ocr
Prerequisites
Environment variables:MODEL_AGENT_API_KEY: API key used for the vision request; falls back tomodel.api_keyin the configuration file when unsetMODEL_VISION_NAME: optional vision model name; the agent model name is used when unset- The endpoint is taken from
model.api_basein the configuration file
model_name argument, then the MODEL_VISION_NAME environment variable, then the agent model name.
Usage
examples/tools/ocr/agent.py
Parameters
Success returns
{"text": ..., "language": ..., "model": ...}; language echoes the value passed in and model is the model actually used. On failure it returns {"error": ...}.
Notes
- Local images must not exceed 20 MB; remote URLs pass an SSRF check before being forwarded to the model, so private and loopback addresses are blocked, and the model service fetches them over the public network.
languageis only a hint: it neither restricts the model output nor represents the detected language. For scene description or questions about an image, useimage_understand.document_parseonly extracts embedded text from scanned PDFs and does not run OCR; convert PDF pages to images first and then use this tool.