Ingestion pipeline for the koji-db database: parsing, chunking, and multi-vector embeddings
Project description
koji-ingest
Ingestion pipeline for Kōji — document parsing, chunking, multi-vector embeddings, and VLM enrichment.
koji-ingest transforms raw documents (PDF, DOCX, PPTX, audio, images, and more) into ColBERT-style multi-vector embeddings ready for storage and semantic search in Kōji.
Installation
The distribution is published to PyPI as koji-ingest; the import module is koji_ingest.
# Core ingestion (parsing, chunking, embeddings)
pip install koji-ingest
# With document parsing support (Docling, PDF)
pip install "koji-ingest[document]"
# With LibreOffice-based rendering (DOCX/PPTX page images)
pip install "koji-ingest[rendering]"
# With MLX VLM enrichment engine (Apple Silicon)
pip install "koji-ingest[enrichment]"
# With Kōji storage integration (PyArrow)
pip install "koji-ingest[koji]"
Features
Multi-Vector Embeddings
koji-ingest generates ColBERT-style multi-vector embeddings where each document is represented by a set of per-token vectors, enabling MaxSim late-interaction scoring:
from koji_ingest import MultiVectorEmbedding
import numpy as np
data = np.random.randn(10, 128).astype(np.float32)
emb = MultiVectorEmbedding(num_tokens=10, dim=128, data=data)
blob = emb.to_blob() # serialize for Lance storage
recovered = MultiVectorEmbedding.from_blob(blob)
Document Parsing and Chunking
Parse and chunk documents in a variety of formats via Docling:
from koji_ingest import parse, chunk, IngestConfig
config = IngestConfig()
parsed = parse("report.pdf", config=config)
chunks = chunk(parsed, config=config)
Supported formats include PDF, DOCX, PPTX, Markdown, HTML, images, and audio files.
DenseTextEngine (Lightweight Embedding)
For text-only workloads without vision, use DenseTextEngine backed by mlx-embeddings:
from koji_ingest import DenseTextEngine
engine = DenseTextEngine()
embedding = engine.embed("The quick brown fox")
Gemma 4 E4B VLM Enrichment (Apple Silicon)
Augment parsed documents with VLM-generated descriptions, code analysis, formula interpretations, and document summaries using the Gemma 4 E4B model via mlx-vlm:
from koji_ingest.enrichment import GemmaEnrichmentEngine
engine = GemmaEnrichmentEngine()
enriched = await engine.enrich(parsed_content)
# enriched.figures now contain model-generated captions
# enriched.summary contains a document-level summary
GPU / Metal Memory Management
Release cached GPU or Metal memory between batch operations to prevent OOM errors:
from koji_ingest.gpu import release_gpu_memory
for batch in large_corpus:
process(batch)
release_gpu_memory() # returns allocations to OS after each batch
LibreOffice Page Renderer
Convert DOCX and PPTX slides to page images for visual ingestion:
from koji_ingest.parser import parse
# Renders pages via LibreOffice headless, returns per-page images in ParsedContent
result = parse("slides.pptx", config=config)
Audio Chunking
Ingest long-form audio with automatic chunking:
from koji_ingest import IngestConfig, AudioConfig
config = IngestConfig(audio=AudioConfig(chunk_duration_secs=30))
result = parse("interview.mp3", config=config)
Full Ingestion Pipeline
from koji_ingest import Ingester, IngestConfig
ingester = Ingester(config=IngestConfig())
result = await ingester.ingest("document.pdf")
print(result.chunks) # List[TextChunk]
print(result.embeddings) # List[MultiVectorEmbedding]
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file koji_ingest-0.3.0.tar.gz.
File metadata
- Download URL: koji_ingest-0.3.0.tar.gz
- Upload date:
- Size: 498.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0731449ab54e9cc65d334a290263c8a913a615c6dbecf71584df73f34080a454
|
|
| MD5 |
0964e1e0a2cd161131e79aca06114c7b
|
|
| BLAKE2b-256 |
bd9f64209d81ba6be9d39c7b12939a9bbd4af014ee8ed77b73909fb7d333890e
|
Provenance
The following attestation bundles were made for koji_ingest-0.3.0.tar.gz:
Publisher:
koji-ingest-release.yml on tkr-projects/tkr-koji
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
koji_ingest-0.3.0.tar.gz -
Subject digest:
0731449ab54e9cc65d334a290263c8a913a615c6dbecf71584df73f34080a454 - Sigstore transparency entry: 1989292708
- Sigstore integration time:
-
Permalink:
tkr-projects/tkr-koji@d9d81f0d09b35ce8c5f2eb3efc94cf7a137f78de -
Branch / Tag:
refs/tags/koji-ingest-v0.3.0 - Owner: https://github.com/tkr-projects
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
koji-ingest-release.yml@d9d81f0d09b35ce8c5f2eb3efc94cf7a137f78de -
Trigger Event:
push
-
Statement type:
File details
Details for the file koji_ingest-0.3.0-py3-none-any.whl.
File metadata
- Download URL: koji_ingest-0.3.0-py3-none-any.whl
- Upload date:
- Size: 129.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcb6e9ea075cb15eb2cdc240bf6a579703e5b72f38682416676f96e28d68cc55
|
|
| MD5 |
ad3c912f2382a632ba690195f46758ce
|
|
| BLAKE2b-256 |
1f8f7e867a96df12e53f6d3b541ab63d9e09bb08ada8e32464c9a74860bf3e94
|
Provenance
The following attestation bundles were made for koji_ingest-0.3.0-py3-none-any.whl:
Publisher:
koji-ingest-release.yml on tkr-projects/tkr-koji
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
koji_ingest-0.3.0-py3-none-any.whl -
Subject digest:
fcb6e9ea075cb15eb2cdc240bf6a579703e5b72f38682416676f96e28d68cc55 - Sigstore transparency entry: 1989292763
- Sigstore integration time:
-
Permalink:
tkr-projects/tkr-koji@d9d81f0d09b35ce8c5f2eb3efc94cf7a137f78de -
Branch / Tag:
refs/tags/koji-ingest-v0.3.0 - Owner: https://github.com/tkr-projects
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
koji-ingest-release.yml@d9d81f0d09b35ce8c5f2eb3efc94cf7a137f78de -
Trigger Event:
push
-
Statement type: