Skip to main content

Roset Python SDK -- Unstructured-to-Structured Transformation Engine

Project description

Roset Logo

roset-python

Python SDK for the Roset transformation engine

WebsiteDocsConsole

PyPI Version License Python


Upload any unstructured file -- get back markdown, embeddings, metadata, thumbnails, and a searchable index. The Python SDK for the Roset unstructured-to-structured transformation engine.

Installation

pip install roset

Quick Start

from roset import Client

client = Client(api_key="rsk_...")

# Upload a file -- Roset routes to the right extraction provider
result = client.upload("report.pdf", space="default")
file_id = result["file"]["id"]
job_id = result["job"]["id"]

# Check processing status
job = client.jobs.get(job_id)
print(job["status"])  # "completed"

# Retrieve extracted variants
variants = client.files.list_variants(file_id)
# -> markdown, embeddings, metadata, thumbnails, searchable-index

# Get a specific variant
markdown = client.files.get_variant(file_id, "markdown")

# Cancel or retry a job
client.jobs.cancel(job_id)
client.jobs.retry(job_id)

Features

Resource Description
upload Upload files -- automatic provider routing (Reducto, Gemini, Whisper)
files List, get, delete files and retrieve variants (markdown, embeddings, metadata, thumbnails, searchable-index)
jobs Track processing status, cancel, retry
spaces Optional namespace scoping for B2B SaaS multi-tenancy
connections Connect external storage providers (S3, GCS, Azure Blob, R2, MinIO, Supabase Storage)
nodes Browse file/folder hierarchy within storage connections
analytics Processing metrics, file-type breakdowns, failure analysis, volume trends
webhooks Subscribe to processing lifecycle events (job.completed, variant.ready, etc.)

Resources

Files

# List files (with optional filters)
files = client.files.list(space="default", status="completed")

# Get a file (includes variants)
file = client.files.get("file-id")

# Delete a file and its variants
client.files.delete("file-id")

# List all variants for a file
variants = client.files.list_variants("file-id")

# Get a specific variant type
markdown = client.files.get_variant("file-id", "markdown")
embeddings = client.files.get_variant("file-id", "embeddings")
thumbnail = client.files.get_variant("file-id", "thumbnail")
metadata = client.files.get_variant("file-id", "metadata")
index = client.files.get_variant("file-id", "searchable-index")

Jobs

# List processing jobs
jobs = client.jobs.list(status="processing")

# Get job details
job = client.jobs.get("job-id")

# Cancel a running job
client.jobs.cancel("job-id")

# Retry a failed job
client.jobs.retry("job-id")

Spaces

# List all spaces
spaces = client.spaces.list()

# Get statistics for a space
stats = client.spaces.get_stats("default")

Connections

# Connect an S3 bucket
conn = client.connections.create(
    provider="s3",
    name="My Bucket",
    bucket="my-bucket",
    # ...provider-specific credentials
)

# List connections
connections = client.connections.list()

# Test connectivity
client.connections.test("connection-id")

# Trigger file sync
client.connections.sync("connection-id")

# Delete a connection
client.connections.delete("connection-id")

Nodes

# List nodes (files/folders from connected storage)
nodes = client.nodes.list(parent_id="folder-id")

# Get a node
node = client.nodes.get("node-id")

# Get a signed download URL
download = client.nodes.download("node-id")

# Delete a node
client.nodes.delete("node-id")

Analytics

# Organization overview
overview = client.analytics.overview()

# Processing metrics (last 30 days)
metrics = client.analytics.processing(days=30)

# File type distribution
types = client.analytics.file_types()

# Per-space statistics
spaces = client.analytics.spaces()

# Recent failures
failures = client.analytics.failures(limit=20)

# Upload volume trends
volume = client.analytics.volume(days=30)

Webhooks

# Create a webhook subscription
webhook = client.webhooks.create(
    url="https://example.com/webhook",
    events=["job.completed", "job.failed", "variant.ready"],
)

# List webhooks
webhooks = client.webhooks.list()

# Update a webhook
client.webhooks.update("webhook-id", events=["job.completed"])

# View delivery history
deliveries = client.webhooks.deliveries("webhook-id")

# Send a test event
client.webhooks.test("webhook-id")

# Delete a webhook
client.webhooks.delete("webhook-id")

Context Manager

with Client(api_key="rsk_...") as client:
    result = client.upload("data.pdf", space="default")

Configuration

client = Client(
    api_key="rsk_...",
    base_url="https://api.roset.dev",  # Override for local dev
    timeout=30.0,                       # Request timeout in seconds
    max_retries=3,                      # Retry on transient failures
)

Error Handling

from roset import Client, RosetAPIError, RosetNotFoundError, RosetRateLimitError

client = Client(api_key="rsk_...")

try:
    file = client.files.get("nonexistent-id")
except RosetNotFoundError:
    print("File not found")
except RosetRateLimitError:
    print("Rate limited -- back off and retry")
except RosetAPIError as e:
    print(f"API error {e.status_code}: {e.message}")

Documentation

Full API docs at docs.roset.dev/sdk/python.

License

Apache 2.0 (c) Roset

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

roset-0.1.1.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

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

roset-0.1.1-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file roset-0.1.1.tar.gz.

File metadata

  • Download URL: roset-0.1.1.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for roset-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1a05fe0e6078f5390bc6b44899f8430898b362003f20c591f753822776e99f0a
MD5 eed3f0d73597f4f07a7c99b49415387a
BLAKE2b-256 3c8ef08693c16ee5718d6078e1f955f082e5f2ad536b382da59c457b6a674202

See more details on using hashes here.

File details

Details for the file roset-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: roset-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for roset-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe1a0d45f7b6690416ad5024f96bf877b2602a1654254653794811a69d54a804
MD5 71d34f2a789e18587d441f51240bd61b
BLAKE2b-256 4e76ef3dad9de929fe7fe192e36ea2c0f6cc16fba5f9ea09c1e4d6fa037f87c0

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