Skip to main content

Intuned SDK for file operations (to markdown, extract tables)

Project description

intuned-files

Intuned SDK for file operations. Provides helpers for converting files to markdown and extracting tables from files, backed by the Intuned file APIs.

Installation

pip install intuned-files
# intuned-runtime is required at runtime (provided by the Intuned runtime).
# intuned-browser is optional, only needed for the `download` file source.

Usage

from intuned_files import to_markdown, extract_tables, PdfFile

# Convert a file to markdown
markdown = await to_markdown(PdfFile(url="https://example.com/report.pdf"))

# Extract tables from a file
tables = await extract_tables(PdfFile(url="https://example.com/report.pdf"))

Both functions also accept a plain dict (typed via the *Dict TypedDicts):

from intuned_files import to_markdown

await to_markdown({"type": "pdf", "url": "https://example.com/report.pdf"})

Extract structured data

extract_structured_data converts the file to markdown and then extracts data against a schema. It requires the optional intuned-browser dependency (the other operations do not); it raises a clear error at call time if it is missing.

from intuned_files import extract_structured_data

data = await extract_structured_data(
    {"type": "pdf", "url": "https://example.com/invoice.pdf"},
    data_schema={
        "type": "object",
        "properties": {
            "invoice_number": {"type": "string"},
            "total": {"type": "number"},
        },
        "required": ["invoice_number", "total"],
    },
)

data_schema accepts a JSON Schema dict or a Pydantic model class.

File sources

Provide exactly one source key on the file object: url, base64, buffer (raw bytes), or download. The download source accepts the result of download_file from intuned-browser, awaited or not:

from intuned_files import to_markdown
from intuned_browser import download_file

await to_markdown({"type": "pdf", "download": download_file(page, trigger)})

Supported file types

PdfFile, ImageFile, SpreadsheetFile (.xlsx), and DocumentFile (.docx).

Development

uv sync
uv run ruff format --check .
uv run ruff check .
uv run pyright
uv run pytest -m "not e2e"

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

intuned_files-0.1.0.dev0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

intuned_files-0.1.0.dev0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file intuned_files-0.1.0.dev0.tar.gz.

File metadata

  • Download URL: intuned_files-0.1.0.dev0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for intuned_files-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 e9bfe07f9b3164d05f60da3d13a5de556802d4fe1db343b3c0f661f344a2696a
MD5 e1080e0c20fc9db47884badcce981b71
BLAKE2b-256 15bc99cafab11837a2026f2dc03232ebbff0948b51dc64f7255e8bda1eb02847

See more details on using hashes here.

File details

Details for the file intuned_files-0.1.0.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for intuned_files-0.1.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 49477cfb3005873f8301061df4f95dc35f9689e8832050b78e29d7c0aaa5d1fe
MD5 45f63336bea79297c99f972269450079
BLAKE2b-256 ec2373ac14531b79132d9129005f27318d784bce9e2043ca07422e398d3d6b8c

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