This project implements a Retrieval-Augmented Generation (RAG) chatbot that runs locally using open-source LLMs managed by Ollama. It features a Python backend built with FastAPI and LangChain and a user-friendly frontend using Streamlit.
The goal of this project is to provide a context-aware chat experience by leveraging documents provided by the user. The chatbot can ingest information from various file types (PDF DOCX TXT) store it efficiently using a vector database (FAISS) and use this knowledge to answer user queries accurately. Users can switch between different locally hosted language models via Ollama.
.env)The application follows a simple client-server architecture:
Clone the repository:
git clone https://github.com/spatel1110/RAG-Chatbot-using-LLMs-and-LangChain.git cd rag-chatbot-project
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate
Install Python dependencies:
pip install -r requirements.txt
ollama pull mistral ollama pull llama3
ollama list
backend directory: cd backend.env file by copying the example or creating it manually:
MODEL_1="mistral" MODEL_2="llama3" EMBEDDING_MODEL="mistral" VECTORSTORE_PATH="../vectorstore/faiss_index"
cd ..Start the Backend (FastAPI):
Open a terminal in the project root directory.
# Ensure venv is active cd backend uvicorn main:app --host 0.0.0.0 --port 8000 --reload
(Keep this terminal running)
Start the Frontend (Streamlit):
Open a new terminal in the project root directory.
# Ensure venv is active cd frontend streamlit run app.py