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

https://github.com/codehass/it-support-rag-assistant

Industrial-grade RAG Assistant for IT Support. Built with LangChain & FastAPI, managed via MLflow, and deployed with Docker/K8s. Features unsupervised query clustering and full CI/CD integration.
https://github.com/codehass/it-support-rag-assistant

docker fastapi kubernetes mlflow postgresql python3

Last synced: 24 days ago
JSON representation

Industrial-grade RAG Assistant for IT Support. Built with LangChain & FastAPI, managed via MLflow, and deployed with Docker/K8s. Features unsupervised query clustering and full CI/CD integration.

Awesome Lists containing this project

README

          


logo



# 📗 Table of Contents

- [📖 About the Project](#about-project)
- [🛠 Built With](#built-with)
- [Tech Stack](#tech-stack)
- [Key Features](#key-features)
- [🚀 Live Demo](#live-demo)
- [💻 Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Setup](#setup)
- [Install](#install)
- [Configuration](#configuration)
- [Usage](#usage)
- [API Endpoints](#api-endpoints)
- [👥 Authors](#authors)
- [🔭 Future Features](#future-features)
- [🤝 Contributing](#contributing)
- [⭐️ Show your support](#support)
- [📝 License](#license)

# 📖 IT Support RAG Assistant

**IT Support RAG Assistant** is a powerful API designed to automate IT support queries using Retrieval-Augmented Generation (RAG). It combines the power of Large Language Models (Google Gemini) with a local knowledge base (ChromaDB) to provide accurate, context-aware answers to user questions.

The system features robust authentication, query history tracking, automatic query clustering using machine learning, and comprehensive experiment tracking with MLflow.

## 🛠 Built With

### Tech Stack



  • FastAPI - Modern, high-performance web framework for building APIs.


  • PostgreSQL - Advanced open-source relational database.


  • SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper.


  • LangChain - Framework for developing applications powered by LLMs.


  • ChromaDB - AI-native open-source vector database.


  • MLflow - Open source platform for the machine learning lifecycle.


  • Google Gemini - Generative AI models.


  • Hugging Face - Platform for ML models (Embeddings).

### Key Features

- **🔐 Secure Authentication**: User registration and login with JWT-based authentication stored in HTTP-only cookies.
- **🤖 RAG-Powered QA**: Retrieval-Augmented Generation pipeline to answer support queries using your knowledge base.
- **📦 Query Clustering**: Automatic clustering of user queries to categorize support topics using a trained ML model.
- **📊 Experiment Tracking**: Full integration with MLflow to track RAG metrics (latency, number of chunks) and query results.
- **📜 History Management**: Retrieve past user queries and generated answers.
- **🐳 Dockerized**: Container-ready application with Dockerfile included.

(back to top)

## 🚀 Live Demo

- [Live Demo Link](link to deployed project)

(back to top)

## 💻 Getting Started

To get a local copy up and running, follow these steps.

### Prerequisites

- [uv](https://docs.astral.sh/uv/) (Recommended for managing dependencies and environments)
- Python 3.12+ (managed by uv)
- PostgreSQL
- Docker (optional)

### Setup

Clone this repository to your desired folder:

```sh
git clone https://github.com/codehass/it-support-rag-assistant.git
cd it-support-rag-assistant
```

### Install

Install dependencies and create the virtual environment automatically:

```sh
uv sync
```

### Configuration

Create a `.env` file in the root directory and add your environment variables. You can copy `.env.example` as a template:

```sh
cp .env.example .env
```

**Required `.env` Variables:**

```env
USER_DB=postgres
PASSWORD=your_password
DATABASE_HOST=localhost
PORT=5432
DATABASE=your_database_name

# HuggingFace & Google API
HF_TOKEN=your_huggingface_token_here
GOOGLE_API_KEY=your_google_api_key_here

# Authentication
SECRET_KEY=your_secure_secret
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30

FRONTEND_URL=http://localhost:3000
```

### Usage

1. **Start the Database**: Ensure your PostgreSQL service is running and the database is created.

2. **Run the API**:
```sh
uv run fastapi dev app/main.py
```
The API will be available at `http://localhost:8000`.

3. **Explore Documentation**:
Go to `http://localhost:8000/docs` for the interactive Swagger UI.

4. **Start MLflow UI** (Optional, for tracking):
```sh
uv run mlflow ui
```
Access MLflow dashboard at `http://localhost:5000`.

### Testing & Linting

1. **Run Linting** (Ruff):
```sh
uv run ruff check .
```

2. **Run Tests** (Pytest):
```sh
uv run pytest
```

### API Endpoints

**Authentication**
- `POST /api/v1/auth/register` - Register a new user
- `POST /api/v1/auth/login` - Login to get access token (cookie)
- `POST /api/v1/auth/logout` - Logout user
- `GET /api/v1/auth/users/me` - Get current user info

**RAG Support**
- `POST /api/v1/rag/query` - Ask a question to the IT Support Assistant
- `GET /api/v1/rag/history` - Get your query history
- `GET /api/v1/rag/health` - Check backend health status

(back to top)

## 👥 Authors

👤 **Hassan El Ouardy**

- GitHub: [@codehass](https://github.com/codehass)
- Twitter: [@hassanelourdy](https://twitter.com/hassanelourdy)
- LinkedIn: [@hassanelourdy](https://www.linkedin.com/in/hassanelouardy/)

(back to top)

## 🔭 Future Features

- [ ] **Voice Interface**: Enable voice-to-text for querying.
- [ ] **Admin Dashboard**: Analytics view for IT support managers.
- [ ] **Feedback Loop**: User feedback mechanism to improve RAG accuracy.

(back to top)

## 🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the [issues page](https://github.com/codehass/it-support-rag-assistant/issues).

(back to top)

## ⭐️ Show your support

If this project helps you, give it a ⭐️!

(back to top)

## 📝 License

This project is [MIT](./MIT.md) licensed.

(back to top)