Skip to main content

Installation

We recommend installing the Aryn SDK library using pip:

Partitioning a Document

Partition a document like so:
partition_file takes the same options as curl, except as keyword arguments. You can find a list of options here.

Extract properties from a document

Create a schema by hand, or get help from DocParse Suggest Properties. Provide the schema in property_extraction_options like so:
You can add "voting": True to the property_extraction_options dictionary to enable to enable voting across multiple LLMs.

Key management

By default, aryn-sdk looks for Aryn API keys first in the environment variable ARYN_API_KEY, and then in ~/.aryn/config.yaml. You can override this behavior by specifying a key directly or a different path to the Aryn config file:

Helper Functions

aryn_sdk provides some helper functions to make working with and visualizing the output of partition_file easier.

Different File Formats

It is easy to process files with different formats using the aryn-sdk:

URLs as input

The Aryn SDK also supports document input via a file path or URL to a document hosted on a remote server:

Chunking a document

Chunking support has been added in v0.1.9. You can enable the default chunking options by specifying an empty dict:
Here is an example specifying certain chunking options:
The full chunking options are documented here.

Asynchronous requests

If you need to submit a large number of partitioning requests at once, we recommend using the asynchronous version of the API: partition_file_async_submit. The asynchronous API submits a file partitioning task to Aryn and returns with its task_id. You can use the returned task_id to keep track of your request to partition the file using the partition_file_async_result. To learn more check out the documentation and the tutorial.