Define the output schema, pass the image, pick the AI model, and get parsed structured output back instead of free-form text.
📦 Installation
pip install viscribe
🚀 Features
- 🖼️ One schema-driven
extracthelper for image workflows - 🔄 Sync and async helpers:
extractandaextract - 📊 Pydantic models, JSON Schema dictionaries, and simple field definitions
- 📁 Local image paths, base64 images, and remote image URLs
- ⚙️ Reusable
ViscribeAI().images.extractclient namespace - 🧩 OpenAI-compatible model configuration
🎯 Quick Start
from pydantic import BaseModel, Field
from viscribe.images import extract
class Receipt(BaseModel):
merchant_name: str | None = Field(description="Store or business name")
total_amount: float | None = Field(description="Final total on the receipt")
date: str | None = Field(description="Receipt date if visible")
line_items: list[str] = Field(description="Visible purchased items")
result = extract(
image_path="examples/receipt.png",
output_schema=Receipt,
instruction="Extract the receipt fields visible in the image.",
model_config={
"model": "gpt-5-mini",
"api_key": "sk-...",
"temperature": 1,
},
)
print(result.data.model_dump())
🧱 Schema Options
output_schema accepts:
- simple field definitions
- JSON Schema dictionaries
- Pydantic model classes
Simple field types are text, number, array_text, and array_number.
Strict schemas are checked against the OpenAI Structured Outputs subset before
the request is sent. Unsupported schemas raise StructuredOutputSchemaError
with the schema path and a suggested fix.
⚡ Async
from viscribe.images import aextract
result = await aextract(
image_url="https://example.com/receipt.png",
output_schema=[{"name": "total_amount", "type": "number"}],
instruction="Extract the visible receipt total.",
)
♻️ Reusable Client
from viscribe import ViscribeAI
client = ViscribeAI(model_config={"model": "gpt-5-mini", "temperature": 1})
result = client.images.extract(
image_path="examples/receipt.png",
output_schema=[{"name": "total_amount", "type": "number"}],
)
💬 Support & Feedback
- 📧 Email: support@viscribe.ai
- 💻 GitHub Issues: Create an issue
- 💬 Discord: Join the community
🤝 Contributing
Please see the contributing guidelines.
🛠️ Development
uv sync
uv run ruff check .
uv run python -m pytest
uv build
Metadata
Release files for viscribe 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| viscribe-1.2.0.tar.gz | 5.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| viscribe-1.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.6 MB
Release files / viscribe-1.2.0.tar.gz
| Download URL | viscribe-1.2.0.tar.gz |
|---|---|
| Size | 5.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a4c00af21fb764f834e394e5d1d3b5f38a72dcbaa70ed008caec5a5873b66f7
|
|
BLAKE2b-256 checksum How to use checksums |
771519532bac21fa932c3396b5dc8c7f59563a2df24bf27fb4f00abb6b366dca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / viscribe-1.2.0-py3-none-any.whl
| Download URL | viscribe-1.2.0-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e224e4d739e2d62d7a5ae39fbb8bd71e5b8186ef390f6e4c4ba0a11ab61919b2
|
|
BLAKE2b-256 checksum How to use checksums |
2bb9bb74a532fba617c2ad44aa255c56b45c950ba6a6802f76ab83508b29ae4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|