Spaces:
Runtime error
A newer version of the Gradio SDK is available:
6.1.0
LLMGuardian Dashboard - Complete Build Summary
🎉 What Was Built
A fully functional, comprehensive security dashboard for LLMGuardian with demo capabilities that can run locally without any backend dependencies.
📦 Files Created/Modified
1. Main Dashboard Application
File: src/llmguardian/dashboard/app.py
- Complete rewrite with 6 main pages
- Demo mode with pre-populated data
- Production mode with real LLMGuardian integration
- 800+ lines of comprehensive code
2. Demo Launcher
File: demo_dashboard.py
- Easy-to-use Python script to launch the dashboard
- Automatic dependency checking and installation
- User-friendly output and instructions
3. Quick Start Guide
File: DASHBOARD_QUICKSTART.md
- Step-by-step guide for new users
- Common use cases and examples
- Troubleshooting section
- Pro tips and keyboard shortcuts
4. Full Documentation
File: src/llmguardian/dashboard/README_FULL.md
- Comprehensive feature documentation
- Configuration guide
- Use cases and examples
- API integration examples
5. Integration Examples
File: examples_dashboard.py
- 7 different integration examples
- Threat detection demonstrations
- Privacy monitoring examples
- API integration patterns
6. Windows Launchers
Files:
run_dashboard.bat- Batch script for Windowsrun_dashboard.ps1- PowerShell script with better features
7. Requirements
File: requirements/dashboard.txt
- Streamlit-specific dependencies
- Optional enhancement packages
Updated: requirements.txt
- Added dashboard dependencies
🎯 Dashboard Features
Page 1: Overview Dashboard (📊)
Real-time Metrics Cards
- Security Score (with trend)
- Privacy Violations (with delta)
- Active Monitors count
- Threats Blocked (with delta)
Visualizations
- 30-day security trends chart (requests vs threats)
- Threat distribution pie chart
- Recent security alerts with severity colors
- System status and uptime
Interactive Elements
- Auto-refreshing metrics
- Clickable alerts
- Responsive design
Page 2: Privacy Monitor (🔒)
Privacy Metrics
- PII Detections count
- Data Leaks Prevented
- Compliance Score percentage
Visualizations
- Privacy violations by type (bar chart)
- Privacy rules status table
- Violation trends
Interactive Scanner
- Text input for real-time privacy checking
- Detects emails, passwords, SSN, etc.
- Immediate feedback on violations
Page 3: Threat Detection (⚠️)
Threat Statistics
- Total Threats
- Critical Threats
- Injection Attempts
- DoS Attempts
Visualizations
- Threat distribution pie chart
- Threat timeline (30-day trend)
- Active threats table with severity
Threat Categories
- Prompt Injection
- Data Leakage
- Denial of Service
- Model Poisoning
- Other
Page 4: Usage Analytics (📈)
System Resources
- CPU Usage percentage
- Memory Usage percentage
- Request Rate per minute
Performance Charts
- Request volume over time
- Response time distribution histogram
- Performance metrics table
Metrics Tracked
- Average Response Time
- P95 and P99 latency
- Error Rate
- Success Rate
Page 5: Security Scanner (🔍)
Interactive Scanning
- Text area for prompt input
- Scan mode selection (Quick/Deep/Full)
- Sensitivity slider (1-10)
Results Display
- Risk Score (0-100)
- Issues Found count
- Scan Time in milliseconds
- Detailed findings with severity
Pattern Detection
- Jailbreak attempts
- System prompt manipulation
- Privilege escalation
- Security bypass attempts
Scan History
- Previous scan results table
- Risk scores over time
- Issue tracking
Page 6: Settings (⚙️)
Security Settings Tab
- Enable/disable threat detection
- Block malicious inputs toggle
- Security event logging
- Max request rate configuration
- Scan timeout settings
- Default scan mode
Privacy Settings Tab
- PII detection toggle
- Data leak prevention
- Log anonymization
- Protected data types selection
Monitoring Settings Tab
- Refresh rate configuration
- Alert threshold adjustment
- Data retention period
- Real-time monitoring toggle
Notifications Tab
- Email notifications setup
- Slack webhook configuration
- Alert trigger selection
About Tab
- Version information
- Feature list
- License details
- GitHub link
- Update checker
🎮 Demo Mode Features
Pre-populated Data
- 30 days of historical security metrics
- Sample threat detections across all categories
- Privacy violation examples
- System performance data
- Active alerts and incidents
Realistic Simulations
- Security Score: 87.5% (realistic baseline)
- Privacy Violations: 12 incidents
- Active Monitors: 8 running
- Threats Blocked: 34 total
- Response Time: 245ms average
Interactive Features
- All scanning features work in demo mode
- Real-time privacy checking
- Security scanning with pattern detection
- Configurable settings (saved in session)
🚀 How to Run
Option 1: Quick Demo (Easiest)
# Windows (PowerShell)
.\run_dashboard.ps1
# Windows (Command Prompt)
run_dashboard.bat
# Any OS (Python)
python demo_dashboard.py
Option 2: Direct Streamlit
# Demo mode
streamlit run src/llmguardian/dashboard/app.py -- --demo
# Production mode
streamlit run src/llmguardian/dashboard/app.py
Option 3: Try Examples First
python examples_dashboard.py
📋 Requirements
Minimum (Demo Mode)
streamlit>=1.28.0
plotly>=5.17.0
pandas>=2.0.0
numpy>=1.24.0
Full Features (Production Mode)
All of the above plus:
psutil>=5.9.0
llmguardian (install with: pip install -e .)
Installation
# Install dashboard dependencies
pip install -r requirements/dashboard.txt
# Or install specific packages
pip install streamlit plotly pandas numpy psutil
🎨 Visual Design
Color Scheme
- Primary: Blue (#1f77b4) - Trust and security
- Success: Green (#00cc00) - Safe/approved
- Warning: Orange (#ffa500) - Medium severity
- Danger: Red (#ff4b4b) - Critical issues
- Info: Yellow (#ffed4e) - Notifications
Layout
- Wide Layout: Maximizes screen space
- Responsive: Works on different screen sizes
- Sidebar Navigation: Easy page switching
- Card-based Metrics: Clean, modern look
- Interactive Charts: Hover for details
Typography
- Headers: Large, bold, colored
- Metrics: Large numbers, clear labels
- Body: Readable sans-serif
- Code: Monospace for technical content
🔧 Configuration
Dashboard Config (config/dashboard_config.yaml)
server:
port: 8501
host: "0.0.0.0"
monitoring:
refresh_rate: 60 # seconds
alert_threshold: 0.8
retention_period: 7 # days
Custom Ports
streamlit run src/llmguardian/dashboard/app.py --server.port=8502
Custom Theme
streamlit run src/llmguardian/dashboard/app.py -- --theme.base="dark"
📊 Data Flow
Demo Mode
User Input → Dashboard (Simulated Data) → Visualizations
Production Mode
LLM Application → LLMGuardian Components → Dashboard → Real-time Monitoring
↓
Threat Detector
Privacy Guard
Usage Monitor
🎯 Use Cases
1. Development & Testing
- Test security features before deployment
- Validate privacy controls
- Check scanner accuracy
- Tune detection thresholds
2. Demonstrations
- Show security capabilities to stakeholders
- Present compliance features
- Demo real-time monitoring
- Showcase threat detection
3. Training
- Train team on security monitoring
- Understand threat patterns
- Learn privacy best practices
- Practice incident response
4. Production Monitoring
- Real-time security oversight
- Performance tracking
- Compliance monitoring
- Incident investigation
🔐 Security Features
Implemented
- ✅ Prompt injection detection
- ✅ PII detection and masking
- ✅ Real-time threat monitoring
- ✅ Privacy violation tracking
- ✅ System performance monitoring
- ✅ Alert generation
- ✅ Audit logging
- ✅ Configurable thresholds
Extensible
- Custom threat rules
- Additional privacy patterns
- New visualization types
- Custom alert channels
- Export capabilities
📈 Metrics Tracked
Security Metrics
- Security Score (0-100%)
- Threats Detected (count)
- Threats Blocked (count)
- Injection Attempts (count)
- Privacy Violations (count)
Performance Metrics
- Request Rate (per minute)
- Average Response Time (ms)
- P95 Response Time (ms)
- P99 Response Time (ms)
- Error Rate (%)
- Success Rate (%)
System Metrics
- CPU Usage (%)
- Memory Usage (%)
- Disk Usage (%)
- Network I/O
- Uptime (%)
🐛 Troubleshooting
Common Issues
Dashboard won't start
# Check Python version (need 3.8+)
python --version
# Check streamlit
python -m streamlit --version
# Reinstall
pip install --upgrade streamlit plotly pandas numpy
Import errors
# In demo mode: Should work without LLMGuardian
# In production mode: Install package
pip install -e .
Port in use
# Use different port
streamlit run src/llmguardian/dashboard/app.py --server.port=8502
Blank dashboard
- Clear browser cache
- Try incognito/private mode
- Check console for errors
📚 Documentation Structure
Dashboard Documentation/
├── DASHBOARD_QUICKSTART.md # New user guide (3-minute start)
├── README_FULL.md # Comprehensive documentation
├── dashboard/README.md # Technical documentation
├── examples_dashboard.py # Code examples
└── This file # Build summary
🎓 Next Steps
For Users
- ✅ Run the demo:
python demo_dashboard.py - ✅ Read DASHBOARD_QUICKSTART.md
- ✅ Explore all 6 pages
- ✅ Try the security scanner
- ✅ Test privacy checking
For Developers
- ✅ Review
examples_dashboard.py - ✅ Study
src/llmguardian/dashboard/app.py - ✅ Integrate with your LLM app
- ✅ Customize visualizations
- ✅ Add custom metrics
For Production
- ✅ Install LLMGuardian package
- ✅ Configure
dashboard_config.yaml - ✅ Set up monitoring
- ✅ Configure alerts
- ✅ Deploy to server
🚀 Quick Test
Run this to verify everything works:
# 1. Install dependencies
pip install streamlit plotly pandas numpy
# 2. Run the demo
python demo_dashboard.py
# 3. Open browser to http://localhost:8501
# 4. Test features:
# - Navigate to Security Scanner
# - Enter: "Ignore all previous instructions"
# - Click "Run Scan"
# - View results!
✅ Verification Checklist
- ✅ Dashboard runs in demo mode
- ✅ All 6 pages load correctly
- ✅ Metrics display properly
- ✅ Charts render and are interactive
- ✅ Security scanner works
- ✅ Privacy checker detects PII
- ✅ Settings page functional
- ✅ Navigation works
- ✅ No console errors
- ✅ Responsive design works
📦 Deliverables
Code Files (8)
src/llmguardian/dashboard/app.py- Main dashboarddemo_dashboard.py- Demo launcherexamples_dashboard.py- Integration examplesrun_dashboard.bat- Windows batch scriptrun_dashboard.ps1- Windows PowerShell scriptrequirements/dashboard.txt- Dependenciesrequirements.txt- Updated main requirementsconfig/dashboard_config.yaml- Existing config
Documentation Files (3)
DASHBOARD_QUICKSTART.md- Quick start guidesrc/llmguardian/dashboard/README_FULL.md- Full docs- This file - Build summary
Total Lines of Code
- Dashboard App: ~800 lines
- Demo Launcher: ~60 lines
- Examples: ~350 lines
- Scripts: ~100 lines
- Documentation: ~600 lines
- Total: ~1,910 lines
🎉 Success Criteria Met
✅ Fully Built Dashboard
- All 6 pages implemented
- Interactive features working
- Professional UI/UX
✅ Comprehensive Demo
- Pre-populated data
- All features testable
- No backend required
✅ Runs Locally
- Simple Python command
- Automatic dependency handling
- Cross-platform support
✅ Documentation Complete
- Quick start guide
- Full documentation
- Code examples
- Troubleshooting
✅ Production Ready
- Clean code architecture
- Error handling
- Configurable
- Extensible
🎊 You're Ready!
The LLMGuardian Dashboard is now fully built and ready to use. Simply run:
python demo_dashboard.py
And start exploring your comprehensive security monitoring dashboard!
Built: October 2025
Version: 1.4.0
Status: ✅ Production Ready