Extract structured data from documents, images, audio, and video using LLMs
Project description
Open Xtract
Extract structured data from documents, images, audio, and video using LLMs.
Installation
uv add open-xtract
Usage
from pydantic import BaseModel
from open_xtract import extract
class PdfInfo(BaseModel):
summary: str
language: str
result = extract(
schema=PdfInfo,
model="google-gla:gemini-3-flash-preview",
url="https://example.com/document.pdf",
instructions="return a 2 sentence summary and the primary language of the document",
)
print(result)
Logging
To enable logfire instrumentation for tracing:
from open_xtract import configure_logging
configure_logging()
Error Handling
from open_xtract import (
extract,
ExtractionError,
ModelError,
SchemaValidationError,
UrlFetchError,
)
try:
result = extract(...)
except UrlFetchError as e:
print(f"Failed to fetch URL: {e}")
except SchemaValidationError as e:
print(f"Output didn't match schema: {e}")
except ModelError as e:
print(f"Model API error: {e}")
except ExtractionError as e:
print(f"Extraction failed: {e}")
Durable Execution
For long-running extractions that need to survive failures, use Temporal-backed durable execution:
uv add open-xtract[temporal]
from open_xtract import extract, stop_temporal
result = extract(
schema=PdfInfo,
model="openai:gpt-5.2",
url="https://example.com/document.pdf",
instructions="Extract document info",
durable=True, # enables Temporal
temporal_ui=True, # optional, starts UI on http://localhost:8080
)
# Optional: clean up Docker containers when done
stop_temporal()
When durable=True:
- Automatically starts Temporal server via Docker (requires Docker to be running)
- Uses PostgreSQL for persistent workflow state
- Provides automatic retries and failure recovery
- Optionally starts Temporal UI for workflow monitoring
Supported Media Types
| Type | Extensions |
|---|---|
| Documents | .pdf, .doc, .docx, .txt, .html, .csv, .xls, .xlsx |
| Images | .jpg, .jpeg, .png, .gif, .webp, .bmp, .svg |
| Audio | .mp3, .wav, .ogg, .flac, .aac, .m4a |
| Video | .mp4, .mov, .avi, .mkv, .webm, .wmv |
Contributing
See CONTRIBUTING.md for development setup and guidelines.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file open_xtract-0.2.0.tar.gz.
File metadata
- Download URL: open_xtract-0.2.0.tar.gz
- Upload date:
- Size: 526.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5de6c19100a318fc17bfcf7a0858b860e7e499376b18710638d817b0d8b9c7b9
|
|
| MD5 |
e4f50947479702ebdd5e77bae37a3712
|
|
| BLAKE2b-256 |
3fd86540d5d606b5276e3909c19e868483db7eafe08214074e606305ca105041
|
Provenance
The following attestation bundles were made for open_xtract-0.2.0.tar.gz:
Publisher:
release.yml on Mellow-Artificial-Intelligence/open-xtract
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_xtract-0.2.0.tar.gz -
Subject digest:
5de6c19100a318fc17bfcf7a0858b860e7e499376b18710638d817b0d8b9c7b9 - Sigstore transparency entry: 813701739
- Sigstore integration time:
-
Permalink:
Mellow-Artificial-Intelligence/open-xtract@6ad5be2c12cc64712da04b3f1506e32becb62712 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Mellow-Artificial-Intelligence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6ad5be2c12cc64712da04b3f1506e32becb62712 -
Trigger Event:
push
-
Statement type:
File details
Details for the file open_xtract-0.2.0-py3-none-any.whl.
File metadata
- Download URL: open_xtract-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fe9962474c594111a5cb0159c5cff37dd691e88f2dd6b465f5eaefe743be624
|
|
| MD5 |
8a365b3d3abe8f396de08f1687fb4a93
|
|
| BLAKE2b-256 |
4ed8559e738b44cc4952e518af81cea072b73e0fd1ce72804fec515aeaf32943
|
Provenance
The following attestation bundles were made for open_xtract-0.2.0-py3-none-any.whl:
Publisher:
release.yml on Mellow-Artificial-Intelligence/open-xtract
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
open_xtract-0.2.0-py3-none-any.whl -
Subject digest:
7fe9962474c594111a5cb0159c5cff37dd691e88f2dd6b465f5eaefe743be624 - Sigstore transparency entry: 813701740
- Sigstore integration time:
-
Permalink:
Mellow-Artificial-Intelligence/open-xtract@6ad5be2c12cc64712da04b3f1506e32becb62712 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Mellow-Artificial-Intelligence
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6ad5be2c12cc64712da04b3f1506e32becb62712 -
Trigger Event:
push
-
Statement type: