Skip to main content

A Python client library for the Graphon API - Build graphs from your files

Project description

Graphon Client

A Python client library for the Graphon API - Build unified graphs from your files. See https://app.graphon.ai/docs .

Attaching metadata to files

Files can carry user-provided metadata, supplied as a list of segments. For documents start/end are page numbers (integers); for video/audio they are seconds (a closed range, start <= end). attributes is a map of scalar or scalar-list values. The client does no validation — the server validates and may reject metadata that exceeds its limits (max 2 MiB total, 10000 segments, 64 attributes per segment, key length 128, value length 4096, and 256 entries per list value).

Metadata can be passed as FileMetadata/FileMetadataSegment objects or as a raw {"segments": [...]} dict.

from graphon_client import FileMetadata, FileMetadataSegment, FileUpload

metadata = FileMetadata(
    segments=[
        FileMetadataSegment(
            start=1,
            end=3,
            attributes={"chapter": "Intro", "tags": ["overview", "setup"]},
        ),
    ],
)

# Pass FileUpload specs instead of file_paths to attach per-file metadata.
group_id = await client.upload_process_and_create_group(
    files=[FileUpload(path="manual.pdf", metadata=metadata)],
    group_name="My Graph",
)

files= is accepted by both upload_and_process_files and upload_process_and_create_group as an alternative to file_paths=. The two are mutually exclusive — passing both raises ValueError. Existing file_paths= callers are unaffected.

Submitting a file by URL

submit_from_url ingests a file from an https:// or gs:// URL — the server downloads and processes it. It returns a file_id; poll for completion with poll_file_until_complete.

file_id = await client.submit_from_url(
    source_url="https://example.com/report.pdf",
    file_name="report.pdf",
    file_type="document",
    file_metadata=metadata,  # optional
)
detail = await client.poll_file_until_complete(file_id)

Exported types

GraphonClient, FileObject, FileDetail, GroupDetail, GroupListItem, GroupModifyResult, SkippedFile, QueryResponse, QueryResponseLegacy, FileMetadata, FileMetadataSegment, FileUpload.

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

graphon_client-0.15.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

graphon_client-0.15.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file graphon_client-0.15.0.tar.gz.

File metadata

  • Download URL: graphon_client-0.15.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.14.3

File hashes

Hashes for graphon_client-0.15.0.tar.gz
Algorithm Hash digest
SHA256 e520e65bdf127606f25f685261639ecf620701e4a10c1ea50ad4257ef1d195fb
MD5 a0cec7a3079412fecb48abc5e4ffc482
BLAKE2b-256 a8a4fe30d72516258461a94a29d18d9897972a86c95db2596e51fe81325e7e44

See more details on using hashes here.

File details

Details for the file graphon_client-0.15.0-py3-none-any.whl.

File metadata

File hashes

Hashes for graphon_client-0.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 594e8055fccfd550b7eaaf3329c0793b0e99444530b8f666656dc6e2b101ca7a
MD5 d36ae0249e15cb8a0b76e7255350ce44
BLAKE2b-256 dbcc36476f56b509ecab3740a1ba55342f92238ae29794f2764ba3caa8ef747c

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