Skip to main content

Smart PDF Loader

pip install llama-index-readers-smart-pdf-loader

SmartPDFLoader is a super fast PDF reader that understands the layout structure of PDFs such as nested sections, nested lists, paragraphs and tables. It uses layout information to smartly chunk PDFs into optimal short contexts for LLMs.

Requirements

Install the llmsherpa library if it is not already present:

pip install llmsherpa

Usage

Here's an example usage of the SmartPDFLoader:

from llama_index.readers.smart_pdf_loader import SmartPDFLoader

llmsherpa_api_url = "https://readers.llmsherpa.com/api/document/developer/parseDocument?renderFormat=all"
pdf_url = "https://arxiv.org/pdf/1910.13461.pdf"  # also allowed is a file path e.g. /home/downloads/xyz.pdf
pdf_loader = SmartPDFLoader(llmsherpa_api_url=llmsherpa_api_url)
documents = pdf_loader.load_data(pdf_url)

Now you can use the documents with other LlamaIndex components. For example, for retrieval augmented generation, try this:

from llama_index.core import VectorStoreIndex

index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()

response = query_engine.query("list all the tasks that work with bart")
print(response)

response = query_engine.query("what is the bart performance score on squad")
print(response)

More Examples

SmartPDFLoader is based on LayoutPDFReader from llmsherpa library. See the documentation there to explore other ways to use the library for connecting data from your PDFs with LLMs.

Metadata

Release files for llama-index-readers-smart-pdf-loader 0.6.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-smart-pdf-loader 0.6.0
File Size Uploaded Provenance Actions
llama_index_readers_smart_pdf_loader-0.6.0.tar.gz 4.3 kB Without provenance Details for llama_index_readers_smart_pdf_loader-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-readers-smart-pdf-loader 0.6.0
File Interpreter ABI Platform Actions
llama_index_readers_smart_pdf_loader-0.6.0-py3-none-any.whl Python 3 none any Details for llama_index_readers_smart_pdf_loader-0.6.0-py3-none-any.whl

Total release size: 8.3 kB

Release files / llama_index_readers_smart_pdf_loader-0.6.0.tar.gz

Download URL llama_index_readers_smart_pdf_loader-0.6.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b6acc13e3e617335746163f38140aa232ba73305f983f8db91ba7a1c61c8ea7b
BLAKE2b-256 checksum
How to use checksums
aa7b50004e642acf0ef648ea840371ba33fe384bd7d4aa794f4a733b9c8c9ea3
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_smart_pdf_loader-0.6.0-py3-none-any.whl

Download URL llama_index_readers_smart_pdf_loader-0.6.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db89bbb918e7b72503040ac500ca6643ffe94b4ca6e8e55404290eaca07818fe
BLAKE2b-256 checksum
How to use checksums
8b3f2f1d57caa4043de5c840971f94e7c3ef690a4e2d2f2ecb330a75c69a4f1e
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-smart-pdf-loader 0.6.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