Spaces:
Running
Running
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,253 +1,223 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: SupportMind
|
| 3 |
emoji: 🧠
|
| 4 |
-
colorFrom: blue
|
| 5 |
-
colorTo: indigo
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
# AetherFlow AI | SupportMind Engine 🧠
|
| 11 |
-
|
| 12 |
-
**Confidence-Gated Support Intelligence for B2B SaaS Customer Operations**
|
| 13 |
-
|
| 14 |
-
[](https://python.org)
|
| 15 |
-
[](https://fastapi.tiangolo.com)
|
| 16 |
-
[](https://huggingface.co/)
|
| 17 |
-
[](LICENSE)
|
| 18 |
-
[](https://github.com/asmitha2025/supportfloww/actions)
|
| 19 |
-
|
| 20 |
-
> *"B2B SaaS support teams don't lose customers because agents are slow. They lose them because AI acts with false confidence on ambiguous tickets — and nobody in the stack knows it happened."*
|
| 21 |
-
|
| 22 |
-
---
|
| 23 |
-
|
| 24 |
-
## 🎯 What is SupportMind?
|
| 25 |
-
|
| 26 |
-
SupportMind is a **confidence-gated, uncertainty-aware** ticket routing system that solves the most expensive unsolved problem in B2B SaaS support: **AI routing ambiguous tickets with false certainty**.
|
| 27 |
-
|
| 28 |
-
Unlike traditional AI solutions (Zoho Zia, Freshworks Freddy, Zendesk, and Salesforce Einstein) which use standard Softmax classifiers with no uncertainty output, SupportMind implements **Monte Carlo Dropout on DistilBERT**. This produces calibrated confidence scores and Shannon entropy, enabling a robust **three-tier decision gate**:
|
| 29 |
-
|
| 30 |
-
| Action | Confidence | Entropy | What Happens |
|
| 31 |
-
|--------|-----------|---------|--------------|
|
| 32 |
-
| **ROUTE** | ≥ 0.80 | ≤ 0.35 | Auto-assign to the correct agent queue immediately. |
|
| 33 |
-
| **CLARIFY** | 0.55 – 0.80 | N/A | Ask 1 targeted, high-information-gain question to disambiguate. |
|
| 34 |
-
| **ESCALATE** | < 0.55 | N/A | Flag as complex; send to human triage immediately. |
|
| 35 |
-
|
| 36 |
-
---
|
| 37 |
-
|
| 38 |
-
## 🏗️ Detailed System Architecture
|
| 39 |
-
|
| 40 |
-
The SupportMind engine operates as a multi-stage pipeline designed to mimic human cognitive processes in support triage:
|
| 41 |
-
|
| 42 |
-
### Stage 1: Feature Extraction & Signal Detection
|
| 43 |
-
When a ticket arrives, it passes through an NLP feature extraction layer:
|
| 44 |
-
* **DistilBERT Embeddings**: Extracts deep semantic meaning (768-dimensional space).
|
| 45 |
-
* **VADER Sentiment Analysis**: Measures emotional tone (frustration, anger).
|
| 46 |
-
* **Regex & Heuristics**: Detects urgency flags ("ASAP", "System Down") and text complexity (Flesch-Kincaid).
|
| 47 |
-
|
| 48 |
-
### Stage 2: Confidence-Gated Router (MC Dropout)
|
| 49 |
-
Instead of a single forward pass, the DistilBERT classifier performs **20 stochastic forward passes**. By randomly deactivating neurons, it generates a distribution of predictions.
|
| 50 |
-
* **Low variance** across passes = High Confidence (Safe to Route)
|
| 51 |
-
* **High variance** across passes = High Epistemic Uncertainty (Needs Clarification or Escalation)
|
| 52 |
-
|
| 53 |
-
### Stage 3: The Intelligence Layer
|
| 54 |
-
* **SLA Breach Predictor (XGBoost)**: Evaluates the extracted features against current queue depth and historical SLA data to predict the probability of missing SLA targets (AUC 0.83).
|
| 55 |
-
* **Clarification Engine (Hybrid Architecture)**: When the router enters the CLARIFY tier, the engine uses a two-layer approach:
|
| 56 |
-
1. **LLM Layer (Groq LLaMA3-8B)**: Generates a ticket-specific question referencing the customer's exact words. Runs in ~100ms via Groq's optimized inference.
|
| 57 |
-
2. **Template Layer (fallback)**: If LLM is unavailable, selects from 47 pre-built templates scored by expected Shannon entropy reduction (information gain).
|
| 58 |
-
|
| 59 |
-
This design ensures the system never stops routing — LLM enhances quality when available, templates guarantee reliability always.
|
| 60 |
-
|
| 61 |
-
---
|
| 62 |
-
|
| 63 |
-
## 📊 Benchmark Results (Honest Dual-Evaluation)
|
| 64 |
-
|
| 65 |
-
> ⚠️ **Benchmark Validity**: To ensure complete transparency, this project reports two sets of accuracy numbers:
|
| 66 |
-
> 1. **In-Distribution (Synthetic)**: The test set is generated from the same templates as the training data. The 100% accuracy here merely confirms the model successfully learned the training distribution without catastrophic forgetting.
|
| 67 |
-
> 2. **Out-of-Distribution (OOD)**: Evaluated against a separate, hand-crafted dataset of 96 real-world-style tickets (informal language, typos, missing context, and ambiguous edge-cases). **This is the honest estimate of the model's true generalization ability before fine-tuning on real production data.**
|
| 68 |
-
|
| 69 |
-
| Metric | In-Distribution *(synthetic)* | Out-of-Distribution *(hand-crafted)* |
|
| 70 |
-
|--------|------------------------------|--------------------------------------|
|
| 71 |
-
| Overall Routing Accuracy | **100.0%** | **57.3%** |
|
| 72 |
-
| Precision on Auto-Routed | **100.0%** | **100.0%** |
|
| 73 |
-
| Accuracy on Ambiguous Tickets | — | **30.0%** |
|
| 74 |
-
|
| 75 |
-
### Why the OOD Accuracy is "Low" (And Why That's Good)
|
| 76 |
-
On the OOD dataset, the model correctly routed the familiar tickets but struggled with the novel/ambiguous ones. **However, it only auto-routed 2.1% of the OOD tickets (achieving 100% precision on those).** It correctly flagged the remaining 97.9% as requiring clarification (51%) or escalation (47%).
|
| 77 |
-
|
| 78 |
-
Traditional Softmax classifiers would have blindly auto-routed these unfamiliar tickets, leading to costly misroutes. **SupportMind's confidence gate correctly prevented these misroutes.** This proves the architecture works as intended—even when the model weights are untrained for the specific domain, the system fails *safely*.
|
| 79 |
-
|
| 80 |
-
### Why This Matters for Zoho Desk + Zia
|
| 81 |
-
|
| 82 |
-
Zia's current field prediction uses standard Softmax — it returns a
|
| 83 |
-
category with no uncertainty signal. When Zia is wrong on an ambiguous
|
| 84 |
-
ticket, the agent only discovers the misroute after picking it up.
|
| 85 |
-
SupportMind's clarification gate catches this *before* routing,
|
| 86 |
-
reducing misroute cost from agent-time to one extra customer message.
|
| 87 |
-
|
| 88 |
-
---
|
| 89 |
-
|
| 90 |
-
## 🚀 Installation & Setup Guide
|
| 91 |
-
|
| 92 |
-
Follow these steps to set up the engine locally for development or demonstration.
|
| 93 |
-
|
| 94 |
-
### 1. Prerequisites
|
| 95 |
-
* Python 3.10+
|
| 96 |
-
* Git
|
| 97 |
-
* Virtual Environment tool (`venv`, `conda`, etc.)
|
| 98 |
-
|
| 99 |
-
### 2. Clone and Install
|
| 100 |
-
```bash
|
| 101 |
-
# Clone the repository
|
| 102 |
-
git clone https://github.com/asmitha2025/supportfloww.git
|
| 103 |
-
cd supportfloww
|
| 104 |
-
|
| 105 |
-
# Create and activate a virtual environment
|
| 106 |
-
python -m venv venv
|
| 107 |
-
source venv/bin/activate # On Windows use: venv\Scripts\activate
|
| 108 |
-
|
| 109 |
-
# Install dependencies
|
| 110 |
-
pip install -r requirements.txt
|
| 111 |
-
```
|
| 112 |
-
|
| 113 |
-
### 3. Running the System Locally
|
| 114 |
-
The core system is powered by FastAPI, serving both the REST API and the interactive dashboard.
|
| 115 |
-
|
| 116 |
-
```bash
|
| 117 |
-
# Start the FastAPI server
|
| 118 |
-
cd src
|
| 119 |
-
uvicorn api:app --host 0.0.0.0 --port 7860 --reload
|
| 120 |
-
```
|
| 121 |
-
Once the server is running, navigate to `http://localhost:7860/` in your web browser to access the **Live SupportMind Dashboard**.
|
| 122 |
-
|
| 123 |
-
### Runtime Mode
|
| 124 |
-
SupportMind exposes the active runtime at `GET /model/status`.
|
| 125 |
-
|
| 126 |
-
- On Windows, the API defaults to the sklearn fallback router to avoid native PyTorch/safetensors crashes during demos.
|
| 127 |
-
- On Linux/Hugging Face Spaces, the transformer ensemble is attempted when model files are present.
|
| 128 |
-
- To force transformer loading locally after verifying your machine can support it, set `SUPPORTMIND_FORCE_TRANSFORMER=1`.
|
| 129 |
-
- To explicitly run lightweight mode anywhere, set `SUPPORTMIND_DISABLE_TRANSFORMER=1`.
|
| 130 |
-
|
| 131 |
-
---
|
| 132 |
-
|
| 133 |
-
## 🧠 Training the Models
|
| 134 |
-
|
| 135 |
-
If you wish to retrain the models from scratch using your own datasets:
|
| 136 |
-
|
| 137 |
-
1. **Prepare Data**: Place your raw ticket data in `data/raw/`.
|
| 138 |
-
2. **Train Router**:
|
| 139 |
-
```bash
|
| 140 |
-
python src/train_baseline.py # Trains the fallback TF-IDF + Logistic Regression model
|
| 141 |
-
python src/train_router.py # Trains the DistilBERT sequence classifier
|
| 142 |
-
```
|
| 143 |
-
*These scripts train the routing models and save them to `models/ticket_classifier/`.*
|
| 144 |
-
3. **Train SLA Predictor**:
|
| 145 |
-
```bash
|
| 146 |
-
python src/train_sla.py
|
| 147 |
-
```
|
| 148 |
-
*This trains the XGBoost model based on synthetic feature data and saves to `models/sla_predictor/`.*
|
| 149 |
-
4. **Evaluate System**:
|
| 150 |
-
```bash
|
| 151 |
-
python src/evaluate.py
|
| 152 |
-
```
|
| 153 |
-
*Generates benchmark metrics comparing MC Dropout against a standard Softmax baseline.*
|
| 154 |
-
|
| 155 |
-
---
|
| 156 |
-
|
| 157 |
-
## 📡 Comprehensive API Reference
|
| 158 |
-
|
| 159 |
-
SupportMind exposes a fully documented RESTful API. When the server is running, visit `http://localhost:7860/docs` for the interactive Swagger UI.
|
| 160 |
-
|
| 161 |
-
### `POST /route`
|
| 162 |
-
**Description**: Main routing endpoint. Processes a ticket and returns a 3-tier confidence-gated decision.
|
| 163 |
-
**Request Body**:
|
| 164 |
-
```json
|
| 165 |
-
{
|
| 166 |
-
"text": "The API endpoint /v2/export returns a 500 error when batch size exceeds 1000.",
|
| 167 |
-
"customer_id": "cust_8910"
|
| 168 |
-
}
|
| 169 |
-
```
|
| 170 |
-
**Response**:
|
| 171 |
-
```json
|
| 172 |
-
{
|
| 173 |
-
"action": "route",
|
| 174 |
-
"confidence": 0.942,
|
| 175 |
-
"entropy": 0.12,
|
| 176 |
-
"top_category": "technical_support",
|
| 177 |
-
"features": {
|
| 178 |
-
"sentiment_score": -0.25,
|
| 179 |
-
"urgency_flags": []
|
| 180 |
-
},
|
| 181 |
-
"sla_breach_probability": 0.15,
|
| 182 |
-
"latency_ms": 45.2
|
| 183 |
-
}
|
| 184 |
-
```
|
| 185 |
-
|
| 186 |
-
### `POST /clarify`
|
| 187 |
-
**Description**: Fetch the best clarification question based on model uncertainty.
|
| 188 |
-
### `POST /sla/predict`
|
| 189 |
-
**Description**: Predict SLA breach risk independently based on features.
|
| 190 |
-
### `POST /churn/signal`
|
| 191 |
-
**Description**: Extract churn signals from an array of historical thread texts.
|
| 192 |
-
### `GET /metrics`
|
| 193 |
-
**Description**: Live system health and routing distribution statistics.
|
| 194 |
-
|
| 195 |
-
---
|
| 196 |
-
|
| 197 |
-
## 🐳 Docker Deployment
|
| 198 |
-
|
| 199 |
-
For production deployments, package the application using Docker.
|
| 200 |
-
|
| 201 |
-
```bash
|
| 202 |
-
# Build the image
|
| 203 |
-
docker build -t supportmind .
|
| 204 |
-
|
| 205 |
-
# Run the container
|
| 206 |
-
docker run -d -p 7860:7860 --name supportmind-api supportmind
|
| 207 |
-
```
|
| 208 |
-
|
| 209 |
-
For advanced orchestration, we recommend extending the deployment with `docker-compose` to include Redis or RabbitMQ for asynchronous webhook processing.
|
| 210 |
-
|
| 211 |
-
---
|
| 212 |
-
|
| 213 |
-
## 📁 Repository Structure
|
| 214 |
-
|
| 215 |
-
```text
|
| 216 |
-
supportmind/
|
| 217 |
-
├── src/
|
| 218 |
-
│ ├── api.py # FastAPI server & endpoints
|
| 219 |
-
│ ├── confidence_router.py # DistilBERT MC Dropout logic
|
| 220 |
-
│ ├── clarification_engine.py # Shannon entropy info-gain logic
|
| 221 |
-
│ ├── sla_predictor.py # XGBoost SLA modeling
|
| 222 |
-
│ ├── feature_extraction.py # NLP Feature engineering
|
| 223 |
-
��� ├── churn_extractor.py # Sentiment & Churn analysis
|
| 224 |
-
│ ├── train_router.py # DistilBERT training script
|
| 225 |
-
│ ├── train_sla.py # XGBoost training script
|
| 226 |
-
│ └── evaluate.py # Evaluation & benchmark suite
|
| 227 |
-
├── dashboard/
|
| 228 |
-
│ └── web/ # Interactive Frontend HTML/CSS/JS
|
| 229 |
-
│ ├── index.html # Main UI
|
| 230 |
-
│ ├── app.js # Frontend logic & API calls
|
| 231 |
-
│ └── style.css # Glassmorphism styling
|
| 232 |
-
├── data/
|
| 233 |
-
│ └── clarification_bank.json # 47 Question templates
|
| 234 |
-
├── models/ # Stored model weights (ignored in git)
|
| 235 |
-
├── tests/ # Pytest suite
|
| 236 |
-
├── Dockerfile # Containerization instructions
|
| 237 |
-
├── requirements.txt # Python dependencies
|
| 238 |
-
└── README.md # You are here
|
| 239 |
-
```
|
| 240 |
-
|
| 241 |
-
---
|
| 242 |
-
|
| 243 |
-
## 👤 Author
|
| 244 |
-
|
| 245 |
-
**Asmitha** · BSc Data Science · 2026
|
| 246 |
-
|
| 247 |
-
Part of the three-project portfolio arc:
|
| 248 |
-
1. **OPTI-FAB** → Manufacturing edge AI with confidence gating
|
| 249 |
-
2. **IncidentMind** → RL-based incident response with ambiguity awareness
|
| 250 |
-
3. **SupportMind** → NLP ticket routing with MC Dropout uncertainty
|
| 251 |
-
|
| 252 |
-
> *"I spent the last year building systems that know what they don't know."*
|
| 253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# SupportMind
|
| 11 |
+
|
| 12 |
+
**Confidence-gated AI ticket routing for B2B SaaS support teams**
|
| 13 |
+
|
| 14 |
+
[](https://python.org)
|
| 15 |
+
[](https://fastapi.tiangolo.com)
|
| 16 |
+
[](https://huggingface.co/)
|
| 17 |
+
[](https://github.com/asmitha2025/supportfloww/actions)
|
| 18 |
+
|
| 19 |
+
SupportMind is an uncertainty-aware support-routing engine built for the problem that most ticket classifiers ignore: **AI can be confidently wrong on ambiguous customer tickets**.
|
| 20 |
+
|
| 21 |
+
Instead of always forcing a category, SupportMind uses a three-tier decision gate:
|
| 22 |
+
|
| 23 |
+
| Decision | Signal | Action |
|
| 24 |
+
| --- | --- | --- |
|
| 25 |
+
| Route | High confidence, low ambiguity | Auto-assign to the best support queue. |
|
| 26 |
+
| Clarify | Medium confidence or competing intents | Ask one targeted question before routing. |
|
| 27 |
+
| Escalate | Low confidence or high-risk uncertainty | Send to human triage. |
|
| 28 |
+
|
| 29 |
+
This makes the system useful for real support operations where a wrong route can cost agent time, SLA performance, and customer trust.
|
| 30 |
+
|
| 31 |
+
## Why It Matters
|
| 32 |
+
|
| 33 |
+
Traditional softmax classifiers return a category even when the input is unclear. In customer support, that means tickets like "export is broken and my invoice is wrong" can be routed to only one team, even though two teams need to act.
|
| 34 |
+
|
| 35 |
+
SupportMind is designed to fail safely:
|
| 36 |
+
|
| 37 |
+
- Detects uncertainty with Monte Carlo Dropout and entropy.
|
| 38 |
+
- Handles multi-intent tickets such as billing plus technical support.
|
| 39 |
+
- Generates clarification questions when the model should not guess.
|
| 40 |
+
- Predicts SLA risk using operational features.
|
| 41 |
+
- Provides a lightweight fallback router so clean clones, demos, and CI still work without private model files.
|
| 42 |
+
|
| 43 |
+
## Demo Flow
|
| 44 |
+
|
| 45 |
+
Run the API and dashboard:
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
pip install -r requirements.txt
|
| 49 |
+
uvicorn src.api:app --host 0.0.0.0 --port 7860 --reload
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Open:
|
| 53 |
+
|
| 54 |
+
```text
|
| 55 |
+
http://localhost:7860/
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
Try these tickets:
|
| 59 |
+
|
| 60 |
+
```text
|
| 61 |
+
The API endpoint /v2/export returns a 500 error when batch size exceeds 1000 records.
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
```text
|
| 65 |
+
The invoice is wrong, and also SSO login is broken for our managers.
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
```text
|
| 69 |
+
Could you please help resolve this? This is becoming difficult for our onboarding team and we are disappointed with repeated delays.
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## Architecture
|
| 73 |
+
|
| 74 |
+
```text
|
| 75 |
+
Incoming ticket
|
| 76 |
+
-> validation and cleaning
|
| 77 |
+
-> feature extraction
|
| 78 |
+
-> confidence-gated router
|
| 79 |
+
-> multi-intent detection
|
| 80 |
+
-> SLA risk scoring
|
| 81 |
+
-> route, clarify, or escalate
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
Core modules:
|
| 85 |
+
|
| 86 |
+
- `src/api.py` - FastAPI app, dashboard serving, orchestration, guardrails.
|
| 87 |
+
- `src/ensemble_router.py` - Transformer plus sklearn ensemble with fallback mode.
|
| 88 |
+
- `src/confidence_router.py` - Monte Carlo Dropout transformer router.
|
| 89 |
+
- `src/clarification_engine.py` - LLM/template clarification question generation.
|
| 90 |
+
- `src/feature_extraction.py` - NLP, sentiment, urgency, and complexity signals.
|
| 91 |
+
- `src/sla_predictor.py` - SLA breach risk prediction.
|
| 92 |
+
- `tests/` - API, router, clarification, SLA, validator, and feature tests.
|
| 93 |
+
|
| 94 |
+
## Runtime Modes
|
| 95 |
+
|
| 96 |
+
SupportMind supports two runtime paths:
|
| 97 |
+
|
| 98 |
+
- **Full model mode:** uses transformer model files when available.
|
| 99 |
+
- **Fallback mode:** uses an embedded sklearn router so tests, demos, and CI can run without ignored local model artifacts.
|
| 100 |
+
|
| 101 |
+
Model artifacts are intentionally ignored from git:
|
| 102 |
+
|
| 103 |
+
```text
|
| 104 |
+
models/
|
| 105 |
+
data/raw/
|
| 106 |
+
data/processed/
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
This keeps the repository lightweight and makes the public project easier to clone.
|
| 110 |
+
|
| 111 |
+
## Benchmark Framing
|
| 112 |
+
|
| 113 |
+
SupportMind reports two types of evaluation:
|
| 114 |
+
|
| 115 |
+
| Metric | In-distribution synthetic | Out-of-distribution hand-crafted |
|
| 116 |
+
| --- | ---: | ---: |
|
| 117 |
+
| Routing accuracy | 100.0% | 57.3% |
|
| 118 |
+
| Auto-route precision | 100.0% | 100.0% |
|
| 119 |
+
| Ambiguous-ticket accuracy | N/A | 30.0% |
|
| 120 |
+
|
| 121 |
+
The OOD number is intentionally honest. The important result is not that the model guesses every unclear ticket correctly. The important result is that it avoids unsafe auto-routing when it is uncertain.
|
| 122 |
+
|
| 123 |
+
## Safety Approach
|
| 124 |
+
|
| 125 |
+
No AI router can guarantee that every unseen customer ticket will be correct. SupportMind handles that risk by making uncertainty part of the workflow:
|
| 126 |
+
|
| 127 |
+
- Low-confidence tickets are escalated instead of forced into a queue.
|
| 128 |
+
- Medium-confidence tickets trigger clarification instead of silent guessing.
|
| 129 |
+
- Multi-intent tickets expose primary and secondary queues.
|
| 130 |
+
- Non-neutral sentiment must include visible evidence in the response.
|
| 131 |
+
- Demo consistency tests verify that displayed queues match the probability chart.
|
| 132 |
+
|
| 133 |
+
For production use, this should still be paired with real support data, calibration checks, human review thresholds, and agent feedback loops. The demo is honest about that boundary.
|
| 134 |
+
|
| 135 |
+
## API
|
| 136 |
+
|
| 137 |
+
Interactive docs are available at:
|
| 138 |
+
|
| 139 |
+
```text
|
| 140 |
+
http://localhost:7860/docs
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
Main endpoint:
|
| 144 |
+
|
| 145 |
+
```http
|
| 146 |
+
POST /route
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
Example request:
|
| 150 |
+
|
| 151 |
+
```json
|
| 152 |
+
{
|
| 153 |
+
"text": "The API endpoint /v2/export returns a 500 error when batch size exceeds 1000 records.",
|
| 154 |
+
"customer_id": "cust_8910"
|
| 155 |
+
}
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
Example response:
|
| 159 |
+
|
| 160 |
+
```json
|
| 161 |
+
{
|
| 162 |
+
"action": "route",
|
| 163 |
+
"confidence": 0.94,
|
| 164 |
+
"entropy": 0.12,
|
| 165 |
+
"top_category": "technical_support",
|
| 166 |
+
"sla_breach_probability": 0.15,
|
| 167 |
+
"latency_ms": 45.2
|
| 168 |
+
}
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
Other endpoints:
|
| 172 |
+
|
| 173 |
+
- `POST /clarify` - generate a clarification question.
|
| 174 |
+
- `POST /sla/predict` - score SLA breach risk.
|
| 175 |
+
- `POST /churn/signal` - extract churn-risk signals from conversation history.
|
| 176 |
+
- `POST /explain` - return token-level explanation data.
|
| 177 |
+
- `GET /metrics` - live routing distribution and service stats.
|
| 178 |
+
- `GET /model/status` - active model/fallback status.
|
| 179 |
+
|
| 180 |
+
## Tests
|
| 181 |
+
|
| 182 |
+
Run:
|
| 183 |
+
|
| 184 |
+
```bash
|
| 185 |
+
python -m pytest -q
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
Current local result:
|
| 189 |
+
|
| 190 |
+
```text
|
| 191 |
+
55 passed
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
The test suite also passes in a clean-checkout simulation without local model files, matching the GitHub Actions environment.
|
| 195 |
+
|
| 196 |
+
For demo QA, add new edge-case tickets to `DEMO_TICKETS` in `tests/test_demo_consistency.py`. That test checks that multi-route labels match the probability chart and non-neutral sentiment has visible evidence.
|
| 197 |
+
|
| 198 |
+
## Docker
|
| 199 |
+
|
| 200 |
+
```bash
|
| 201 |
+
docker build -t supportmind .
|
| 202 |
+
docker run -p 7860:7860 supportmind
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
+
## Portfolio Positioning
|
| 206 |
+
|
| 207 |
+
SupportMind is built as a hiring-facing AI engineering project for support platforms such as Zoho Desk, Freshworks, Zendesk, Intercom, Salesforce Service Cloud, and similar customer operations products.
|
| 208 |
+
|
| 209 |
+
The project demonstrates:
|
| 210 |
+
|
| 211 |
+
- ML system design beyond a basic classifier.
|
| 212 |
+
- Practical uncertainty handling.
|
| 213 |
+
- FastAPI service design.
|
| 214 |
+
- Frontend demo experience.
|
| 215 |
+
- CI-tested behavior.
|
| 216 |
+
- Honest benchmark communication.
|
| 217 |
+
|
| 218 |
+
## Author
|
| 219 |
+
|
| 220 |
+
**Asmitha**
|
| 221 |
+
BSc Data Science, 2026
|
| 222 |
+
|
| 223 |
+
Portfolio theme: building AI systems that know when they should not guess.
|