openextract — open-source Python library
Files in.
Turn documents, images, audio, and video into validated Python objects.
Source · invoice.txt
Total due: 120.00openextract — open-source Python library
Turn documents, images, audio, and video into validated Python objects.
Source · invoice.txt
Total due: 120.00Quickstart
Define an invoice with Pydantic and pass it to extract. The total comes back as a Python Decimal.
Python 3.12+, with OPENAI_API_KEY set.
uv add openextract
from decimal import Decimal
from pydantic import BaseModel
from openextract import extract
class Invoice(BaseModel):
total: Decimal
invoice = extract(
Invoice,
"openai:gpt-6.1-sol",
"Total due: 120.00",
)
print(invoice.total)