Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📚 RAG Chatbot

Python Version Streamlit LangChain

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.


✨ Features

  • 📄 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-instant via Groq for lightning-fast cloud inference (if an API key is provided).
    • Falls back to local tinyllama via Ollama for completely private, local execution.
  • 🔍 Local Embeddings: Uses nomic-embed-text via Ollama for creating high-quality document embeddings.
  • 💾 Chroma Vector Store: Efficiently stores and retrieves document chunks.

🛠️ Tech Stack

  • UI Framework: Streamlit
  • Backend API: FastAPI
  • LLM Orchestration: LangChain
  • Vector Database: Chroma
  • Embeddings: Ollama (nomic-embed-text)
  • PDF Processing: PyMuPDF (fitz)

🚀 Getting Started

Prerequisites

  1. Ensure you have Python 3.12+ installed.
  2. Install Ollama and pull the required models:
    ollama pull nomic-embed-text
    ollama pull tinyllama  # Or any other model you configure
  3. (Optional) Get a Groq API Key for faster, higher-quality responses.

Installation

This project uses uv for dependency management (as indicated by the pyproject.toml and uv.lock), but standard pip works too.

Using uv (Recommended)

uv sync

Using pip

pip install -r requirements.txt

Configuration

Create 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_here

Running the Application

You can run this project either as a Web UI or as a Backend API.

1. Running the Streamlit UI

Start the interactive Streamlit development server:

streamlit run UI/app.py

2. Running the FastAPI Backend

Start the high-performance FastAPI server:

uvicorn main:app --reload

Once running, you can access the API documentation at http://localhost:8000/docs.

🎮 How to Use

  1. Open the app in your browser (usually http://localhost:8501).
  2. Use the sidebar to upload a PDF file.
  3. Wait for the processing to complete (indicated by a success message).
  4. 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).

📄 License

This project is open-source and available under the terms of the MIT License.

About

A RAG-chatbot that fetch/Augment the Answers through Pdf. Useful for fetching and cleaning documents

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages