A production-grade RAG-powered system for automated support quality verification and real-time alerts.
This system provides comprehensive support response quality analysis using:
- RAG Pipeline: Fact verification against knowledge base
- AI Agent: Automated email classification and analysis
- Real-time Alerts: Quality issue detection and notifications
- API-First Design: Complete REST API for frontend integration
- Claim Extraction: AI-powered identification of verifiable statements
- Evidence Retrieval: Multi-collection vector search with semantic reranking
- Fact Verification: Claims verified against authoritative sources
- Compliance Checking: Policy and guideline adherence validation
- Quality Scoring: Comprehensive accuracy and compliance metrics
- SLA Monitoring: Response time breach detection
- Quality Alerts: Factual errors and negative sentiment detection
- Aging Query Tracking: Unresponded query identification
- API-Only Mode: No email notifications, pure API integration
- Email Classification: Automated inbound/outbound processing
- Priority Detection: Urgency and importance assessment
- Category Assignment: Intelligent topic classification
- Quality Analysis: Automated response evaluation
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Email Input βββββΆβ AI Agent βββββΆβ RAG Pipeline β
β β β Orchestration β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Alert System ββββββ Database ββββββ Quality Scoring β
β β β Storage β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
- Python 3.9+
- MySQL 8.0+
- Qdrant Cloud account
- OpenAI API key
# Clone repository
git clone <repository-url>
cd support-quality-intelligence-backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Setup environment
cp .env.example .env
# Edit .env with your configuration
# Required environment variables
OPENAI_API_KEY=your_openai_api_key
QDRANT_API_KEY=your_qdrant_api_key
QDRANT_URL=your_qdrant_cloud_url
DATABASE_URL=mysql://user:password@localhost/dbname
# Initialize database
python scripts/create_database.py
# Embed training data
python scripts/embed_data.py
# Validate setup
python scripts/validate_setup.py
# Start server
python -m uvicorn app.main:app --host 0.0.0.0 --port 5001
# Verify health
curl http://localhost:5001/health
POST /api/v1/verify-support-response
- RAG verificationGET /health
- System health checkGET /
- API information
GET /alerts/dashboard
- Real-time dashboard dataGET /alerts/active
- Active alerts listGET /alerts/statistics
- Analytics and metricsPOST /alerts/{id}/acknowledge
- Acknowledge alertPOST /alerts/{id}/resolve
- Resolve alert
GET /alerts/scheduler/status
- Background job statusPOST /alerts/scheduler/trigger/{type}
- Manual checks
# Integration tests
cd tests/integration
python test_rag_pipeline_comprehensive.py
python test_actual_endpoints.py
# All tests
pytest tests/ -v
- Integration: End-to-end workflow testing
- Unit: Component-specific testing
- Performance: Load and benchmark testing
βββ app/ # Main application code
β βββ api/ # FastAPI routes and models
β βββ services/ # Business logic services
β βββ db/ # Database models and operations
β βββ core/ # Core functionality
βββ tests/ # All test files (organized by type)
βββ docs/ # Documentation and API guides
βββ scripts/ # Setup and utility scripts
βββ data/ # Training and reference data
βββ config/ # Configuration files
See PROJECT_STRUCTURE.md for detailed organization.
- API Documentation - Complete API reference
- Quick Reference - Developer quick guide
- Integration Guide - Frontend integration
- Project Structure - Codebase organization
- Business logic in
app/services/
- API routes in
app/api/
- Tests in
tests/
(never root!) - Documentation in
docs/
- Clean Architecture: Separation of concerns
- Type Hints: Full type annotation
- Documentation: Comprehensive docstrings
- Testing: Unit and integration coverage
- Security: Proper credential handling
# Build image
docker build -t support-quality-backend .
# Run with compose
docker-compose up -d
- Database: MySQL 8.0+ with proper indexing
- Vector Store: Qdrant Cloud with 3 collections
- API Keys: OpenAI GPT-4 access
- Monitoring: Health checks and logging
- API Response: <500ms for simple endpoints
- RAG Verification: 30-180 seconds (comprehensive analysis)
- Alert Processing: <100ms
- Database Operations: <200ms
- Parallel processing for RAG pipeline
- Caching for repeated queries
- Connection pooling for external APIs
- Follow project structure - No test files in root
- Add comprehensive tests - Unit and integration
- Update documentation - Keep docs current
- Security first - Never commit credentials
[Add your license information here]
Status: β Production Ready (with optimizations recommended) Last Updated: August 21, 2025 Version: 1.0.0