Retrieval and Answering
Retrieval combines semantic vector search with lexical keyword search, fuses both rankings with RRF, reranks candidates, and passes cited chunks to synthesis. Semantic-only retrieval is explicitly out because government legal and administrative documents depend on exact statute numbers, named entities, and official terms.
Retrieval flow
Citation model
Each retrieved chunk carries citation fields: document ID, title, chunk ID, ordinal, page number, section path, legal reference, and character span. Assistant messages persist source citations, and every answer must cite source chunks.
Faithfulness gate
The Synthesizer checks whether each generated claim is supported by cited chunks. Unsupported claims are dropped or the system returns a fallback answer that says it could not verify a faithful answer from retrieved sources.
Policy Guard
The Government Policy Guard wraps generated answers before they reach users. It filters anti-SARA, jailbreak attempts, and government-communication-policy violations. It cannot be bypassed per query.
Search API
POST /search returns ranked chunks without synthesis. This lets dashboards and diagnostics inspect retrieval behavior directly. POST /query performs retrieval plus synthesis and returns a cited answer.