Skip to main content

A basic document parsing and loading utility - Database Interfaces

PyPI - Version PyPI - Implementation PyPI - Python Version PyPI - Status Static Badge Static Badge Static Badge Documentation Status PyPI - License PyPI - Wheel

Overview

The docp-* project suite is designed as a comprehensive (doc)ument (p)arsing library. Built in CPython, it consolidates the capabilities of various lower-level libraries, offering a unified solution for parsing binary document structures.

The suite is extended by several sister projects, each providing unique functionality:

Project Description
docp-core Centralized core objects, functionality and settings.
docp-parsers Parse binary documents (e.g. PDF, PPTX, etc.) into Python objects.
docp-loaders Load a parsed document's embeddings into a Chroma vector database, for RAG-enabled LLM use.
docp-docling Convert a PDF into Markdown format via wrappers to the docling libraries.
docp-dbi Interfaces to document databases such as ChromaDB, and Neo4j (coming soon).

This library (docp-dbi) extends the document parsing capability by adding access to a ChromaDB vector database for storing text embeddings. This is particularly useful for implementing RAG-enabled pipelines.

The Toolset (Interfaces)

As of this release, the following database interfaces are supported:

  • ChromaDB (via langchain_chroma)
  • Neo4j (coming soon)

Quickstart

Installation

To install docp-dbi, first activate your target virtual environment, then use pip:

pip install docp-dbi

For older releases, visit PyPI or the GitHub Releases page.

Example Usage

For convenience, here are a couple examples for how to create and interact with a database interface for your project.

Create an interface to ChromaDB:

    >>> from docp_dbi import ChromaDB

    # Create a database interface.
    >>> db = ChromaDB(path='/path/to/chromadb', collection='test-collection')

    # Display a list of all collections in the database.
    >>> db.client.list_collections()

    # Debug: Retrieve records from the database.
    >>> records = db.show_all()

Load a new PDF document into the database, and query against it:

    >>> from docp_dbi import ChromaDB
    >>> from docp_parsers import PDFParser
    >>> from langchain_text_splitters import RecursiveCharacterTextSplitter

    # Parse the PDF document.
    >>> pdf = PDFParser(path='/path/to/documents/rag-pipelines-how-to.pdf')
    >>> pdf.extract_text()

    # Setup a text splitter (for chunking the document).
    >>> splitter = RecursiveCharacterTextSplitter(
    ...     separators=['\n\n\n', '\n\n', '\n', '.'],
    ...     chunk_size=512,
    ...     chunk_overlap=128
    ... )
    # Split the document for storage.
    >>> docs = splitter.split_documents(pdf.doc.documents)

    # Create a database interface, using an offline, local user-defined embedding model.
    >>> db = ChromaDB(path='/path/to/databases/chroma/', 
    ...               collection='test', 
    ...               embedding_model_path='/path/to/models/sentence-transformers/all-MiniLM-L6-v2', 
    ...               offline=True)
    # Embed and store the document chunks.
    >>> db.add_documents(documents=docs)

    # Run your first query.
    >>> result = db.collection.query(query_texts=['How do I implement a RAG pipeline?'])

Using the Library

The documentation suite provides detailed explanations and usage examples for each importable module. For in-depth documentation, code examples, and source links, refer to the Library API page.

A search field is available in the left navigation bar to help you quickly locate specific modules or methods.

Troubleshooting

No troubleshooting guidance is available at this time.

For questions not covered here, or to report bugs, issues, or suggestions, please open an issue on GitHub.

Metadata

Release files for docp-dbi 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docp-dbi 1.1.0
File Size Uploaded Provenance Actions
docp_dbi-1.1.0.tar.gz 9.0 MB Without provenance Details for docp_dbi-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docp-dbi 1.1.0
File Interpreter ABI Platform Actions
docp_dbi-1.1.0-py3-none-any.whl Python 3 none any Details for docp_dbi-1.1.0-py3-none-any.whl

Total release size: 9.0 MB

Release files / docp_dbi-1.1.0.tar.gz

Download URL docp_dbi-1.1.0.tar.gz
Size 9.0 MB
Tags Source
SHA-256 checksum
How to use checksums
29f2fcd5c5322d1fb09b8b6008fd8f3fdb296285872f406c3ca6a935ae689024
BLAKE2b-256 checksum
How to use checksums
756899d7b4ee160942df56a3ae53498c184d2acc3f043a3b1db3be8e29486e68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / docp_dbi-1.1.0-py3-none-any.whl

Download URL docp_dbi-1.1.0-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9676f0f4804be846d43a28392c9eb366f4578deae231bd8e6376a1f4c63480f2
BLAKE2b-256 checksum
How to use checksums
db8ce02031927fed47d31b1f96d0dc92f9cacf745c88b84a7693ce8a0f86b86f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Security for docp-dbi 1.1.0

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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page