Skip to main content

Preprocess Loader

This package has been discontinued. The Preprocess service is no longer available and will not receive updates or support. Please remove this dependency from your projects.


pip install llama-index-readers-preprocess

Preprocess is an API service that splits any kind of document into optimal chunks of text for use in language model tasks. Given documents in input Preprocess splits them into chunks of text that respect the layout and semantics of the original document. We split the content by taking into account sections, paragraphs, lists, images, data tables, text tables, and slides, and following the content semantics for long texts. We support PDFs, Microsoft Office documents (Word, PowerPoint, Excel), OpenOffice documents (ods, odt, odp), HTML content (web pages, articles, emails), and plain text.

This loader integrates with the Preprocess API library to provide document conversion and chunking or to load already chunked files inside LlamaIndex.

Requirements

Install the Python Preprocess library if it is not already present:

pip install pypreprocess

Usage

To use this loader, you need to pass the Preprocess API Key. When initializing PreprocessReader, you should pass your API Key, if you don't have it yet, please ask for one at support@preprocess.co. Without an API Key, the loader will raise an error.

To chunk a file pass a valid filepath and the reader will start converting and chunking it. Preprocess will chunk your files by applying an internal Splitter. For this reason, you should not parse the document into nodes using a Splitter or applying a Splitter while transforming documents in your IngestionPipeline.

If you want to handle the nodes directly:

from llama_index.core import VectorStoreIndex

from llama_index.readers.preprocess import PreprocessReader

# pass a filepath and get the chunks as nodes
loader = PreprocessReader(
    api_key="your-api-key", filepath="valid/path/to/file"
)
nodes = loader.get_nodes()

# import the nodes in a Vector Store with your configuration
index = VectorStoreIndex(nodes)
query_engine = index.as_query_engine()

By default load_data() returns a document for each chunk, remember to not apply any splitting to these documents

from llama_index.core import VectorStoreIndex

from llama_index.readers.preprocess import PreprocessReader

# pass a filepath and get the chunks as nodes
loader = PreprocessReader(
    api_key="your-api-key", filepath="valid/path/to/file"
)
documents = loader.load_data()

# don't apply any Splitter parser to documents
# if you have an ingestion pipeline you should not apply a Splitter in the transformations
# import the documents in a Vector Store, if you set the service_context parameter remember to avoid including a splitter
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()

If you want to return only the extracted text and handle it with custom pipelines set return_whole_document = True

# pass a filepath and get the chunks as nodes
loader = PreprocessReader(
    api_key="your-api-key", filepath="valid/path/to/file"
)
document = loader.load_data(return_whole_document=True)

If you want to load already chunked files you can do it via process_id passing it to the reader.

# pass a process_id obtained from a previous instance and get the chunks as one string inside a Document
loader = PreprocessReader(api_key="your-api-key", process_id="your-process-id")

This loader is designed to be used as a way to load data into LlamaIndex.

Other info

PreprocessReader is based on pypreprocess from Preprocess library. For more information or other integration needs please check the documentation.

Metadata

Release files for llama-index-readers-preprocess 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-readers-preprocess 0.7.0
File Size Uploaded Provenance Actions
llama_index_readers_preprocess-0.7.0.tar.gz 4.7 kB Without provenance Details for llama_index_readers_preprocess-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-readers-preprocess 0.7.0
File Interpreter ABI Platform Actions
llama_index_readers_preprocess-0.7.0-py3-none-any.whl Python 3 none any Details for llama_index_readers_preprocess-0.7.0-py3-none-any.whl

Total release size: 9.0 kB

Release files / llama_index_readers_preprocess-0.7.0.tar.gz

Download URL llama_index_readers_preprocess-0.7.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
758ca9060b47ce68d9177a92a2092f4d65f6a1ef746af5528700c22cb5d019e4
BLAKE2b-256 checksum
How to use checksums
9530a783d6b37265142bd44a928bfdff80600aa24c6d4b9987818d06caf8f54a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / llama_index_readers_preprocess-0.7.0-py3-none-any.whl

Download URL llama_index_readers_preprocess-0.7.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
332f6193cde42311bbc9d9ad122c0321b063bd34c672c50613fb5c0b1196c085
BLAKE2b-256 checksum
How to use checksums
ec22cee3016743ae7ccc9787b1bb1df2a53c5127dde33c73ba1e22f6a9fc76ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for llama-index-readers-preprocess 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page