AI-powered call center compliance monitoring with multi-stage NLP analysis, SOP validation, English translation layer, and semantic search.
ComplianceAI analyzes call center recordings to automatically validate Standard Operating Procedure (SOP) compliance, extract payment analytics, detect customer sentiment, and provide explainable AI (XAI) justifications β all from a single API call.
Supports Tanglish (Tamil + English) and Hinglish (Hindi + English) conversations using AssemblyAI for transcription and Google Gemini for NLP analysis and internal English translation.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React) β
β Corporate Dashboard β’ Port 3000 β
βββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β REST API (x-api-key header)
βββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β Space A β The Brain (Port 8000) β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββ β
β β Analysis Pipeline β β
β β β β
β β AssemblyAI β Clean β Translate (EN) β β
β β β β β β β
β β Transcribe Original Gemini LLM β β
β β (external) (returned) (analysis) β β
β β β β β
β β FAISS Vector DB (English embed) β β
β βββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β API Gateway β’ Pydantic Strict β’ JSON Healing β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββ΄ββββββββββββ
βΌ βΌ
AssemblyAI API Google Gemini API
(Speech-to-Text) (Translation + Analysis)
1. Validate x-api-key
2. Validate request body (Pydantic)
3. Base64 decode + upload to AssemblyAI β get transcript
4. Clean transcript (remove fillers, repeated words)
5. Translate to English via Gemini [INTERNAL β not returned]
6. Analyze English transcript with Gemini β JSON
7. If JSON invalid β 3-pass agentic healing loop
8. Validate with Pydantic schemas
9. Store in FAISS (embed from English, store original + English)
10. Return response with original cleaned transcript
| Feature | Description |
|---|---|
| AssemblyAI Transcription | Cloud speech-to-text with speaker labels, auto language detection |
| English Translation Layer | Gemini translates Tanglish/Hinglish internally for accurate LLM analysis |
| SOP Validation | 5-step compliance check with boolean results and 0β1 score |
| Explainable AI (XAI) | Gemini quotes the transcript to justify every SOP decision |
| Analytics Extraction | Payment preference, rejection reason, sentiment β strict enums |
| Keyword Extraction | 5β10 grounded keywords extracted from transcript |
| Agentic JSON Healing | 3-pass self-healing loop when Gemini returns malformed JSON |
| FAISS Vector Search | Semantic search over all analyzed calls; query also translated before embedding |
| Request Logging | Every request persisted to logs/requests/<uuid>.json |
| API Authentication | x-api-key header enforcement on all endpoints |
| Health Monitoring | /health endpoint with per-service status |
Headers: x-api-key: <your-key> Β· Content-Type: application/json
Request:
{
"language": "Tamil",
"audioFormat": "mp3",
"audioBase64": "<base64-encoded-mp3>"
}Response:
{
"status": "success",
"language": "Tamil",
"transcript": "Vanakkam sir, ungal account pathi pesalam...",
"summary": "Agent greeted the customer and verified account details. Customer expressed difficulty paying full amount. Agent offered EMI plan which customer agreed to.",
"sop_validation": {
"greeting": true,
"identification": true,
"problemStatement": true,
"solutionOffering": true,
"closing": false,
"complianceScore": 0.8,
"adherenceStatus": "FOLLOWED",
"explanation": "Agent opened with 'Vanakkam sir' confirming greeting. Identity verified via account number. Customer stated 'full payment difficult' β problem captured. EMI was proposed as solution. Call ended abruptly without formal closing."
},
"analytics": {
"paymentPreference": "EMI",
"rejectionReason": "NONE",
"sentiment": "Positive"
},
"keywords": ["EMI", "payment", "account", "loan", "interest"]
}Note: English translation is used internally for analysis accuracy. Only the original cleaned transcript is returned.
Search across all analyzed call transcripts using semantic similarity. The query is automatically translated to English before embedding for consistent vector space alignment.
Request:
{ "query": "customer refused EMI due to high interest", "top_k": 5 }Response:
{
"status": "success",
"results": [
{
"transcript": "<original cleaned transcript>",
"score": 0.87,
"metadata": { "language": "Tamil" }
}
]
}Returns per-service status. No auth required.
{
"status": "ok",
"services": {
"api": "ok",
"gemini": "configured",
"faiss": { "status": "ok", "stored_transcripts": 12 }
}
}| Field | Allowed Values |
|---|---|
language |
Tamil Β· Hindi |
audioFormat |
mp3 |
adherenceStatus |
FOLLOWED Β· NOT_FOLLOWED |
paymentPreference |
EMI Β· FULL_PAYMENT Β· PARTIAL_PAYMENT Β· DOWN_PAYMENT |
rejectionReason |
HIGH_INTEREST Β· BUDGET_CONSTRAINTS Β· ALREADY_PAID Β· NOT_INTERESTED Β· NONE |
sentiment |
Positive Β· Neutral Β· Negative |
HCL-Guvi/
βββ backend/
β βββ space_a/ # Single backend service (Port 8000)
β βββ main.py # FastAPI app + CORS + routing
β βββ logging_config.py # Structured logging setup
β βββ requirements.txt
β βββ .env
β βββ routers/
β β βββ analyze.py # POST /analyze (full pipeline)
β β βββ search.py # POST /search (semantic search)
β β βββ health.py # GET /health
β βββ services/
β β βββ audio_service.py # AssemblyAI transcription client
β β βββ gemini_service.py # Clean + Translate + Analyze + JSON Heal
β β βββ faiss_service.py # MiniLM embeddings + FAISS IndexFlatIP
β βββ models/
β β βββ schemas.py # Strict Pydantic v2 request/response models
β βββ utils/
β βββ logging_utils.py # Per-request JSON log files
βββ frontend/ # React Dashboard (Port 3000)
βββ src/
β βββ App.js / App.css # Charcoal/Red/Yellow design system
β βββ components/
β β βββ AnalyzeForm.js # Drag-and-drop MP3 upload
β β βββ ResultDisplay.js # SOP ring, analytics badges, raw JSON view
β β βββ SearchPanel.js # Semantic search UI
β β βββ HealthStatus.js # Live service status bar
β βββ services/
β βββ api.js # Axios client
βββ public/index.html
- Python 3.10+
- Node.js 18+
- AssemblyAI API key β assemblyai.com
- Google Gemini API key β aistudio.google.com
cd backend/space_a
cp .env .env.localEdit backend/space_a/.env:
GEMINI_API_KEY=your_gemini_api_key
ASSEMBLYAI_API_KEY=your_assemblyai_api_key
API_KEY=hcl-compliance-secret-key
FAISS_INDEX_PATH=faiss_store/index.bin
FAISS_META_PATH=faiss_store/metadata.jsonEdit frontend/.env:
REACT_APP_API_URL=http://localhost:8000
REACT_APP_API_KEY=hcl-compliance-secret-keycd backend/space_a
pip install -r requirements.txt
uvicorn main:app --reload --port 8000API docs available at http://localhost:8000/docs
cd frontend
npm install
npm run dev# Encode your MP3
B64=$(base64 -w 0 your_call.mp3)
# Analyze
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-H "x-api-key: hcl-compliance-secret-key" \
-d "{\"language\":\"Tamil\",\"audioFormat\":\"mp3\",\"audioBase64\":\"$B64\"}"
# Search
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-H "x-api-key: hcl-compliance-secret-key" \
-d "{\"query\":\"customer refused payment\",\"top_k\":3}"
# Health
curl http://localhost:8000/health| Layer | Technology |
|---|---|
| Frontend | React 18 Β· Vanilla CSS Β· Inter font |
| API Gateway | FastAPI Β· Uvicorn Β· Pydantic v2 |
| Speech-to-Text | AssemblyAI (cloud, speaker labels, auto language detection) |
| Translation | Google Gemini 2.0 Flash Lite (Tanglish/Hinglish β English) |
| NLP Analysis | Google Gemini 2.0 Flash Lite (SOP Β· analytics Β· keywords) |
| Vector Embeddings | sentence-transformers/all-MiniLM-L6-v2 (384-dim, normalized) |
| Vector DB | FAISS IndexFlatIP (inner product = cosine similarity) |
| HTTP Client | httpx (async) Β· requests (AssemblyAI polling) |
| Criterion | Implementation |
|---|---|
| API returns 200 OK | FastAPI with strict Pydantic response models |
| Transcript accuracy | AssemblyAI universal model + speaker labels + punctuation |
| SOP correctness | Gemini analyzes English translation for accuracy on mixed-language calls |
| Analytics correctness | Strict enum enforcement + post-processing normalization |
| Keywords extraction | 5β10 grounded keywords, validated and padded if needed |
| JSON format | Pydantic enforced β any schema violation raises 422 |
| Robustness | 3-pass agentic JSON healing + translation fallback to cleaned transcript |
Built for HCL-GUVI Hackathon 2026
AI-powered call center compliance analysis with SOP validation, sentiment analysis, and keyword extraction.
| Method | Path | Description |
|---|---|---|
POST |
/analyze |
Full call analysis pipeline |
GET |
/search?q=... |
Semantic FAISS search |
GET |
/health |
Uptime check |
GET |
/docs |
Swagger UI |
| Variable | Description |
|---|---|
API_KEY |
Your API auth key sent as x-api-key header |
GEMINI_API_KEY |
Google Gemini API key |
ASSEMBLYAI_API_KEY |
AssemblyAI transcription key |
curl -X POST https://<your-space>.hf.space/analyze \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"language": "Tamil",
"audioFormat": "mp3",
"audioBase64": "<base64-encoded-mp3>"
}'