Unstructured recommends that you use the Unstructured user interface (UI) or the Unstructured API instead of the Unstructured Ingest CLI or the Unstructured Ingest Python library.
The Unstructured UI and API provide a full range of partitioning, chunking, embedding, and enrichment options for your files and data. It also uses the latest and highest-performing models on the market today, and it has built-in logic to deliver the highest quality results at the lowest cost.
The Unstructured Ingest CLI and the Unstructured Ingest Python library are not being actively updated to include these and other Unstructured API features.
You can send multiple files in batches to be ingested by Unstructured for processing. Ingestion is the term that Unstructured uses to refer to the set of activities that happens when files are input for processing. Learn more.
You can send batches to Unstructured by using the following tools:
The following 3-minute video shows how to use the Unstructured Ingest Python library to send multiple PDFs from a local directory in batches to be ingested by Unstructured for processing:
The following 5-minute video goes into more detail about the various components of the Unstructured Ingest Python library:
The Unstructured ingest flow is similar to an extract, transform and load (ETL) data pipeline. Because of this, a customer-defined implementation of the Unstructured ingest flow is sometimes referred to as an ingest pipeline or simply a pipeline. An Unstructured ingest pipeline contains the following logical steps:
Index
Reaches out to the source location and pulls in metadata for each document.
For example, this could include information such as the path to the files to be analyzed.
--input-path
command option.<Prefix>IndexerConfig
class (where <Prefix>
represents the connector provider’s name, such as Azure
for Azure.)Post-Index Filter
After indexing, you might not want to download everything that was indexed.
For example, you might want to download only files that match specific types, file names, paths, or sizes.
For the Unstructured Ingest Python library, you can control this behavior through the FiltererConfig
class.
Download
Using the information generated from the indexer and the filter, downloads the content as files on the local file system for processing. This may require manipulation of the data to prepare it for partitioning.
For example, this could include information such as the path to a local directory to download files to.
--download-dir
command option.<Prefix>DownloaderConfig
class.Post-Download Filter
After downloading, if uncompression is enabled, you might not want to uncompress everything that was downloaded. The filter that was defined at the beginning is repeated here.
Uncompress
If enabled, searches for any compressed files (Unstructured supports TAR and ZIP) and uncompresses them.
--uncompress
command option.UncompressConfig
class.Post-Uncompress Filter
After downloading, and uncompressing if enabled, you might not want to partition everything that was downloaded, and uncompressed if enabled. The filter that was defined at the beginning is repeated here again.
Partition
Generates the structured enriched content from the local files that have been downloaded, uncompressed if enabled, and filtered. Both local-based partitioning and Unstructured-based partitioning is supported, with API services-based partitioning set to run asynchronously and local-based partitioning set to run through multiprocessing.
For the Unstructured Ingest Python library, you can control this behavior through the PartitionerConfig
class.
Chunk
Optionally, chunks the partitioned content. Chunking can also be run locally or through Unstructured, with asynchronous or multiprocessing behaviors set in the same approach as the partitioner.
For the Unstructured Ingest Python library, you can control this behavior through the ChunkerConfig
class.
Embed
Optionally, generates vector embeddings for each element in the structured output. Most of the time, this is done through API calls to a third-party embedding vendor and therefore runs asynchronously. But it can also use a locally available Hugging Face model, which will run through multiprocessing.
For the Unstructured Ingest Python library, you can control this behavior through the EmbedderConfig
class.
Stage
This is an optional step that does not apply most of the time. However, sometimes the data needs to be modified from the existing structure to better support the upload step, such as converting it to a CSV file for tabular-based destinations.
For the Unstructured Ingest Python library, you can control this behavior, where available for a connector, through its <Prefix>UploadStagerConfig
class.
Upload
Writes the local content to the destination. If no destination is provided, the local one will be used, which writes the final result to a location on the local filesystem. If batch uploads are needed, this will run in a single process with access to all documents. If batch uploads are not supported, all documents can be uploaded concurrently by using the asynchronous approach.
For the Unstructured Ingest Python library, you can control this behavior through a connector’s <Prefix>UploaderConfig
class.
You can connect any available source connector to any available destination connector. However, the source connector code examples in the documentation show connecting only to the local destination connector. Similarly, the destination connector code examples in the documentation show connecting only to the local source connector.
To quickly generate an Unstructured Ingest Python library code example that connects any available source connector to any available destination connector, do the following:
Open the Unstructured Ingest Code Generator webpage.
Select your input (source) location type from the Get unstructured documents from drop-down list.
Select your output (destination) location type from the Upload RAG-ready documents to drop-down list.
Select your chunking strategy from the Chunking strategy drop-down list:
Table
and non-Table
elements in the same chunk.basic
strategy and also preserve section boundaries. Optionally preserve page boundaries as well.basic
strategy and also preserve page boundaries.sentence-transformers/multi-qa-mpnet-base-dot-v1
embedding model to identify topically similar sequential elements and combine them into chunks. This strategy is availably only when calling Unstructured.To learn more, see Chunking strategies and Chunking configuration.
For any chunking strategy other than None:
To learn more, see Chunking configuration.
To generate vector embeddings, select the provider in the Embedding provider drop-down list.
To learn more, see Embedding configuraton.
Click Generate code.
Copy the example code from the Generated Code pane into your code project.
The code example will contain one or more environment variables that you must set for the code to run correctly. To learn what to set these variables to, click the documentation links that are below the Generated Code pane.
Calls to the Unstructured CLI or Unstructured Ingest Python library that are routed to Unstructured’s software-as-a-service (SaaS) for processing (for example, by specifying an Unstructured API key and an Unstructured SaaS URL) require an Unstructured account for billing purposes.
Unstructured offers three account pricing plans:
For more details, see the Unstructured Pricing page.
Some of these plans are billed on a per-page basis.
Unstructured calculates a page as follows:
.pdf
, .pptx
, and .tiff
..docx
files that have page metadata, Unstructured calculates the number of pages based on that metadata.Unstructured recommends that you use the Unstructured user interface (UI) or the Unstructured API instead of the Unstructured Ingest CLI or the Unstructured Ingest Python library.
The Unstructured UI and API provide a full range of partitioning, chunking, embedding, and enrichment options for your files and data. It also uses the latest and highest-performing models on the market today, and it has built-in logic to deliver the highest quality results at the lowest cost.
The Unstructured Ingest CLI and the Unstructured Ingest Python library are not being actively updated to include these and other Unstructured API features.
You can send multiple files in batches to be ingested by Unstructured for processing. Ingestion is the term that Unstructured uses to refer to the set of activities that happens when files are input for processing. Learn more.
You can send batches to Unstructured by using the following tools:
The following 3-minute video shows how to use the Unstructured Ingest Python library to send multiple PDFs from a local directory in batches to be ingested by Unstructured for processing:
The following 5-minute video goes into more detail about the various components of the Unstructured Ingest Python library:
The Unstructured ingest flow is similar to an extract, transform and load (ETL) data pipeline. Because of this, a customer-defined implementation of the Unstructured ingest flow is sometimes referred to as an ingest pipeline or simply a pipeline. An Unstructured ingest pipeline contains the following logical steps:
Index
Reaches out to the source location and pulls in metadata for each document.
For example, this could include information such as the path to the files to be analyzed.
--input-path
command option.<Prefix>IndexerConfig
class (where <Prefix>
represents the connector provider’s name, such as Azure
for Azure.)Post-Index Filter
After indexing, you might not want to download everything that was indexed.
For example, you might want to download only files that match specific types, file names, paths, or sizes.
For the Unstructured Ingest Python library, you can control this behavior through the FiltererConfig
class.
Download
Using the information generated from the indexer and the filter, downloads the content as files on the local file system for processing. This may require manipulation of the data to prepare it for partitioning.
For example, this could include information such as the path to a local directory to download files to.
--download-dir
command option.<Prefix>DownloaderConfig
class.Post-Download Filter
After downloading, if uncompression is enabled, you might not want to uncompress everything that was downloaded. The filter that was defined at the beginning is repeated here.
Uncompress
If enabled, searches for any compressed files (Unstructured supports TAR and ZIP) and uncompresses them.
--uncompress
command option.UncompressConfig
class.Post-Uncompress Filter
After downloading, and uncompressing if enabled, you might not want to partition everything that was downloaded, and uncompressed if enabled. The filter that was defined at the beginning is repeated here again.
Partition
Generates the structured enriched content from the local files that have been downloaded, uncompressed if enabled, and filtered. Both local-based partitioning and Unstructured-based partitioning is supported, with API services-based partitioning set to run asynchronously and local-based partitioning set to run through multiprocessing.
For the Unstructured Ingest Python library, you can control this behavior through the PartitionerConfig
class.
Chunk
Optionally, chunks the partitioned content. Chunking can also be run locally or through Unstructured, with asynchronous or multiprocessing behaviors set in the same approach as the partitioner.
For the Unstructured Ingest Python library, you can control this behavior through the ChunkerConfig
class.
Embed
Optionally, generates vector embeddings for each element in the structured output. Most of the time, this is done through API calls to a third-party embedding vendor and therefore runs asynchronously. But it can also use a locally available Hugging Face model, which will run through multiprocessing.
For the Unstructured Ingest Python library, you can control this behavior through the EmbedderConfig
class.
Stage
This is an optional step that does not apply most of the time. However, sometimes the data needs to be modified from the existing structure to better support the upload step, such as converting it to a CSV file for tabular-based destinations.
For the Unstructured Ingest Python library, you can control this behavior, where available for a connector, through its <Prefix>UploadStagerConfig
class.
Upload
Writes the local content to the destination. If no destination is provided, the local one will be used, which writes the final result to a location on the local filesystem. If batch uploads are needed, this will run in a single process with access to all documents. If batch uploads are not supported, all documents can be uploaded concurrently by using the asynchronous approach.
For the Unstructured Ingest Python library, you can control this behavior through a connector’s <Prefix>UploaderConfig
class.
You can connect any available source connector to any available destination connector. However, the source connector code examples in the documentation show connecting only to the local destination connector. Similarly, the destination connector code examples in the documentation show connecting only to the local source connector.
To quickly generate an Unstructured Ingest Python library code example that connects any available source connector to any available destination connector, do the following:
Open the Unstructured Ingest Code Generator webpage.
Select your input (source) location type from the Get unstructured documents from drop-down list.
Select your output (destination) location type from the Upload RAG-ready documents to drop-down list.
Select your chunking strategy from the Chunking strategy drop-down list:
Table
and non-Table
elements in the same chunk.basic
strategy and also preserve section boundaries. Optionally preserve page boundaries as well.basic
strategy and also preserve page boundaries.sentence-transformers/multi-qa-mpnet-base-dot-v1
embedding model to identify topically similar sequential elements and combine them into chunks. This strategy is availably only when calling Unstructured.To learn more, see Chunking strategies and Chunking configuration.
For any chunking strategy other than None:
To learn more, see Chunking configuration.
To generate vector embeddings, select the provider in the Embedding provider drop-down list.
To learn more, see Embedding configuraton.
Click Generate code.
Copy the example code from the Generated Code pane into your code project.
The code example will contain one or more environment variables that you must set for the code to run correctly. To learn what to set these variables to, click the documentation links that are below the Generated Code pane.
Calls to the Unstructured CLI or Unstructured Ingest Python library that are routed to Unstructured’s software-as-a-service (SaaS) for processing (for example, by specifying an Unstructured API key and an Unstructured SaaS URL) require an Unstructured account for billing purposes.
Unstructured offers three account pricing plans:
For more details, see the Unstructured Pricing page.
Some of these plans are billed on a per-page basis.
Unstructured calculates a page as follows:
.pdf
, .pptx
, and .tiff
..docx
files that have page metadata, Unstructured calculates the number of pages based on that metadata.