Extract Text • AI Agent SDK

extract_text: Extract text from an image (OCR-like functionality).

extract_text

Method

</div>

This is a method of the VisionAgent class in the vision_agent module.

Extract text from an image (OCR-like functionality).

Signature

python
def extract_text(image: str, detail: Optional[str], model: Optional[str]) -> str

Parameters

ParamField str

Image URL or local file path

ParamField Optional[str]

Detail level (low, high, auto) – recommend “high” for text

ParamField Optional[str]

Override model for this call **kwargs: Additional parameters

Returns

ResponseField str

Extracted text

Usage

python
agent = VisionAgent()
    text = agent.extract_text("document.png", detail="high")
    print(text)

Uses

  • analyze

Source

View on GitHub

praisonaiagents/agent/vision_agent.py at line 355