Most RAG demos stop at "embed a PDF, ask a question." Real deployments in regulated industries (pharma, finance, healthcare) need the hard part: traceability, compliance guardrails that cut false positives, model/prompt versioning, a knowledge graph for exact relationships, and an observability layer a compliance officer can audit. InsightRAG implements all of that end-to-end, on a fictional knowledge base — no sensitive data.
Dense retrieval alone can dilute an exact relation — which molecule reverses which drug — across chunks that all look relevant. The graph endpoint links the entities named in the question, pulls their 1-hop neighbourhood as typed facts, and only then retrieves. Pick a path and watch it run.
Widening k gets you more text that resembles the question, not the one relation that answers it. Vestrila is reversed by veligumab is a fact, not a paragraph — it survives as a triple and dissolves as prose. The graph is not there to find text; it is there to carry the relations that text loses.
Linking is name.lower() in question.lower(), gated at 4+ characters. Ask a question that names no entity and the graph lane contributes - (none matched): you paid for the hop and got dense retrieval anyway — the third scenario above. It is deliberate for a corpus this size, and it is the first thing that would need replacing at a larger one.
| Capability | Implementation |
|---|---|
| RAG | chunking → local embeddings (nomic-embed) → Qdrant → grounded synthesis |
| Knowledge graph | typed graph (products, classes, indications, reversal agents) + hybrid GraphRAG (vector + graph expansion + rerank) |
| Compliance prompting | versioned system prompts: on-label only, fair balance, scoped off-label refusal |
| Observability | per-request trace store · p50/p95 latency · tokens · error rate · CI-gated compliance eval · dashboard |
| Fine-tuning | custom domain LoRA adapter trained on a single 24 GB GPU (bf16, rank 16) |
| MLOps | versioned FastAPI endpoints (model+prompt version per response) · offline tests · GitHub Actions CI |
A compliant answer is a scoped refusal + on-label facts, not a flat refusal — it cuts false positives, exactly as the domain requires. That case is the whole point of the project.
"Orvenda MoA + key risks" → efficacy always comes paired with safety. And when asked a price that isn't in the sources: "not covered in my sources" — no hallucination.
Resolve locally when local capability clears the task's threshold; escalate on evidence of insufficiency, not by reflex.
The same call path points to local Ollama or a frontier endpoint via env var.
Latency, tokens, retrieval hits and prompt version logged per request; schema exportable to Langfuse/Phoenix.