$npx -y skills add axoviq-ai/synthadoc --skill imageExtract text from images using a vision LLM
| 1 | # Image Skill |
| 2 | |
| 3 | Base64-encodes the image and passes it to a vision-capable LLM that extracts |
| 4 | all text and key information. Returns the LLM's response as `result.text`. |
| 5 | |
| 6 | ## Setup |
| 7 | |
| 8 | No pip dependency — the skill uses only the Python standard library plus a |
| 9 | LLM provider you supply at construction time. The provider can be any object |
| 10 | that implements the `complete()` interface (see below). |
| 11 | |
| 12 | ## Standalone usage |
| 13 | |
| 14 | ```python |
| 15 | import asyncio |
| 16 | from synthadoc.skills.image.scripts.main import ImageSkill |
| 17 | |
| 18 | # ImageSkill REQUIRES a vision-capable provider — calling extract() without |
| 19 | # one raises ValueError immediately. |
| 20 | skill = ImageSkill(provider=my_provider) |
| 21 | |
| 22 | async def main(): |
| 23 | result = await skill.extract("/path/to/screenshot.png") |
| 24 | print(result.text) # extracted text from the image |
| 25 | print(result.metadata) # {"tokens_input": N, "tokens_output": N} |
| 26 | |
| 27 | asyncio.run(main()) |
| 28 | ``` |
| 29 | |
| 30 | **Provider interface** — any object with this async method: |
| 31 | |
| 32 | ```python |
| 33 | async def complete( |
| 34 | messages: list, # list of Message objects from synthadoc.skills.base |
| 35 | system: str | None = None, |
| 36 | temperature: float = 0.0, |
| 37 | max_tokens: int = 4096, |
| 38 | ) -> object # must have .text (str), .input_tokens (int), .output_tokens (int) |
| 39 | ``` |
| 40 | |
| 41 | Build the provider with any vision-capable model. `Message` is importable |
| 42 | from `synthadoc.skills.base` — no dependency on `synthadoc.providers`: |
| 43 | |
| 44 | ```python |
| 45 | from synthadoc.skills.base import Message |
| 46 | ``` |
| 47 | |
| 48 | **Supported image formats:** `.png`, `.jpg`/`.jpeg`, `.webp`, `.gif`, `.tiff` |
| 49 | |
| 50 | ## When this skill is used |
| 51 | |
| 52 | - Source path ends with `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`, or `.tiff` |
| 53 | - User intent contains: `image`, `screenshot`, `diagram`, `photo` |