https://github.com/rajat25022005/rag_faq_chatbot
This project uses a Python backend and a vanilla JS frontend to create a private, local chatbot powered by a RAG architecture and Ollama.
https://github.com/rajat25022005/rag_faq_chatbot
chatbot faiss flask js llm ml ollama python rag
Last synced: 3 months ago
JSON representation
This project uses a Python backend and a vanilla JS frontend to create a private, local chatbot powered by a RAG architecture and Ollama.
- Host: GitHub
- URL: https://github.com/rajat25022005/rag_faq_chatbot
- Owner: Rajat25022005
- Created: 2025-06-07T04:15:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-07T04:32:16.000Z (about 1 year ago)
- Last Synced: 2025-06-18T16:04:55.579Z (about 1 year ago)
- Topics: chatbot, faiss, flask, js, llm, ml, ollama, python, rag
- Language: Python
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
RAG FAQ Chatbot (with Ollama)
This project uses a Retrieval-Augmented Generation (RAG) approach to create a chatbot that answers questions based on a provided list of FAQs. This version is configured to use Ollama to run the local Large Language Model.
How It Works
Backend (Python/Flask):
Loads your FAQs from faqs.json.
Uses sentence-transformers to create vector embeddings from the FAQs.
Builds a faiss-cpu index for fast similarity searching (the Retrieval step).
When you ask a question, it finds the most relevant FAQ.
It then sends your question and the retrieved FAQ to your local Ollama model (e.g., gemma:2b).
The Ollama model generates a natural, conversational answer (the Generation step).
Frontend (HTML/JS/CSS):
Provides a simple chat UI in your browser.
Communicates with the backend to get chatbot responses.
Setup Instructions
Step 1: Set Up Ollama
Install Ollama: If you haven't already, download and install Ollama from ollama.com.
Pull a Model: Open your terminal and pull the model you want to use. For gemma:2b, run:
ollama pull gemma:2b
Ollama will automatically start a server in the background. You can check that it's running by visiting http://localhost:11434 in your browser.
Step 2: Set Up the Backend
Create and Activate Virtual Environment:
Make sure you are inside your backend directory and your Python virtual environment is active.
macOS/Linux: source venv/bin/activate
Windows: venv\Scripts\activate
Install/Update Dependencies:
This version uses a new library for Ollama. Run the following command to install it:
pip install -r requirements.txt
Add Your FAQs:
Make sure your backend/faqs.json file is populated with your own questions and answers.
Run the Backend Server:
In the same terminal, run the Flask app:
python app.py
The server will start on http://127.0.0.1:5001.
Step 3: Launch the Frontend
Navigate to the frontend directory.
Open index.html in your web browser.
You can now chat with your FAQ bot, powered by Ollama and Gemma!