A high-performance Retrieval-Augmented Generation (RAG) chatbot built with FastAPI, LangChain, and Groq. This application allows you to upload PDF documents and ask questions about their content using state-of-the-art LLMs (Llama 3.3).
- PDF Ingestion: Upload documents via API; they are automatically split into chunks and indexed.
- RAG Architecture: Uses semantic search to retrieve relevant context before generating answers.
- Fast Inference: Powered by Groq for lightning-fast responses.
- Vector Storage: Uses ChromaDB for efficient document storage and retrieval.
- REST API: Built with FastAPI for easy integration with frontend applications.
- Framework: FastAPI
- Orchestration: LangChain
- LLM: Groq (Llama-3.3-70b-versatile)
- Embeddings: Hugging Face (all-MiniLM-L6-v2)
- Vector DB: ChromaDB
- Python 3.14+
- A Groq API Key (Get it here)
Clone the repository:
git clone https://github.com/yourusername/rag-chatbot.git
cd rag-chatbotCreate and activate a virtual environment:
python -m venv .venv
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txt
# OR if using uv
uv syncCreate a .env file in the root directory:
GROQ_API_KEY=your_api_key_hereStart the FastAPI server:
uvicorn app.main:app --reload --port 8000- GET
/: Check if the API is running. - POST
/upload: Upload a PDF file for indexing. - POST
/ask: Send a question to the chatbot.- Body:
{"question": "What is the summary of the document?"}
- Body:
- GET
/health: Check system status.
rag-chatbot/
├── app/
│ ├── __init__.py
│ ├── ingest.py # PDF processing & indexing
│ ├── retriever.py # Vector search logic
│ ├── chain.py # RAG chain implementation
│ └── main.py # FastAPI routes
├── data/ # Storage for uploaded PDFs (ignored by git)
├── chroma_db/ # Local vector database (ignored by git)
├── .env # API keys (ignored by git)
├── .gitignore
└── README.md
MIT License