LongLoom splits oversized documents the way humans do โ read in chunks, extract, combine, condense โ with measured information preservation, over any LLM and any storage you already run.
pip install longloom
One dependency seam each. Every claim below is backed by a runnable example or a test in the repository.
init_llm maps 9 provider integrations plus any OpenAI-compatible
endpoint. Memory โ SQLite โ JSONL โ Postgres โ MySQL โ MSSQL โ
Oracle โ MongoDB โ Supabase โ or subclass one ABC with four methods.
Verbatim extraction preserves 100% of planted facts at scale (83,023-fact stress test at 6.7M chars) where naive summarization drops 2โ10%.
max_workers=8 fans chunk calls across a thread pool with
shared rate-limit pacing. Measured โ4ร.
Map results are checkpointed per chunk. resume=True after a
crash re-maps only the missing chunks โ nothing twice, nothing lost.
on_event= emits structured events with per-call token usage
and durations. Retry-After, jitter and pacing are built in.
Embed into existing tables with table=, columns=
and multi-tenant namespace=. MSSQL and Oracle dialects included.
Explicit credentials (never read from the environment), pluggable PII
scrubber, retention sweeps, advisory conflict detection.
The context window only ever sees chunks and compact intermediate results โ the document never has to fit.
verified at the end of every run: chunk losslessness, fact preservation, token accounting
One import. The context window only ever sees chunks and compact intermediate results โ the document never has to fit.
# pip install longloom import os from longloom import MapReduceProcessor, SQLiteContextStore, init_llm, PromptTemplates processor = MapReduceProcessor( llm=init_llm("nvidia", "nvidia/nemotron-3-ultra-550b-a55b", api_key=os.environ["NVIDIA_API_KEY"], thinking=False), store=SQLiteContextStore("ctx.db"), max_chunk_tokens=3000, max_context_tokens=8192, prompts=PromptTemplates.for_extraction(), # no-loss verbatim mode max_workers=4, # parallel map ) result = processor.process(annual_report, task="Summarize the key findings") print(result["final_result"]) print(result["sources"]) # provenance per chunk
17 runnable examples. 48 passing tests. One command to install.
Install from PyPI View source