Skip to main content

Python client for the Unstract LLM-powered structured data extraction platform

Project description

unstract-python-client

PyPI - Downloads Python Version from PEP 621 TOML PyPI - Version

Python client for the Unstract LLM-powered structured data extraction platform

Installation

You can install the Unstract Python Client using pip:

pip install unstract-client

Usage

First, import the APIDeploymentsClient from the client module:

from unstract.api_deployments.client import APIDeploymentsClient

Then, create an instance of the APIDeploymentsClient:

client = APIDeploymentsClient(api_url="url", api_key="your_api_key")

Now, you can use the client to interact with the Unstract API deployments API:

try:
    adc = APIDeploymentsClient(
        api_url=os.getenv("UNSTRACT_API_URL"),
        api_key=os.getenv("UNSTRACT_API_DEPLOYMENT_KEY"),
        api_timeout=10,
        logging_level="DEBUG",
        include_metadata=False # optional
    )
    # Replace files with pdfs
    response = adc.structure_file(
        ["<files>"]
    )
    print(response)
    if response["pending"]:
        while True:
            p_response = adc.check_execution_status(
                response["status_check_api_endpoint"]
            )
            print(p_response)
            if not p_response["pending"]:
                break
            print("Sleeping and checking again in 5 seconds..")
            time.sleep(5)
except APIDeploymentsClientException as e:
    print(e)

Parameter Details

api_timeout: Set a timeout for API requests, e.g., api_timeout=10. logging_level: Set logging verbosity (e.g., "DEBUG"). include_metadata: If set to True, the response will include additional metadata (cost, tokens consumed and context) for each call made by the Prompt Studio exported tool.

Questions and Feedback

On Slack, join great conversations around LLMs, their ecosystem and leveraging them to automate the previously unautomatable!

Unstract Cloud: Signup and Try!

Unstract developer documentation: Learn more about Unstract and its API.

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

unstract_client-1.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

unstract_client-1.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file unstract_client-1.1.0.tar.gz.

File metadata

  • Download URL: unstract_client-1.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.10.0 CPython/3.8.10

File hashes

Hashes for unstract_client-1.1.0.tar.gz
Algorithm Hash digest
SHA256 51b90adf5d9ac83d1139f943dbdf6d299deed3aa4f3422dd1e99ced02cd13798
MD5 4317e1cd4b52e9c8ed6652149293ba67
BLAKE2b-256 6164d88ec8e840051825979fc24c57ad5bb712840b766887fddc0ca078ee984b

See more details on using hashes here.

File details

Details for the file unstract_client-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for unstract_client-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cc04efcb782e318d16363a0f4b890f61dc71024b2573d745aa66f27aad09703
MD5 aa23bb670bbcecfa639db7039af67048
BLAKE2b-256 0e7ae824f775db0502ab909c1efccb8399b0cd0899dff2ccc4438cd822a8e631

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page