UsapPdf
The Brief
A RAG-powered PDF assistant that lets users ask questions, summarize sections, and retrieve document details through natural language chat.

Tech Stack
Key Challenges & Solutions
Critical Challenge
High latency PDF processing
Extracting text, creating chunk embeddings, and saving to a vector database caused client-side request timeouts.
Engineered Solution
Designed an asynchronous task queue in FastAPI, returning a task ID immediately and streaming progress states through WebSockets.
Critical Challenge
Hallucination Mitigation
The AI model could reference details outside the uploaded PDF.
Engineered Solution
Configured a strict LangChain system prompt and implemented MMR retrieval to keep responses locked to source file chunks.
Impact & Metrics
Core Architecture
- React Web ClientPOST /query {doc_id, query: "summarize page 2"}FastAPI Backend
- FastAPI BackendSearch matching vectors for queryVector Store (Chroma)
- Vector Store (Chroma)Returns relevant text chunksFastAPI Backend
- FastAPI BackendSend system prompt + context chunks + queryOpenAI GPT-4o-mini
- OpenAI GPT-4o-miniReturns natural language answerFastAPI Backend
- FastAPI BackendStreams answer text back to clientReact Web Client