How abirchakrabortty/chatpdf works
This repository is a Streamlit PDF question-answering app, accompanied by standalone scripts demonstrating progressively more of the LangChain workflow. The main app accepts a PDF, creates a per-document vector store, retrieves relevant chunks for a question, and displays the answer and source chunks while maintaining chat state. The excerpts establish the main app’s vector-store and retrieval-chain behavior; omitted sections limit certainty about some ingestion and UI connections. The standalone modules are independent examples, not demonstrated stages called by the app.
Main entry points: app.py Chat interface · module_05_rag_chain.py Complete RAG demo · module_04_connection.py Persistent store demo · module_01_connection.py Direct LLM demo
Components 16
ChatPDF app
- Chat interface
app.py - PDF processing
app.py - PDF vector store
app.py - Chunk retrieval
app.py - RAG answer chain
app.py - Chat history
app.py - Source chunks
app.py
Standalone examples
- Direct LLM demo
module_01_connection.py - Prompt chain demo
module_02_connection.py - PDF chunking demo
module_03_connection.py - Persistent store demo
module_04_connection.py - Complete RAG demo
module_05_rag_chain.py
External services
- Groq LLM
- HuggingFace embeddings
- PDF loader
Other components
- PDF user
Connections 20
- PDF user → Chat interface: uploads and asks
app.py - Chat interface → PDF processing: processes PDF
app.py - PDF processing → PDF loader: loads pages
app.py - PDF processing → PDF vector store: creates store
app.py - PDF vector store → HuggingFace embeddings: embeds chunks
app.py - Chat interface → PDF vector store: retrieves from
app.py - Chat interface → RAG answer chain: invokes chain
app.py - RAG answer chain → Groq LLM: generates answer
app.py - Chat interface → Chat history: stores messages
app.py - Chat interface → Source chunks: shows context
app.py - Direct LLM demo → Groq LLM: invokes
module_01_connection.py - Prompt chain demo → Groq LLM: calls through chain
module_02_connection.py - PDF chunking demo → PDF loader: loads PDF
module_03_connection.py - Persistent store demo → PDF loader: loads PDF
module_04_connection.py - Persistent store demo → PDF vector store: creates and searches
module_04_connection.py - Persistent store demo → HuggingFace embeddings: embeds chunks
module_04_connection.py - Complete RAG demo → PDF loader: loads PDF
module_05_rag_chain.py - Complete RAG demo → PDF vector store: creates store
module_05_rag_chain.py - Complete RAG demo → HuggingFace embeddings: embeds chunks
module_05_rag_chain.py - Complete RAG demo → Groq LLM: answers questions
module_05_rag_chain.py