Skip to main content

Extract structured data from images using AI models.

Project description

ViscribeAI

ViscribeAI Python

Extract structured data from images using AI models.

X @itsperini LinkedIn itsperini Discord Docs docs.viscribe.ai Python 3.10+ License MIT

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 extract helper for image workflows
  • 🔄 Sync and async helpers: extract and aextract
  • 📊 Pydantic models, JSON Schema dictionaries, and simple field definitions
  • 📁 Local image paths, base64 images, and remote image URLs
  • ⚙️ Reusable ViscribeAI().images.extract client 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

🤝 Contributing

Please see the contributing guidelines.

🛠️ Development

uv sync
uv run ruff check .
uv run python -m pytest
uv build

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viscribe-1.2.0.tar.gz (5.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

viscribe-1.2.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file viscribe-1.2.0.tar.gz.

File metadata

  • Download URL: viscribe-1.2.0.tar.gz
  • Upload date:
  • Size: 5.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for viscribe-1.2.0.tar.gz
Algorithm Hash digest
SHA256 9a4c00af21fb764f834e394e5d1d3b5f38a72dcbaa70ed008caec5a5873b66f7
MD5 fbc91816a97557ee0463f8e2c55547df
BLAKE2b-256 771519532bac21fa932c3396b5dc8c7f59563a2df24bf27fb4f00abb6b366dca

See more details on using hashes here.

File details

Details for the file viscribe-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: viscribe-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for viscribe-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e224e4d739e2d62d7a5ae39fbb8bd71e5b8186ef390f6e4c4ba0a11ab61919b2
MD5 7ed5e8fc087b438a09411e30852712ac
BLAKE2b-256 2bb9bb74a532fba617c2ad44aa255c56b45c950ba6a6802f76ab83508b29ae4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page