langchain-xberg
A LangChain document loader backed by Xberg. XbergLoader extracts text and metadata from 107 formats — running OCR where needed — and returns LangChain Document objects. Extraction is async at the core; multiple sources go through Xberg's extract_batch in a single native call, so concurrency happens Rust-side.
Install
pip install langchain-xberg
Requires Python 3.10+.
Load
Pass a path, a list of paths, a directory, or raw bytes. One source becomes one Document.
from langchain_xberg import XbergLoader
# Single file
docs = XbergLoader(file_path="report.pdf").load()
print(docs[0].page_content) # extracted markdown
print(docs[0].metadata["title"]) # source, mime_type, title, authors, detected_languages, page_count, ...
# Multiple files — one batched extraction
docs = XbergLoader(file_path=["report.pdf", "notes.docx"]).load()
# A directory with a glob
docs = XbergLoader(file_path="./corpus/", glob="**/*.pdf").load()
# Raw bytes (mime_type required)
docs = XbergLoader(data=raw_bytes, mime_type="application/pdf").load()
Chunk for retrieval
Enable Xberg's native chunking to emit one Document per chunk, sized for embedding. Each chunk carries chunk_index, total_chunks, heading_path, page, and token_count in its metadata.
from langchain_xberg import XbergLoader
from xberg import ChunkingConfig, ExtractionConfig
config = ExtractionConfig(chunking=ChunkingConfig(max_characters=1000, overlap=200))
docs = XbergLoader(file_path="report.pdf", config=config).load() # one Document per chunk
To split by page instead, pass pages=PageConfig(extract_pages=True); each Document then gets a 0-indexed page.
Configure extraction
Pass any Xberg ExtractionConfig to control OCR, output format, and batch concurrency.
from xberg import ExtractionConfig, OcrConfig
config = ExtractionConfig(
output_format="markdown",
ocr=OcrConfig(backend="tesseract"),
force_ocr=True,
max_concurrent_extractions=8,
)
docs = XbergLoader(file_path="./corpus/", config=config).load()
Async
Inside an event loop, use the async API — await loader.aload() or async for doc in loader.alazy_load(). These use Xberg's native async extraction end to end. The synchronous load / lazy_load bridge to it and must not run inside a running loop.
loader = XbergLoader(file_path="report.pdf")
docs = await loader.aload()
Errors
A per-input failure raises xberg.XbergError with the offending source and message. In batch mode the failure comes from ExtractionResult.errors; a single load surfaces the raised exception directly.
For the full API, see the Xberg documentation.
Metadata
Release files for langchain-xberg 1.3.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_xberg-1.3.8.tar.gz | 12.6 kB | Without provenance | Details for langchain_xberg-1.3.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_xberg-1.3.8-py3-none-any.whl | Python 3 | none | any | Details for langchain_xberg-1.3.8-py3-none-any.whl |
Total release size: 21.9 kB
Release files / langchain_xberg-1.3.8.tar.gz
| Download URL | langchain_xberg-1.3.8.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a7b19e01f9b498db8db6a715dc95dc84ff7586cd4c432a00eeb688c82674cdbb
|
|
BLAKE2b-256 checksum How to use checksums |
eec06c299762e2f29079751c5199c59b291eb8aef5c2d12835e2852b27200ba2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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 / langchain_xberg-1.3.8-py3-none-any.whl
| Download URL | langchain_xberg-1.3.8-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
693ec85ac5d23649ac9f8d71e47693b1b7e19ccc16556b5738b7f57de3b9572f
|
|
BLAKE2b-256 checksum How to use checksums |
c025ede70c913a13d7167183a4c6c3eff15538770cb349095a2daa57716bd7ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","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 langchain-xberg 1.3.8
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.