Multi-file API processing
This sample code utilizes the Unstructured Serverless API.
Introduction
This guide demonstrates how to process multiple files using the Unstructured API and S3 Connector and implement context-aware chunking. The process involves installing dependencies, configuring settings, and utilizing Python scripts to manage and chunk data effectively.
Prerequisites
Ensure you have Unstructured API key and access to an S3 bucket containing the target files.
Step-by-Step Process
Step 1: Install Unstructured and S3 Dependency
Install the unstructured package with S3 support.
Step 2: Import Libraries
Import necessary libraries from the unstructured package for chunking and S3 processing.
Step 3: Configuration
Set up the API key and S3 URL for accessing the data.
Step 4: Python Runner
Configure and run the S3Runner for processing the data.
Step 5: Combine JSON Files from Multi-files Ingestion
Combine JSON files into a single dataset for further processing.
Step 6: Convert into Unstructured Elements for Chunking
Convert the combined JSON data into Unstructured Elements and apply chunking by title.
Conclusion
Following these steps allows for efficient processing of multiple files using the Unstructured S3 Connector. The context-aware chunking helps in organizing and analyzing the data effectively.
Was this page helpful?