Examples
Multi-files API Processing
Was this page helpful?
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
pip install "unstructured[s3]"
from unstructured.ingest.interfaces import (
FsspecConfig,
PartitionConfig,
ProcessorConfig,
ReadConfig,
)
from unstructured.ingest.runner import S3Runner
from unstructured.chunking.title import chunk_by_title
from unstructured.staging.base import dict_to_elements
UNSTRUCTURED_API_KEY = os.getenv('UNSTRUCTURED_API_KEY')
S3_URL = "s3://rh-financial-reports/world-development-bank-2023/"
runner = S3Runner(
processor_config=ProcessorConfig(
verbose=True,
output_dir="Connector-Output",
num_processes=8,
),
read_config=ReadConfig(),
partition_config=PartitionConfig(
partition_endpoint="https://api.unstructured.io/general/v0/general",
partition_by_api=True,
api_key=UNSTRUCTURED_API_KEY,
strategy="hi_res",
hi_res_model_name="yolox",
),
fsspec_config=FsspecConfig(
remote_url=S3_URL,
),
)
runner.run(anonymous=True)
combined_json_data = read_and_combine_json("Connector-Output/world-development-bank-2023")
elements = dict_to_elements(combined_json_data)
chunks = chunk_by_title(elements)
Was this page helpful?
