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.dev1.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.dev1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intuned_files-0.1.0.dev1.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.dev1.tar.gz
Algorithm Hash digest
SHA256 8b97dda2971269621a09f2cee469417a2720d0f7a926c37b6d364e1441aaa777
MD5 1360f8f8d146acbae71d271abdf7f59c
BLAKE2b-256 490c3b84b71d7c0f35e8cbb10aa33749ed8dda6516e66ee0277ec7b025af7cc8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for intuned_files-0.1.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2ab294c54010887d824a7f26479b585244b341c59ec144a459b6f5170c9eb3a
MD5 d6974e36892328b31759e21df25076dd
BLAKE2b-256 03d0db493d21de285353dd118178015cc1b9bcef5efea8c7c8e5a432c9b89c10

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