Skip to main content

xyberos-documents

Filesystem + document loaders plugin — RFC-0019, M1. Turns plain-text-only ingestion into real document ingestion.

Loaders return text chunks consumed by IngestingKnowledge.ingest:

Loader Formats Dependency
FileLoader .md .txt .json .py .rst … + directory walks stdlib only
HtmlLoader .html .htm (tag stripping) stdlib only
CsvLoader .csv stdlib only
PdfLoader .pdf lazy pypdf / PyPDF2 / pymupdf
DocxLoader .docx lazy python-docx
XlsxLoader .xlsx .xlsm lazy openpyxl

The stdlib loaders keep the zero-dependency core sacred; the binary loaders import their backend lazily and raise a clear ProviderError when missing.

Install

pip install -e ./documents
# PDF/DOCX/XLSX backends (also available as the core extra):
pip install xyberos[documents]     # pypdf, python-docx, openpyxl

Usage

Load a document as text chunks, then feed IngestingKnowledge:

from xyberos import create_app
from xyberos.knowledge import IngestingKnowledge
from xyberos.llm import HashEmbedder
from xyberos.vector import SqliteVectorStore
from xyberos_documents import DocumentsPlugin, load_document

app = create_app(
    knowledge=IngestingKnowledge(SqliteVectorStore("learning.db"), embedder=HashEmbedder())
)
app.load_plugin(DocumentsPlugin())

app.tools.execute("ingest_document", None, path="report.pdf", chunk_size=512)
app.tools.execute("ingest_directory", None, path="docs/", extensions=[".pdf", ".docx"])

Each loader can also be used standalone (no app required):

from xyberos_documents import PdfLoader, DocxLoader, HtmlLoader, load_document

for doc in PdfLoader().load("report.pdf"):
    print(doc.text)

Tools registered

  • ingest_document(path, chunk_size=512, loader=None) — auto-detect by extension (loader can force text/html/pdf/docx/csv/xlsx).
  • ingest_directory(path, extensions=None, chunk_size=512, recursive=True) — walk a folder and route each file to the right loader.

Both require the registered knowledge provider to support ingest() (an IngestingKnowledge); otherwise a clear ProviderError is raised.

Examples

  • examples/ingest_documents.py — generates a sample PDF + DOCX and ingests both, then queries the knowledge base.

Tests

pip install pytest
pytest tests/

Optional-dep tests (pdf, docx, xlsx) skip cleanly when their library is not installed — the same pattern as the core's test_sentence_embedder.py.

Contract & ship location

  • Contract: Knowledge (via IngestingKnowledge), plus Tool for the two ingest tools.
  • Ship: FileLoader / HtmlLoader / CsvLoader are stdlib (would be Core); PdfLoader / DocxLoader / XlsxLoader map to the [documents] extra.
  • Dependencies: xyberos>=1.0; optional [documents] for binary formats.

Download files

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

Source Distribution

xyberos_documents-0.1.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

xyberos_documents-0.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xyberos_documents-0.1.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for xyberos_documents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b7411b2ca132c0d266e510ae54662abc65d644b6b4f3871b0b5d520a2782fc29
MD5 b0ba8d39c2a371ed329f9579389ebc51
BLAKE2b-256 fe7e4073e19d724b8b02704053a8be150570e4034c0e3de137fb172ef17b059a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xyberos_documents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6122c8b4098477212414f47b51134266d1430d1a3e9dab1268eb199760b1a04
MD5 22959502f88dd70c17819dd420fba3f5
BLAKE2b-256 0498a831bfa7c3843d7f031c51d6135902ef4abf208720f250a42c9135313260

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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