Commit 8630d0c
authored
@ (#57)
Add store answer endpoint (query across a collection)
POST /v1/answer/store synthesises ONE grounded answer across a set of
documents (a store/collection), with per-document citations. It is the
map-reduce companion to the single-document tree-walk:
map — retrieval.MultiDoc fans the selection strategy across every
document_id and returns the relevant sections per document.
reduce — one LLM call reads the gathered, source-labelled evidence
([1], [2], … tagged with document title + page range) and
writes a single answer citing sources with [n] markers.
Response: {answer, citations[{index, document_id, document_title,
start_page, end_page, section_ids, quote}], documents_searched,
documents_with_matches, usage, elapsed_ms}. Empty evidence yields an
honest refusal rather than a hallucinated answer.
Org + store scope come from the injected headers, so a key only ever
reads its own documents. Wired from Deps (MultiDoc + LLM); returns 501
when no LLM is configured.
@1 parent d148f4c commit 8630d0c
3 files changed
Lines changed: 531 additions & 0 deletions
0 commit comments