Skip to main content

Extract structured data from documents, images, audio, and video using LLMs

Project description

open-xtract

Python 3.12+ Pydantic v2 pydantic-ai

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}")

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

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

open_xtract-0.1.4.tar.gz (515.1 kB view details)

Uploaded Source

Built Distribution

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

open_xtract-0.1.4-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file open_xtract-0.1.4.tar.gz.

File metadata

  • Download URL: open_xtract-0.1.4.tar.gz
  • Upload date:
  • Size: 515.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for open_xtract-0.1.4.tar.gz
Algorithm Hash digest
SHA256 40dcc7e5200f2e5be6fe2ff44ec3f8a0cff11e00a990b5d5ac315211d4a6f390
MD5 f1aed4b80116008b22ef46ad386e19c6
BLAKE2b-256 5774a514c94a358b3cf1826873acb62edaee1c2e94c03449cf65fabbb9987dc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_xtract-0.1.4.tar.gz:

Publisher: release.yml on Mellow-Artificial-Intelligence/open-xtract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file open_xtract-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: open_xtract-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for open_xtract-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e9a127faa5744f9b6c7e28c81c3489ddd1f5bbf4283e480b942aaecede9e2c7a
MD5 3b6bd58023a193313cea03817b9413df
BLAKE2b-256 7d5066a53b109e63a7f890e5869f8b5998b2b769edd74800f9b6451a53d4599b

See more details on using hashes here.

Provenance

The following attestation bundles were made for open_xtract-0.1.4-py3-none-any.whl:

Publisher: release.yml on Mellow-Artificial-Intelligence/open-xtract

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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