Skip to content

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.

Notifications You must be signed in to change notification settings

codehass/it-support-rag-assistant

Repository files navigation

logo

📗 Table of Contents

📖 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 (Recommended for managing dependencies and environments)
  • Python 3.12+ (managed by uv)
  • PostgreSQL
  • Docker (optional)

Setup

Clone this repository to your desired folder:

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:

uv sync

Configuration

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

cp .env.example .env

Required .env Variables:

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:

    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):

    uv run mlflow ui

    Access MLflow dashboard at http://localhost:5000.

Testing & Linting

  1. Run Linting (Ruff):

    uv run ruff check .
  2. Run Tests (Pytest):

    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

(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.

(back to top)

⭐️ Show your support

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

(back to top)

📝 License

This project is MIT licensed.

(back to top)

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published