teff.rag.image_tool¶
teff.rag.image_tool
¶
Image extraction tool — OCR via an OpenAI-compatible vision model.
Classes:
| Name | Description |
|---|---|
ImageTool |
Extract text from an image with an OpenAI-compatible vision model. |
ImageTool
¶
Bases: Tool
Extract text from an image with an OpenAI-compatible vision model.
The image is base64-encoded and sent to a chat-completions vision
endpoint (default ollama/llava; openai/gpt-4o-mini is
the API alternative). Use it for OCR on screenshots, scans, charts
and photos.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict | None
|
Optional dict with |
None
|
Methods:
| Name | Description |
|---|---|
arun |
OCR the image at path and return the transcribed text. |
Source code in teff/rag/image_tool.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
arun
async
¶
arun(path, prompt=None, max_chars=50000)
OCR the image at path and return the transcribed text.
Source code in teff/rag/image_tool.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |