Skip to main content

LangChain document loader for the DocDigitizer document processing API

Project description

langchain-docdigitizer

LangChain document loader for the DocDigitizer document processing API.

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://apix.docdigitizer.com/sync
timeout DOCDIGITIZER_TIMEOUT 300
max_retries 3
pipeline None
content_format "json"

Content Formats

  • "json" (default): page_content is a JSON string of extracted fields
  • "text": page_content is key-value pairs separated by newlines (key: value)
  • "kv": page_content is key=value pairs 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_docdigitizer-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_docdigitizer-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file langchain_docdigitizer-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_docdigitizer-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for langchain_docdigitizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bd5a70cd1d0aecfc4ec2ee1990761dd9fef1b28630c780258b0efd37fb8acce0
MD5 4bb70ee89594d0a12c16d733fd2f962b
BLAKE2b-256 73ed53e5511ddd734f298ad524344ed76c23eec73a9059992ea222d4f462374b

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_docdigitizer-0.1.0.tar.gz:

Publisher: publish-langchain-python.yml on DocDigitizer/dd-v3-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_docdigitizer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_docdigitizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 938321ac1077c10792c261b310c5fe4983f360168ba5d54be822881ad5fad096
MD5 6726e2cf26be29e2ee0fb3f78188f955
BLAKE2b-256 cbbf08b17576b14779cff30457623849b7b0691973fb742910c7184b545ca41f

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_docdigitizer-0.1.0-py3-none-any.whl:

Publisher: publish-langchain-python.yml on DocDigitizer/dd-v3-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page