Why this system exists
A fluent answer is not enough in a healthcare knowledge context. Users need to see which source passages informed an answer and where retrieval confidence breaks down.
Boundary and data flow
Documents pass through deterministic parsing and chunking. Retrieval returns source spans with stable identifiers. The model receives a constrained prompt and emits a schema-validated answer with citations and uncertainty states.
Trade-offs made explicit
- Store source lineage beside each embedding rather than reconstructing it later.
- Use schema-constrained outputs for answers, citations, and abstention reasons.
- Keep local-model support behind the same inference interface used for hosted models.
CHALLENGES
- Evaluating retrieval separately from answer generation.
- Maintaining citations when source documents are reprocessed.
- Designing explicit abstention rather than encouraging plausible completion.
Safe system boundaries
- Treat documents as untrusted input and strip active content before parsing.
- Isolate indexes by corpus and avoid logging queries or retrieved passages.
- Do not position the research surface as a diagnostic or treatment tool.
What the build demonstrated
The research build can replay an answer from its retrieved spans and records retrieval, prompt, model, and schema versions for each evaluation case.
LESSONThe useful unit of a clinical RAG system is not an answer; it is an answer plus provenance, evaluation evidence, and an honest failure state.