Skip to content

Kini99/AI_Powered_Support_System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Intelligent LMS Support System

๐Ÿš€ Intelligent LMS Support System

License Python Version Node.js Version FastAPI Next.js MongoDB Pinecone LangChain LangGraph


Deployed Links

Frontend:

https://intelligent-lms-support-ppfz.vercel.app/

Backend:

https://masaischool.duckdns.org/

๐Ÿ“š Table of Contents

  1. Introduction
  2. Features
  3. Architecture
  4. Technology Stack
  5. Getting Started
  6. Usage
  7. API Endpoints
  8. Project Structure
  9. Future Enhancements
  10. Contributing
  11. License
  12. Contact

๐Ÿ“ Introduction

The Intelligent LMS Support System is an AI-powered ticketing solution for Learning Management Systems that:

  • Automates student query resolution.
  • Retrieves knowledge from a centralized database.
  • Escalates complex cases to human admins.

This is a production-ready AI-powered support system for Masai School's LMS that automates 70-80% of support ticket resolution using:

  • LangGraph: Orchestrates multi-agent workflow with state management
  • LangChain: Provides LLM integration and prompt engineering
  • Google Gemini: Powers natural language understanding and generation
  • Pinecone: Vector database for semantic search and RAG
  • MongoDB: Primary data storage for tickets, users, and documents
  • Redis: High-performance semantic caching
  • FastAPI: Modern, fast web framework for building APIs

โœจ Features

  • ๐Ÿค– AI-Powered Ticket Resolution โ€“ Automated, accurate responses.
  • ๐Ÿ“š Contextual Understanding โ€“ Retrieval-Augmented Generation (RAG).
  • โšก Semantic Caching โ€“ Faster repeated queries.
  • ๐Ÿ†˜ Intelligent Escalation โ€“ Human handoff when needed.
  • ๐Ÿ‘ค Role-Based Access Control โ€“ Student/Admin separation.
  • ๐Ÿ—‚ Knowledge Base Management
    • Document ingestion (PDF, Excel, CSV, etc.)
    • Categorization
    • Listing & deletion tools
  • ๐Ÿ“Š Analytics Dashboard โ€“ Automation rates, agent performance.
  • ๐Ÿ”„ Modular & Scalable โ€“ Easy to add new programs and knowledge bases.
  • ๐ŸŽจ User-Friendly UI โ€“ Intuitive design for all roles.

๐Ÿ— Architecture

graph TD
    A[Student Query] --> B{Routing Agent}
    B --> C{Cache Check (Redis)}
    C -- Cache Hit --> D[Personalize Response (LLM)]
    D --> E[Response to Student]
    C -- Cache Miss --> F{Query Decomposition}
    F --> G{Triage (EC/IA)}
    G --> H{Retriever Agent}
    H --> I{Pinecone Vector DB}
    I --> J{Re-ranking}
    J --> K{Response Agent}
    K --> L{Confidence Scoring}
    L -- High Confidence (>=85%) --> E
    L -- Medium/Low Confidence (<85%) --> M{Escalation Agent}
    M --> N[Notify Admin]
    N --> O[Admin Response]
    O --> P[Update Cache & KB]
    P --> E

๐Ÿ›  Technology Stack

๐Ÿ–ฅ Backend

  • Framework: FastAPI (Python 3.11+)
  • DB: MongoDB (pymongo)
  • Vector DB: Pinecone
  • Cache/Analytics: Redis
  • AI Frameworks: LangChain, LangGraph
  • LLM: Google Generative AI (Gemini 2.5 Flash)
  • Embeddings: HuggingFace all-mpnet-base-v2
  • Document Processing: unstructured.io, pandas, pdfminer.six, pytesseract

๐Ÿ’ป Frontend

  • Framework: Next.js 14 (React, TypeScript)
  • Styling: Tailwind CSS + Shadcn/ui

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • MongoDB & Redis instances
  • Google API Key
  • Pinecone API Key

Environment Variables

๐Ÿ“„ Click to view .env example
# Database
MONGODB_URL="mongodb://localhost:27017/lms_support"
REDIS_URL="redis://localhost:6379"

# Google AI
GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"

# Pinecone
PINECONE_API_KEY="YOUR_PINECONE_API_KEY"
PINECONE_ENVIRONMENT="YOUR_PINECONE_ENVIRONMENT"

# Index & Collection Maps
PINECONE_INDEX_MAP='{"program_details_documents": "program-details-documents", "qa_documents": "qa-documents", "curriculum_documents": "curriculum-documents"}'
MONGO_COLLECTION_MAP='{"program_details_documents": "program_details_documents", "qa_documents": "qa_documents", "curriculum_documents": "curriculum_documents"}'

# App Config
ENVIRONMENT="development"
DEBUG=True
SESSION_SECRET_KEY="YOUR_SECRET"

โ–ถ Installation

Backend

cd Intelligent_lms_support
python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install uv
uv sync
python backend/app/db/init_db.py

Frontend

cd frontend
npm install  # or pnpm install
echo 'NEXT_PUBLIC_API_BASE="http://localhost:8000"' > .env.local

๐Ÿƒ Running the Application

# Backend
uvicorn backend.app.main:app --host 0.0.0.0 --port 8000 --reload

# Frontend
cd frontend
npm run dev

๐ŸŽฏ Usage

๐Ÿ‘จโ€๐ŸŽ“ Student Flow
  1. Visit http://localhost:3000
  2. Login as student
  3. Create and track tickets
  4. Reopen or rate resolved tickets
๐Ÿ›  Admin Flow
  1. Login as admin
  2. Manage tickets and documents

    Adding New Programs

    1. Choose a category for the document with help of category guide provided
    2. Select categories and courses to which document is applicable
    3. Upload the document (Might take few minutes to process)
  3. Respond to escalated tickets
  4. View analytics dashboard

๐Ÿ“ก API Endpoints

Authentication

  • POST /v1/auth/login - User login
  • POST /v1/auth/logout - User logout
  • GET /me - Get current user information

Tickets (Students)

  • POST /v1/tickets/create - Create new ticket
  • GET /v1/tickets/my_tickets - List user's tickets
  • GET /v1/tickets/{ticket_id} - Get ticket details
  • POST /v1/tickets/{ticket_id}/reopen - Reopen resolved ticket
  • POST /v1/tickets/{ticket_id}/rate - Rate ticket resolution
  • POST /{ticket_id}/messages - A user (student or admin) adds a message to an existing ticket.

Admin Operations

  • GET /v1/admin/tickets - List tickets for admin
  • POST /v1/admin/tickets/{ticket_id}/respond - Admin response
  • POST /v1/admin/documents/upload - Upload knowledge base document
  • DELETE /v1/admin/documents/{doc_id} - Delete document
  • GET /v1/admin/documents - List documents
  • POST /v1/admin/tickets/{ticket_id}/resolve - Admin Resolves a ticket
  • GET /v1/admin/analytics

๐Ÿงช Testing

Test Credentials

API Documentation

Once the server is running, visit:

Sample Test Flow

# 1. Login as student
POST /v1/auth/login
{
  "username": "student1@masaischool.com",
  "password": "password123"
}

# 2. Create a ticket
POST /v1/tickets/create
{
  "category": "Course Query",
  "title": "Cannot access Unit 3",
  "message": "I completed Unit 2 but cannot see Unit 3 materials"
}

# 3. Check ticket status
GET /v1/tickets/my_tickets

# The system will automatically process the ticket through the LangGraph workflow

๐Ÿ“ˆ Performance Metrics

  • Response Time: 3-5 seconds for cached queries, 8-10 seconds for new queries
  • Automation Rate: 70-80% of tickets resolved without human intervention
  • Escalation Rate: 20-30% for complex or unclear queries

๐Ÿ› Troubleshooting

Common Issues

  1. MongoDB Connection Error

    • Ensure MongoDB is installed and running
    • Check connection string in .env
  2. API Key Errors

    • Verify Google Gemini API key is valid
    • Check Pinecone API key and environment
  3. Import Errors

    • Run pip install -r requirements.txt again
    • Check Python version (3.9+ required)
  4. Cache Not Working

    • Install and start Redis
    • Check Redis connection URL

๐Ÿ“‚ Project Structure

Intelligent_lms_support/
โ”œโ”€โ”€ backend/
โ”‚   โ””โ”€โ”€ app/
โ”‚       โ”œโ”€โ”€ agents/          # Multi-agent implementations
โ”‚       โ”‚   โ”œโ”€โ”€ langgraph_workflow.py  # Enhanced LangGraph workflow
โ”‚       โ”‚   โ”œโ”€โ”€ routing_agent.py
โ”‚       โ”‚   โ”œโ”€โ”€ retriever_agent.py
โ”‚       โ”‚   |
โ”‚       โ”‚   โ””โ”€โ”€ escalation_agent.py
โ”‚       โ”œโ”€โ”€ api/             # FastAPI routes
โ”‚       โ”œโ”€โ”€ core/            # Configuration and security
โ”‚       โ”œโ”€โ”€ db/              # Database initialization
โ”‚       โ”œโ”€โ”€ models/          # Data models
โ”‚       โ”œโ”€โ”€ scripts/         # Data ingestion scripts
โ”‚       โ””โ”€โ”€ services/        # Document and cache services
โ”œโ”€โ”€ Documents/               # Sample FAQs and documents
โ”œโ”€โ”€ .env                     # Environment configuration
โ”œโ”€โ”€ requirements.txt         # Python dependencies
โ”œโ”€โ”€ run.py                  # Main application entry

๐Ÿ”ฎ Future Enhancements

  • Support for attachments in tickets.
  • Suggest response to query option for admins.
  • Tags for metadata of documents for easier organization and search.
  • Live updates/notifications for escalations and responses.
  • LLM fine-tuning with feedback loop.
  • Granular analytics.

๐Ÿ“œ License

This project is developed for Masai School as part of the Improving the LMS Support System initiative.


๐Ÿ“ฌ Contact

** Aravind Yuraj ** ๐Ÿ“ง aravind98761234@gmail.com ๐Ÿ”— GitHub Profile

** Kinjal Momaya ** ๐Ÿ“ง kinjalmomaya99@gmail.com ๐Ÿ”— GitHub Profile

About

This is a production-ready AI-powered support system for Masai School's LMS that automates 70-80% of support ticket resolution.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors