langchain-hexread
A LangChain document loader for
HexRead. It converts PDFs and images to Markdown through the HexRead API
and returns LangChain Documents. Nothing is processed locally.
API access requires a paid HexRead plan. The free trial is web only, so no API key can be issued for it. Keys are created and revoked in your HexRead dashboard.
Install
pip install langchain-hexread
Python 3.10+. Pulls in hexread and langchain-core.
Quick start
from langchain_hexread import HexReadLoader
docs = HexReadLoader("report.pdf").load() # one Document per page
Set HEXREAD_API_KEY, or pass api_key= to the loader. Nothing is resolved until a load starts,
so building a loader never fails for a missing key.
file_path is a path, raw bytes, or an open binary file, or a sequence of them. A sequence is
converted with bounded concurrency and the Documents come back in input order:
docs = HexReadLoader(["a.pdf", "b.pdf", "scan.png"], max_workers=2).load()
Keep max_workers at or below the concurrency your plan allows, or the API answers 429.
Loader options
| Option | Default | Effect |
|---|---|---|
api_key |
environment, then CLI credential | key for this loader |
model |
auto |
parser to request; naming one requires a plan that allows it |
lang |
unset | OCR language hint, passed through to the parser |
split |
"page" |
"page" for one Document per page, "file" for one per document |
base_url |
https://api.hexread.com/v1 |
API base URL |
client |
built per load | an existing HexRead (sync) or AsyncHexRead (async) to convert with |
extra_metadata |
{} |
extra keys merged into every Document's metadata |
max_workers |
2 |
files converted in parallel when file_path is a sequence |
A loader builds and closes its own client unless you inject one, in which case it is left open for
you to reuse and close. Handing load() an AsyncHexRead (or aload() a HexRead) raises
TypeError with the fix in the message.
Methods
The four BaseLoader entry points all work:
| Method | Returns | Notes |
|---|---|---|
load() |
list[Document] |
everything at once |
lazy_load() |
Iterator[Document] |
nothing is uploaded until the iterator is consumed |
aload() |
list[Document] |
async, driven by AsyncHexRead |
alazy_load() |
AsyncIterator[Document] |
the async twin of lazy_load |
lazy_load() hands each page over as it is built, so a splitter or a vector store can start
before the whole list exists:
for doc in HexReadLoader("report.pdf").lazy_load():
index(doc) # your splitter, embedder, or store
Document metadata
| Key | Value |
|---|---|
source |
the path that was converted |
page |
page index, 0-based (absent when split="file") |
page_label |
page number as a string, 1-based (absent when split="file") |
total_pages |
pages in the converted document |
model |
parser that produced the Markdown |
route_reason |
why the auto router picked that parser (absent when a model was requested) |
parser |
always hexread |
source and a zero-based page are the same shape LangChain's own PDF loaders produce, so
existing chains and citation code keep working.
License
Licensed under the MIT License, © HexWorld Solutions GmbH.
Source, issues and the core client: github.com/HexWorldEU/hexread-python.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_hexread-0.1.0.tar.gz.
File metadata
- Download URL: langchain_hexread-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56f271ebb720c80c276d4d6657ea0ad3f596680bee8199a0f6ca19e0a63f624a
|
|
| MD5 |
a1ad662211f6aa2f38bb72228c5ac1c4
|
|
| BLAKE2b-256 |
ab254df06bbca5bfee17758771254be6fa5756ad57cdfeb89b06ee476e40ff4c
|
Provenance
The following attestation bundles were made for langchain_hexread-0.1.0.tar.gz:
Publisher:
release.yml on HexWorldEU/hexread-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_hexread-0.1.0.tar.gz -
Subject digest:
56f271ebb720c80c276d4d6657ea0ad3f596680bee8199a0f6ca19e0a63f624a - Sigstore transparency entry: 2344908832
- Sigstore integration time:
-
Permalink:
HexWorldEU/hexread-python@7872f282d78c73b123e9c3db2fddcdd07436fc09 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/HexWorldEU
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7872f282d78c73b123e9c3db2fddcdd07436fc09 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_hexread-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_hexread-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee269cfe7e402bffc387c257455480937ac2f4a66ab77e468f3b0e95ebf2f4a1
|
|
| MD5 |
7cabb7382ee531f4145912790aaf6c2c
|
|
| BLAKE2b-256 |
86a031166df1427b391adac6c5e335b126e9b09dc9a9c3411c7af0aa307811c6
|
Provenance
The following attestation bundles were made for langchain_hexread-0.1.0-py3-none-any.whl:
Publisher:
release.yml on HexWorldEU/hexread-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_hexread-0.1.0-py3-none-any.whl -
Subject digest:
ee269cfe7e402bffc387c257455480937ac2f4a66ab77e468f3b0e95ebf2f4a1 - Sigstore transparency entry: 2344908898
- Sigstore integration time:
-
Permalink:
HexWorldEU/hexread-python@7872f282d78c73b123e9c3db2fddcdd07436fc09 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/HexWorldEU
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7872f282d78c73b123e9c3db2fddcdd07436fc09 -
Trigger Event:
push
-
Statement type: