How 7vyshak7/pdf_chatter works
Project Type and Purpose
• PDF Chatter is a single‐page interactive web application built with Streamlit.
• It enables users to upload PDF documents, index their contents using embeddings, and interact via natural‐language queries.
• It leverages LangChain for orchestration, Ollama (or optionally Groq) for embeddings & LLM inference, and an in‐memory or simple vector store for retrieval.
File Structure
• PdfChatApp.py
• The sole entry point. Contains Streamlit UI definitions, PDF ingestion logic, embedding generation, vector store setup, and QA chain orchestration.
• temp_files/
• Holds sample PDF files for testing/demonstration.
• README.md
• Documents installation, dependencies (Streamlit, LangChain, Ollama, Groq), and usage instructions.
README for Insights
• Core dependencies: streamlit, langchain, streamlit-pdf-viewer, langchain_ollama, langchain_groq, langchain_community
• External services: Ollama desktop app (mandatory), Groq API (optional)
• High‐level workflow: Upload PDF → Extract & chunk text → Generate embeddings → Store in vector DB → Prompt LLM with retrieval → Display answers
a. Main Components
• UI Layer (Streamlit)
• PDF Ingestion & Preprocessing Module
• Embedding Generator (Ollama / Groq)
• Vector Store (in‐memory or local)
• Retrieval‐Augmented Generation (RAG) Chain (LangChain QA)
• External Services: Ollama Service, Groq API
b. Relationships & Data Flow
1. User → UI Layer (Streamlit app)
2. UI Layer → PDF Ingestion Module
3. Ingestion Module → Text chunks → Embedding Generator
4. Embedding Generator → Vector Store (index)
5. User Question → RAG Chain retrieves relevant chunks from Vector Store
6. RAG Chain → LLM (Ollama/Groq) → Generated Answer → UI Layer → User
c. Architectural Patterns & Principles
• Layered Architecture (UI, Processing, Storage, Inference)
• Pipeline pattern for document processing (extract → chunk → embed → index → retrieve → answer)
• Retrieval‐Augmented Generation for combining embeddings with LLM inference
d. Key Technologies & Frameworks
• Streamlit: front‐end web framework
• LangChain: orchestration, chains, vector store wrappers
• Ollama / Groq: embedding and LLM providers
• Streamlit‐PDF‐Viewer or similar for PDF rendering