- AI
- Backend
- Frontend
Grounded RAG Assistant – verifiable Q&A over your own documents
Image credit: Majd Edriss
Challenge
Most “chat with your documents” tools lead with the chat, not with trust: they sound convincing even when they guess. For sensitive or important documents that isn’t enough, you need an answer you can trust, with proof.
Result
A locally runnable RAG tool that answers only from the uploaded documents, backs every statement with an expandable source citation, flags unsupported sentences and honestly says “not found” instead of inventing. Deliberately kept lean as a learning project (no LangChain) so the RAG mechanics stay visible.
Solution
Two separate pipelines: ingest (extraction with page/char offsets, structure-aware chunking, embedding, pgvector) and query (retrieval with a relevance gate, grounding prompt, answer with [n] citations, faithfulness check). Retrieved document content is isolated as untrusted (prompt-injection defense). A deterministic shell surrounds the two non-deterministic LLM calls, which keeps the system testable.
Technologies
- Python
- FastAPI
- PostgreSQL
- pgvector
- OpenAI
- React
- TypeScript
- pytest
- Docker