A Retrieval-Augmented Generation (RAG) based LLM chatbot designed to answer technical customer service questions using a structured internal knowledge base.
The chatbot retrieves relevant policies from a PostgreSQL database, performs vector similarity search using PgVector, and generates accurate responses using the Groq LLM API.
git clone https://github.com/yourusername/Customer-Assistant-Chatbot.git
cd Customer-Assistant-Chatbotpython -m venv venvActivate the environment:
Linux / macOS
source venv/bin/activateWindows
venv\Scripts\activatepip install -r requirements.txtInstall PostgreSQL if it is not already installed.
Then create a new database:
CREATE DATABASE customer_chatbot;Connect to the database and enable the extension:
CREATE EXTENSION IF NOT EXISTS vector;CREATE TABLE documents (
id INTEGER PRIMARY KEY,
category VARCHAR(50) NOT NULL,
prompt TEXT NOT NULL,
response TEXT NOT NULL,
embeddings VECTOR(1536)
);Create a .env file in the project root:
# Database
DB_HOST= your_db_host
DB_PORT= your_db_port
DB_NAME= your_db_name
DB_USER= your_db_user
DB_PASSWORD= your_db_password
# Groq
GROQ_API_KEY= your_groq_api_key
Run the embedding script to convert the 50 policies into vectors and store them in PostgreSQL.
python embeddings/embeddings.pyRun the chatbot:
python streamlit "src\app.py"