Skip to content

Feature Request: Integrate OpenDataLoader PDF as RAG document parser #270

Description

@cadugevaerd

Summary

Requesting integration of OpenDataLoader PDF as an optional document parser backend for LibreChat's RAG pipeline, particularly for PDF files.

Motivation

Currently, LibreChat's RAG pipeline processes PDF documents, but accuracy on complex layouts (multi-column, borderless tables, scanned documents, scientific papers) can be limited with standard parsers.

OpenDataLoader PDF ranks #1 in benchmarks (0.90 overall score) among open-source PDF parsers:

Engine Overall Reading Order Table Heading
opendataloader [hybrid] 0.90 0.94 0.93 0.83
docling 0.86 0.90 0.89 0.80
marker 0.83 0.89 0.81 0.80
pymupdf4llm 0.57 0.89 0.40 0.41

Benchmarked across 200 real-world PDFs including multi-column layouts and scientific papers.

Key Features Relevant to LibreChat

  • Add Default Database Connection Values to Facilitate Docker Setup #1 accuracy for PDF → Markdown/JSON extraction (tables, reading order, headings)
  • Bounding boxes for every element — enables source citation / "click to source" UX
  • Built-in prompt injection protection — filters hidden text, off-page content, invisible layers (important for RAG security)
  • LangChain official integration via langchain-opendataloader-pdf
  • 100% local, no GPU required — deterministic mode at 0.05s/page
  • OCR support for scanned PDFs (80+ languages) via hybrid mode
  • Apache 2.0 license — permissive, production-safe

Proposed Integration

Option 1: File service parser backend (minimal change)

Add OpenDataLoader as an optional parser in the file processing service, selectable via environment variable:

# .env
RAG_PDF_PARSER=opendataloader  # options: default | opendataloader

Option 2: LangChain loader swap (lower effort)

Since LibreChat uses LangChain internally, the integration could leverage the official loader:

from langchain_opendataloader_pdf import OpenDataLoaderPDFLoader

loader = OpenDataLoaderPDFLoader(
    file_path=["document.pdf"],
    format="markdown"
)
documents = loader.load()

This is a drop-in replacement for existing LangChain PDF loaders with better accuracy.

Use Case

Organizations using LibreChat for document Q&A (legal, financial, scientific) would benefit significantly from higher-accuracy PDF parsing — especially for:

  • Complex tables in financial/legal documents
  • Multi-column academic papers
  • Scanned document archives

References

Additional Notes

The library runs 100% locally — no external API calls, no data transmission — making it suitable for privacy-sensitive deployments. Hybrid mode (for complex documents) also runs locally on-machine.

Happy to contribute a PR if there's interest in this direction. 🙏

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions