How codinghub27/chat_with_pdf works
Chat with PDF is a Django study assistant: users authenticate, upload private PDFs, and ask questions whose answers are grounded in the selected document and saved as per-PDF conversation history. The documented RAG stages run from PDF chunking and HuggingFace embeddings through FAISS retrieval to Groq generation. The graph reflects calls visible in the sampled views and documented RAG behavior; the LangChain implementation, route details, and login flow were not sampled, so their internal wiring is shown only where supported.
Main entry points: views.py PDF views · langchain_utils.py RAG pipeline · mysite/urls.py Project routes · myapp/urls.py PDF routes
Components 16
Web and accounts
- Project routes
mysite/urls.py - PDF routes
myapp/urls.py - Account routes
users/urls.py - Account views
users/views.py - Django auth
PDF management
- PDF views
myapp/views.py - Upload form
myapp/forms.py - Uploaded PDF
Question answering
- RAG pipeline
myapp/langchain_utils.py - FAISS index
myapp/langchain_utils.py - HuggingFace embeddings
- Groq LLM
Persistence and services
- PDF profile
myapp/models.py - Chat messages
myapp/models.py - PostgreSQL
Other components
- Reader
Connections 19
- Reader → Project routes: sends requests
- Project routes → PDF routes: routes PDF requests
- Project routes → Account routes: routes account requests
- PDF routes → PDF views: dispatches
- Account routes → Account views: dispatches
- Account views → Django auth: logs out
- Django auth → PostgreSQL: persists accounts
- PDF views → Upload form: validates upload
- PDF views → PDF profile: creates and lists
- PDF views → Uploaded PDF: stores upload
- PDF views → RAG pipeline: processes PDF
- RAG pipeline → HuggingFace embeddings: embeds chunks
- RAG pipeline → FAISS index: stores vectors
- PDF views → FAISS index: retrieves chunks
- PDF views → RAG pipeline: requests answer
- RAG pipeline → Groq LLM: generates answer
- PDF views → Chat messages: saves and reads history
- PDF profile → PostgreSQL: persists PDF records
- Chat messages → PostgreSQL: persists messages