Commit ec119c9
authored
Store answer: reason over structure+summaries, then full section content (#58)
* Store answer: reasoning-heavy map (full tree-walk per document)
Replace the store answer's map stage: instead of fanning the
section-selection strategy across documents (retrieve-then-generate,
chunk-shaped), run the FULL agentic tree-walk on EACH document — read its
structure, navigate hop by hop to a grounded per-document answer + page
citations — then synthesise the per-document answers into one. Every
document is now reasoned over exactly like /v1/answer/treewalk; no
chunking, no embeddings anywhere in the collection path.
- max_depth controls the per-document tree-walk hop budget (0 = the
engine's full/default depth), as requested.
- max_docs bounds how many documents are tree-walked (0 = all) — a cost
valve for large collections; the per-doc walks run with bounded
concurrency.
- Citations are one-per-contributing-document, carrying the document's
cited page span + overlapping section ids (from the tree-walk's
CitedPages) and a short quote from its answer. Refusals/empty per-doc
answers are dropped before synthesis.
Returns 501 unless the tree-walk strategy + an LLM are configured.
* Store answer: reason over structure+summaries, then full section content
Rework the store map to the Vectorless primitive the collection query
should use — reason over each document's llms.txt-style structure +
summaries, select the relevant sections, pull their FULL content, then
generate:
1. per document (parallel): load the tree, render its section outline
(title + one-line summary per section), and ask the LLM which
sections' full text are relevant — reasoning over summaries, not raw
pages, and not chunks.
2. fetch the FULL content of every selected section (a selected heading
pulls its subsection's leaves).
3. one generation call over the full content of ALL relevant sections
→ a single answer citing sections + documents with [n] markers.
Two cheap selection calls over compact summaries + one generation call,
instead of N page-based tree-walks. No chunking, no embeddings, no
truncated snippets — full section content drives the answer.
Controls: max_docs (0 = all), max_sections (0 = all relevant), plus a
total content budget so a large selection still fits the model context.
Citations are per section, carrying document + section title + page span
+ a quote. Returns 501 without an LLM.1 parent db6888d commit ec119c9
3 files changed
Lines changed: 353 additions & 185 deletions
0 commit comments