Skip to main content

Python SDK for the Unstructured Platform API

Project description

Unstructured Platform SDK

Unstructured.io Logo

A Python SDK for the Unstructured Platform API.

Unstructured Platform is an enterprise-grade ETL (Extract, Transform, Load) platform designed specifically for Large Language Models (LLMs). It provides a no-code UI and production-ready infrastructure to help organizations transform raw, unstructured data into LLM-ready formats. With over 18 million downloads and used by more than 50,000 companies, Unstructured Platform enables data scientists and engineers to spend less time collecting and cleaning data, and more time on modeling and analysis.

This SDK was developed by One Minute AI, the AI platform that provides a one-click (or one line of code) way to create AI assistants and apps using data ingested by Unstructured.

Installation

pip install unstructured-platform-sdk

Usage

Initialize the client

from unstructured_platform_sdk import UnstructuredPlatformClient

client = UnstructuredPlatformClient(api_key="your-api-key")

Working with Source Connectors

from unstructured_platform_sdk.models import PublicSourceConnectorType

# List source connectors
sources = client.sources.list()

# Create a source connector
source = client.sources.create(
    name="My S3 Source",
    type=PublicSourceConnectorType.S3,
    config={
        "bucket": "my-bucket",
        "prefix": "documents/",
        "aws_access_key_id": "your-access-key",
        "aws_secret_access_key": "your-secret-key",
    },
)

# Get a source connector
source = client.sources.get(source_id="source-id")

# Update a source connector
updated_source = client.sources.update(
    source_id="source-id",
    config={
        "prefix": "new-prefix/",
    },
)

# Delete a source connector
client.sources.delete(source_id="source-id")

Working with Destination Connectors

from unstructured_platform_sdk.models import PublicDestinationConnectorType

# List destination connectors
destinations = client.destinations.list()

# Create a destination connector
destination = client.destinations.create(
    name="My Elasticsearch Destination",
    type=PublicDestinationConnectorType.ELASTICSEARCH,
    config={
        "host": "https://my-es-cluster.com",
        "index": "documents",
        "api_key": "your-es-api-key",
    },
)

# Get a destination connector
destination = client.destinations.get(destination_id="destination-id")

# Update a destination connector
updated_destination = client.destinations.update(
    destination_id="destination-id",
    config={
        "index": "new-index",
    },
)

# Delete a destination connector
client.destinations.delete(destination_id="destination-id")

Working with Workflows

from unstructured_platform_sdk.models import (
    WorkflowAutoStrategy,
    WorkflowSchedule,
    CronTabEntry,
)

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

# Create a workflow
workflow = client.workflows.create(
    name="My Daily Workflow",
    source_id="source-id",
    destination_id="destination-id",
    workflow_type=WorkflowAutoStrategy.BASIC,
    schedule=WorkflowSchedule(
        crontab_entries=[
            CronTabEntry(cron_expression="0 0 * * *"),  # Daily at midnight
        ],
    ),
)

# Get a workflow
workflow = client.workflows.get(workflow_id="workflow-id")

# Update a workflow
updated_workflow = client.workflows.update(
    workflow_id="workflow-id",
    name="New Workflow Name",
)

# Delete a workflow
client.workflows.delete(workflow_id="workflow-id")

# Run a workflow
workflow = client.workflows.run(workflow_id="workflow-id")

Working with Jobs

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

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

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

License

MIT

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

unstructured_platform-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

unstructured_platform-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file unstructured_platform-0.1.0.tar.gz.

File metadata

  • Download URL: unstructured_platform-0.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.3

File hashes

Hashes for unstructured_platform-0.1.0.tar.gz
Algorithm Hash digest
SHA256 84d5073e448cf19bda2b5eec6662e699fff693a4ca2cbf98ea16b7b12279e6e6
MD5 0746d3640cc900d7eae325d9356c2967
BLAKE2b-256 03f96fdcb898cf344cd8096c3807127996a08a275d8e021417dae7abb3ca7291

See more details on using hashes here.

File details

Details for the file unstructured_platform-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for unstructured_platform-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4209c59ace6fd71511c3ed1c48ef3ad73414186359096d278d1b4705bf386776
MD5 b56b1b1dcc1f3d84509f03e770dc5360
BLAKE2b-256 8e8a8456585888419e1997435b0b45c6dc9123720197e5e46e51f6115587dfe0

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