How it works
Documents lane
Chunking, BM25, vectors, reciprocal-rank fusion, rerank and quarantined extraction — step by step.
Documents answer the why: a price list, an email, an ops note. The lane is built so that text from your files can inform the analysis without ever steering it.
- Chunk each section into overlapping passages with their page, heading path and character span.
- Search two ways in the same DuckDB file: BM25 full-text (stemmed for the document’s language) and exact vector search over in-process embeddings (
bge-m3by default; an offline hash embedder for tests). - Fuse the two rankings with reciprocal-rank fusion: each list votes 1/(60 + rank).
- Rerank the top passages with a cross-encoder; if it is unavailable the result is marked degraded, not hidden.
- Extract. Only the quarantined extractor — a model call with no tools — reads the passage text. It returns typed events and statements with exact quotes, checked to be substrings of the passage. The planner sees only those extracts, inside a delimited data block.
Step through a real query on the example:
Query: “why did the hotel stop its wholesale order”
DuckDB full-text search, stemmed. Chunks without the words don't rank.
- 1
email-0412.eml› Standing order
Hello, After the new price list we are pausing our standing order while we compare suppliers. We will let you know about…BM25 #1 - 2
price-list.pdf
Wholesale terms Wholesale prices increase 12% from 15 March 2026. Espresso blend 1kg ... 24.60 Filter blend 1kg ... 23.5…BM25 #2 - 3
price-list.pdf
Contact orders@roaster.example Northside Coffee Roasters, Tashkent…BM25 #3 - 4
price-list.pdf
Payment terms Invoices are due within 14 days. Late payments may pause standing orders.…BM25 #4
Retrieval recall@8 is measured on two labelled corpora (bun run --filter @agentic-analytics/retrieval eval:retrieval): 1.0 on both with the offline embedder.