A Retrieval-Augmented Generation (RAG) chatbot built with Streamlit, LangChain, and ChromaDB. This application allows users to upload PDF documents and ask questions about their content in an interactive chat interface.
It supports local models via Ollama and fast cloud inference through Groq.
- 📄 PDF Ingestion: Upload any PDF document directly through the UI.
- 💬 Interactive Chat: Ask questions and get precise answers based only on the provided context.
- 🧠 Flexible LLMs:
- Uses
llama-3.1-8b-instantvia Groq for lightning-fast cloud inference (if an API key is provided). - Falls back to local
tinyllamavia Ollama for completely private, local execution.
- Uses
- 🔍 Local Embeddings: Uses
nomic-embed-textvia Ollama for creating high-quality document embeddings. - 💾 Chroma Vector Store: Efficiently stores and retrieves document chunks.
- UI Framework: Streamlit
- Backend API: FastAPI
- LLM Orchestration: LangChain
- Vector Database: Chroma
- Embeddings: Ollama (
nomic-embed-text) - PDF Processing: PyMuPDF (
fitz)
- Ensure you have Python 3.12+ installed.
- Install Ollama and pull the required models:
ollama pull nomic-embed-text ollama pull tinyllama # Or any other model you configure - (Optional) Get a Groq API Key for faster, higher-quality responses.
This project uses uv for dependency management (as indicated by the pyproject.toml and uv.lock), but standard pip works too.
uv syncpip install -r requirements.txtCreate a .env file in the root directory and add your Groq API key (if you plan to use Groq instead of Ollama):
GROQ_API_KEY=your_groq_api_key_hereYou can run this project either as a Web UI or as a Backend API.
Start the interactive Streamlit development server:
streamlit run UI/app.pyStart the high-performance FastAPI server:
uvicorn main:app --reloadOnce running, you can access the API documentation at http://localhost:8000/docs.
- Open the app in your browser (usually
http://localhost:8501). - Use the sidebar to upload a PDF file.
- Wait for the processing to complete (indicated by a success message).
- Start chatting! Ask questions about the uploaded document, and the AI will answer based on its contents. If you don't upload a document, it will fallback to the local
chroma_db(if pre-ingested).
This project is open-source and available under the terms of the MIT License.