Document Q&A Assistant

Retrieval-augmented generation·2025·Solo build

A retrieval-augmented generation system built end to end: document ingestion, chunking, embedding, vector search, and an answering layer that stays grounded in the retrieved passages rather than the model's priors.

The constraint

A language model asked about a document it was never trained on will answer anyway. The failure is confident and fluent, which makes it worse than an error — the point of retrieval is to constrain the model to text it can actually cite.

How it was built

  • PDF ingestion and chunking tuned so retrieved passages carry enough surrounding context to be answerable
  • Semantic search over embeddings rather than keyword matching, so paraphrased questions still retrieve
  • Answer generation constrained to retrieved context, keeping responses traceable to source passages

Stack

TypeScript
Cohere
LLMs
React.js

Written up in depth

Retrieval-Augmented Generation (RAG): Enhancing AI with Real-Time Knowledge

Explore how Retrieval-Augmented Generation (RAG) boosts the capabilities of AI systems by combining generative models with real-time document retrieval, enabling more accurate, contextual, and up-to-date responses.

Built with love by Sidhant Singh Rathore