unstract-client


Nameunstract-client JSON
Version 1.1.0 PyPI version JSON
download
home_pageNone
SummaryPython client for the Unstract LLM-powered structured data extraction platform
upload_time2024-11-11 12:20:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT
keywords unstract cli apps sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # unstract-python-client
[![PyPI - Downloads](https://img.shields.io/pypi/dm/unstract-client)](https://pypi.org/project/unstract-client/)
[![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FZipstack%2Funstract-python-client%2Fmain%2Fpyproject.toml)
](https://pypi.org/project/unstract-client/)
[![PyPI - Version](https://img.shields.io/pypi/v/unstract-client)](https://pypi.org/project/unstract-client/)

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


## Installation

You can install the Unstract Python Client using pip:

```bash
pip install unstract-client
```

## Usage

First, import the `APIDeploymentsClient` from the `client` module:

```python
from unstract.api_deployments.client import APIDeploymentsClient
```

Then, create an instance of the `APIDeploymentsClient`:

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

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

```python
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](https://join-slack.unstract.com/) around LLMs, their ecosystem and leveraging them to automate the previously unautomatable!

[Unstract Cloud](https://unstract.com/): Signup and Try!

[Unstract developer documentation](https://docs.unstract.com/): Learn more about Unstract and its API.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "unstract-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "unstract cli apps sdk",
    "author": null,
    "author_email": "Zipstack Inc <devsupport@zipstack.com>",
    "download_url": "https://files.pythonhosted.org/packages/61/64/d88ec8e840051825979fc24c57ad5bb712840b766887fddc0ca078ee984b/unstract_client-1.1.0.tar.gz",
    "platform": null,
    "description": "# unstract-python-client\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/unstract-client)](https://pypi.org/project/unstract-client/)\n[![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2FZipstack%2Funstract-python-client%2Fmain%2Fpyproject.toml)\n](https://pypi.org/project/unstract-client/)\n[![PyPI - Version](https://img.shields.io/pypi/v/unstract-client)](https://pypi.org/project/unstract-client/)\n\nPython client for the Unstract LLM-powered structured data extraction platform\n\n\n## Installation\n\nYou can install the Unstract Python Client using pip:\n\n```bash\npip install unstract-client\n```\n\n## Usage\n\nFirst, import the `APIDeploymentsClient` from the `client` module:\n\n```python\nfrom unstract.api_deployments.client import APIDeploymentsClient\n```\n\nThen, create an instance of the `APIDeploymentsClient`:\n\n```python\nclient = APIDeploymentsClient(api_url=\"url\", api_key=\"your_api_key\")\n```\n\nNow, you can use the client to interact with the Unstract API deployments API:\n\n```python\ntry:\n    adc = APIDeploymentsClient(\n        api_url=os.getenv(\"UNSTRACT_API_URL\"),\n        api_key=os.getenv(\"UNSTRACT_API_DEPLOYMENT_KEY\"),\n        api_timeout=10,\n        logging_level=\"DEBUG\",\n        include_metadata=False # optional\n    )\n    # Replace files with pdfs\n    response = adc.structure_file(\n        [\"<files>\"]\n    )\n    print(response)\n    if response[\"pending\"]:\n        while True:\n            p_response = adc.check_execution_status(\n                response[\"status_check_api_endpoint\"]\n            )\n            print(p_response)\n            if not p_response[\"pending\"]:\n                break\n            print(\"Sleeping and checking again in 5 seconds..\")\n            time.sleep(5)\nexcept APIDeploymentsClientException as e:\n    print(e)\n```\n\n## Parameter Details\n\n`api_timeout`: Set a timeout for API requests, e.g., `api_timeout=10`.\n`logging_level`: Set logging verbosity (e.g., \"`DEBUG`\").\n`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.\n\n\n## Questions and Feedback\n\nOn Slack, [join great conversations](https://join-slack.unstract.com/) around LLMs, their ecosystem and leveraging them to automate the previously unautomatable!\n\n[Unstract Cloud](https://unstract.com/): Signup and Try!\n\n[Unstract developer documentation](https://docs.unstract.com/): Learn more about Unstract and its API.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python client for the Unstract LLM-powered structured data extraction platform",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://unstract.com",
        "Source": "https://github.com/Zipstack/unstract-python-client"
    },
    "split_keywords": [
        "unstract",
        "cli",
        "apps",
        "sdk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e7ae824f775db0502ab909c1efccb8399b0cd0899dff2ccc4438cd822a8e631",
                "md5": "aa23bb670bbcecfa639db7039af67048",
                "sha256": "5cc04efcb782e318d16363a0f4b890f61dc71024b2573d745aa66f27aad09703"
            },
            "downloads": -1,
            "filename": "unstract_client-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aa23bb670bbcecfa639db7039af67048",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 6517,
            "upload_time": "2024-11-11T12:20:17",
            "upload_time_iso_8601": "2024-11-11T12:20:17.563355Z",
            "url": "https://files.pythonhosted.org/packages/0e/7a/e824f775db0502ab909c1efccb8399b0cd0899dff2ccc4438cd822a8e631/unstract_client-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6164d88ec8e840051825979fc24c57ad5bb712840b766887fddc0ca078ee984b",
                "md5": "4317e1cd4b52e9c8ed6652149293ba67",
                "sha256": "51b90adf5d9ac83d1139f943dbdf6d299deed3aa4f3422dd1e99ced02cd13798"
            },
            "downloads": -1,
            "filename": "unstract_client-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4317e1cd4b52e9c8ed6652149293ba67",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 5878,
            "upload_time": "2024-11-11T12:20:18",
            "upload_time_iso_8601": "2024-11-11T12:20:18.515235Z",
            "url": "https://files.pythonhosted.org/packages/61/64/d88ec8e840051825979fc24c57ad5bb712840b766887fddc0ca078ee984b/unstract_client-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 12:20:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Zipstack",
    "github_project": "unstract-python-client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "unstract-client"
}
        
Elapsed time: 0.73457s