An open API service indexing awesome lists of open source software.

https://github.com/garvitjain-02/modular-rag-chatbot

A Modular Retrieval-Augmented Generation (RAG) application that allows users to upload PDF documents and chat with an AI assistant that answers queries based on the document content. It features a microservice architecture with a decoupled FastAPI backend and Streamlit frontend, using ChromaDB as the vector store and Groq's LLaMA3 model as the LLM.
https://github.com/garvitjain-02/modular-rag-chatbot

chromadb fastapi generative-ai groq langchain llama3 llm python rag-chatbot streamlit

Last synced: 3 months ago
JSON representation

A Modular Retrieval-Augmented Generation (RAG) application that allows users to upload PDF documents and chat with an AI assistant that answers queries based on the document content. It features a microservice architecture with a decoupled FastAPI backend and Streamlit frontend, using ChromaDB as the vector store and Groq's LLaMA3 model as the LLM.

Awesome Lists containing this project

README

          

# Modular RAG PDF Chatbot with FastAPI, ChromaDB & Streamlit

This project is a modular **Retrieval-Augmented Generation (RAG)** application that allows users to upload PDF documents and chat with an AI assistant that answers queries based on the document content. It features a microservice architecture with a decoupled **FastAPI backend** and **Streamlit frontend**, using **ChromaDB** as the vector store and **Groq's LLaMA3 model** as the LLM.

---

## πŸ“‚ Project Structure

```
ragbot2.0/
β”œβ”€β”€ client/ # Streamlit Frontend
β”‚ |──components/
| | |──chatUI.py
| | |──history_download.py
| | |──upload.py
| |──utils/
| | |──api.py
| |──app.py
| |──config.py
β”œβ”€β”€ server/ # FastAPI Backend
β”‚ β”œβ”€β”€ chroma_store/ ....after run
| |──modules/
β”‚ β”œβ”€β”€ load_vectorestore.py
β”‚ β”œβ”€β”€ llm.py
β”‚ β”œβ”€β”€ pdf_handler.py
β”‚ β”œβ”€β”€ query_handlers.py
| |──uploaded_pdfs/ ....after run
β”‚ β”œβ”€β”€ logger.py
β”‚ └── main.py
└── README.md
```

---

## ✨ Features

- πŸ“„ Upload and parse PDFs
- 🧠 Embed document chunks with HuggingFace embeddings
- πŸ’‚οΈ Store embeddings in ChromaDB
- πŸ’¬ Query documents using LLaMA3 via Groq
- 🌍 Microservice architecture (Streamlit client + FastAPI server)

---

## πŸŽ“ How RAG Works

Retrieval-Augmented Generation (RAG) enhances LLMs by injecting external knowledge. Instead of relying solely on pre-trained data, the model retrieves relevant information from a vector database (like ChromaDB) and uses it to generate accurate, context-aware responses.

---

## πŸš€ Getting Started Locally

### 1. Clone the Repository

```bash
git clone https://github.com/garvitjain-02/Modular-RAG-Chatbot.git
cd Modular-RAG-Chatbot
```

### 2. Setup the Backend (FastAPI)

```bash
cd server
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt

# Set your Groq API Key (.env)
GROQ_API_KEY="your_key_here"

# Run the FastAPI server
uvicorn main:app --reload
```

### 3. Setup the Frontend (Streamlit)

```bash
cd ../client
pip install -r requirements.txt # if you use a separate venv for client
streamlit run app.py
```

---

## 🌐 API Endpoints (FastAPI)

- `POST /upload_pdfs/` β€” Upload PDFs and build vectorstore
- `POST /ask/` β€” Send a query and receive answers

Testable via Postman or directly from the Streamlit frontend.

---

## 🌟 References

- [LangChain](https://www.langchain.com/)
- [ChromaDB](https://www.trychroma.com/)
- [Groq](https://groq.com/)
- [Streamlit](https://streamlit.io/)

---

## βœ‰οΈ Contact

For questions or suggestions, open an issue or contact at [garvitjainjnv@gmail.com]

---

> Happy Building! πŸš€