Skip to main content

library for LangChain documents

Project description

docculus

CI Nightly Tests Nightly Package Tests Codecov
Documentation Documentation
Code style: black Doc style: google Ruff try/except style: tryceratops
PYPI version Python BSD-3-Clause
Downloads Monthly downloads

A python library for LangChain documents

Overview

docculus provides utilities for working with langchain_core.documents.Document objects: analyzing, transforming, hashing, validating, and displaying them.

  • docculus.analysis — content/metadata statistics, duplicate and empty-document detection
  • docculus.transform — filter, sort, deduplicate, truncate, assign ids, and format documents into LLM-friendly strings (XML, Markdown, JSON)
  • docculus.hashing — deterministic hashing of documents (including a stable UUID variant)
  • docculus.validation — consistency checks across documents sharing an id
  • docculus.display — pretty-print documents and their metadata to the terminal
  • docculus.utils — helpers such as fake document generation for testing

Installation

pip install docculus

Quick start

from langchain_core.documents import Document
from docculus.analysis import compute_content_stats_exact
from docculus.transform import deduplicate_documents, format_documents

docs = [
    Document(id="1", page_content="The cat sat on the mat."),
    Document(id="2", page_content="The cat sat on the mat."),
    Document(id="3", page_content="The dog chased the ball."),
]

stats = compute_content_stats_exact(docs)
print(stats["count"], stats["duplicate_count"])

unique_docs = deduplicate_documents(docs)
print(format_documents(unique_docs, output_format="markdown"))

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

docculus-0.0.1a0.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

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

docculus-0.0.1a0-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

Details for the file docculus-0.0.1a0.tar.gz.

File metadata

  • Download URL: docculus-0.0.1a0.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for docculus-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 b2f5aaca8b97472b01b3d84e265c6af9dbbe001bec1db52ed52f137721dff133
MD5 c09dd572b66fbb96ca5301f80c01b632
BLAKE2b-256 a38e2b446582284dc65bb04f04e66e9890b38cdf55ed21921cba244a55295ea9

See more details on using hashes here.

File details

Details for the file docculus-0.0.1a0-py3-none-any.whl.

File metadata

  • Download URL: docculus-0.0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for docculus-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 0b7f79ade956b06f0301be9ab73a291532252df45321b40d35c2d9408065c72c
MD5 42658644bb54b597f6754b57c043100e
BLAKE2b-256 973ec31151081d8e57a5dbf0dc2c58fcde0b58a50b979284a0f504b4c6ffdb55

See more details on using hashes here.

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