How vikrantvikaasa27/ai-document-assistant works
Project Type and Purpose
• This is a single-page, full-stack document-QA web application built with Streamlit and LangChain.
• Purpose: Allow users to upload research PDFs, extract and chunk text, index embeddings in memory, and answer user questions via NVIDIA’s Llama-3.3-70B model.
File Structure
• Top-level files:
• app.py – entry point combining UI and backend logic
• requirements.txt – Python dependencies
• README.md – describes features, workflows, and tech stack
• No separate “frontend” or “backend” folders – both UI and processing logic live in app.py.
Key Components (to represent
a. Streamlit Frontend
• File upload widget
• Query input field & response display
b. Document Processing Pipeline
• LangChain’s PDFPlumberLoader
• RecursiveCharacterTextSplitter (text chunking)
c. In-Memory Vector Store
• Storage for document embeddings
• Similarity search layer
d. LLM Service (External)
• Requires NVIDIA_API_KEY environment variable
e. Orchestration & Glue Code
• Sequence of calls in app.py tying UI, processing, vector store, and LLM
Relationships & Data Flows
1) User uploads PDF via Streamlit UI
2) PDFPlumberLoader extracts raw text
3) TextSplitter divides text into chunks
4) Each chunk is embedded (vectorized) and stored in In-Memory Vector Store
5) User enters a question; similarity search finds top chunks
6) Selected chunks plus question are sent to NVIDIA LLM endpoint
7) Response returns to app.py, then displayed in the UI
Architectural Patterns & Principles
• Monolithic service with well-defined stages (loader → splitter → index → query → LLM)
• “Pipelines” pattern: sequential transformation of data
• Separation of concerns at the code level (embeddings vs. storage vs. UI), though in one file
Technologies & Frameworks to Call Out
• Streamlit (UI) – Python-based interactive web front end
• LangChain modules (Loader, TextSplitter, InMemoryVectorStore)
• NVIDIA AI Endpoint (external LLM API)
• PDFPlumber (PDF parsing)
• Environment Variables (.env for API key)
Final Checklist
• All main components present: UI, loader, splitter, index, LLM API
• Call out important libraries (Streamlit, LangChain, PDFPlumber)