LangChain document loader for the DocDigitizer document processing API
Project description
langchain-docdigitizer
LangChain document loader for the DocDigitizer document processing API.
v0.1.x is deprecated. Upgrade to v0.2.0+ for the new API endpoint. The previous endpoint (
https://apix.docdigitizer.com/sync) will be removed in a future release.
Installation
pip install langchain-docdigitizer
Usage
from langchain_docdigitizer import DocDigitizerLoader
# Load a single PDF
loader = DocDigitizerLoader(api_key="dd_live_...")
docs = loader.load("invoice.pdf")
print(docs[0].page_content) # JSON with extracted fields
print(docs[0].metadata) # document_type, confidence, country_code, etc.
# Load all PDFs from a directory
loader = DocDigitizerLoader(api_key="dd_live_...", file_path="invoices/")
docs = loader.load()
# Use in a RAG pipeline
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_openai import OpenAIEmbeddings
from langchain_community.vectorstores import FAISS
splitter = RecursiveCharacterTextSplitter(chunk_size=1000)
chunks = splitter.split_documents(docs)
vectorstore = FAISS.from_documents(chunks, OpenAIEmbeddings())
Configuration
| Parameter | Environment Variable | Default |
|---|---|---|
api_key |
DOCDIGITIZER_API_KEY |
— |
base_url |
DOCDIGITIZER_BASE_URL |
https://api.docdigitizer.com/v3/docingester |
timeout |
DOCDIGITIZER_TIMEOUT |
300 |
max_retries |
— | 3 |
pipeline |
— | None |
content_format |
— | "json" |
Content Formats
"json"(default):page_contentis a JSON string of extracted fields"text":page_contentis key-value pairs separated by newlines (key: value)"kv":page_contentiskey=valuepairs separated by newlines
Document Metadata
Each LangChain Document includes metadata:
| Field | Type | Description |
|---|---|---|
source |
str |
File path of the processed PDF |
document_type |
str |
Detected document type (e.g., "Invoice") |
confidence |
float |
Classification confidence (0-1) |
country_code |
str |
Detected country code (e.g., "PT") |
pages |
list[int] |
Page numbers where document was found |
page_range |
dict |
Start/end page range |
trace_id |
str |
Unique trace identifier |
License
MIT
Project details
Release history Release notifications | RSS feed
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_docdigitizer-0.2.0.tar.gz.
File metadata
- Download URL: langchain_docdigitizer-0.2.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e85c10019d5a95ca1483ccb058522189ddcb04bce0ace17d21ea92afdf4ea4e7
|
|
| MD5 |
7091ef741077c6de685579209592ceaf
|
|
| BLAKE2b-256 |
6d82c66fbcda9acc2c4353d0c68a888c444390c4852e5d27e4291a440766853c
|
Provenance
The following attestation bundles were made for langchain_docdigitizer-0.2.0.tar.gz:
Publisher:
publish-langchain-python.yml on DocDigitizer/dd-v3-integrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_docdigitizer-0.2.0.tar.gz -
Subject digest:
e85c10019d5a95ca1483ccb058522189ddcb04bce0ace17d21ea92afdf4ea4e7 - Sigstore transparency entry: 1019095737
- Sigstore integration time:
-
Permalink:
DocDigitizer/dd-v3-integrations@8a69332042c192053d9f5cdd71ba70d60813077f -
Branch / Tag:
refs/tags/langchain-python-v0.2.0 - Owner: https://github.com/DocDigitizer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-langchain-python.yml@8a69332042c192053d9f5cdd71ba70d60813077f -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_docdigitizer-0.2.0-py3-none-any.whl.
File metadata
- Download URL: langchain_docdigitizer-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8354466a3156f33a952c898a3b5772f1eeaa44fe462befe8efb526e6fb13512d
|
|
| MD5 |
3ce8b3a92d5610f80fe1d960f49dda49
|
|
| BLAKE2b-256 |
551b5ac8fcf8371c788638ecabc6e4f1a8fea1b5cfe98e3bf56d811b4885f986
|
Provenance
The following attestation bundles were made for langchain_docdigitizer-0.2.0-py3-none-any.whl:
Publisher:
publish-langchain-python.yml on DocDigitizer/dd-v3-integrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_docdigitizer-0.2.0-py3-none-any.whl -
Subject digest:
8354466a3156f33a952c898a3b5772f1eeaa44fe462befe8efb526e6fb13512d - Sigstore transparency entry: 1019095744
- Sigstore integration time:
-
Permalink:
DocDigitizer/dd-v3-integrations@8a69332042c192053d9f5cdd71ba70d60813077f -
Branch / Tag:
refs/tags/langchain-python-v0.2.0 - Owner: https://github.com/DocDigitizer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-langchain-python.yml@8a69332042c192053d9f5cdd71ba70d60813077f -
Trigger Event:
push
-
Statement type: