The following information applies to the legacy Unstructured Partition Endpoint.Unstructured recommends that you use the
on-demand jobs functionality in the
Unstructured API instead. Unstructured’s on-demand jobs provide
many benefits over the legacy Unstructured Partition Endpoint, including support for:
- Production-level usage.
- Multiple local input files in batches.
- The latest and highest-performing models.
- Post-transform enrichments.
- All of Unstructured’s chunking strategies.
- The generation of vector embeddings.
Task
You want to get, and print or save, the contents of elements that have been chunked.Approach
Chunked elements are typically represented in this format:text field.
The chunked content might not contain all of its associated content. To get all of the elements that were used to derive this chunked content, extract the contents of the element’s orig_elements field, which is nested inside of its parent metadata field.
The contents of the orig_elements field is in compressed Base64 gzipped format. To get the content, Base64-decode the bytes, decompress them, and then decode them using UTF-8.
To run this example
You will need to chunk a document during processing. This example uses a PDF file chunked into 200- to 300-character elements.Code
For the Unstructured Python SDK, you’ll need: These environment variables:UNSTRUCTURED_API_KEY- Your Unstructured API key value.UNSTRUCTURED_API_URL- Your Unstructured API URL.

