Physics Local Chatbot
A local, offline chatbot that answers physics questions using Retrieval-Augmented Generation. Upload your physics textbooks and ask questions — it runs completely offline with LangChain and Llama 3 via Ollama.
Overview
What it does
Processes uploaded physics PDFs into a knowledge base, then answers questions with detailed explanations using retrieval plus a generative model.
Why local
Everything runs on your own machine, so it works without internet and keeps your documents private.
Known limitations
Responses can be slow, and the model may hallucinate during open-ended conversation.
LangChain implements the RAG pipeline: PyPDF2 extracts text from the uploaded PDFs, SentenceTransformers creates the embeddings stored in ChromaDB, and Llama 3 (llama3:latest) served by Ollama generates the answers. The interface is built with Streamlit, and Plotly charts the performance metrics.
Key Features
Local & private
Runs completely offline — no data leaves your machine.
RAG architecture
Combines retrieval over your textbooks with a generative model to answer questions.
Multi-session support
Keep separate chat sessions for different topics.
Open-source model
Uses Llama 3 (llama3:latest) through Ollama.
GPU acceleration
Uses the GPU when one is available.
Performance metrics
Tracks response quality, timing and physics-specific metrics, visualised with Plotly.
Tech Stack
| Language | Python 3.8+ |
|---|---|
| Interface | Streamlit |
| RAG | LangChain |
| LLM | Llama 3 (llama3:latest) via Ollama |
| Retrieval | SentenceTransformers (embeddings), ChromaDB (vector database) |
| Other | PyPDF2 (PDF processing), Plotly (metrics), PyTorch (GPU acceleration), TensorFlow |