bkumarvaddineni/call-center-intelligence
Call Center Intelligence
Live Demo
https://bkumarvaddineni-call-center-intelligence.hf.space
Call Center Intelligence is a LangGraph-based operations console for analyzing support and emergency-style call audio. It validates and transcribes audio, blocks prompt-injection attempts, redacts PII, summarizes the call, scores agent quality, persists call history, writes audit records, and produces downloadable PDF and JSON reports through a Gradio UI.
Architecture Overview
The project is organized into six main layers:
src/ui: Gradio application for upload, analysis, report downloads, and observability.src/graph: LangGraphStateGraphorchestration and pipeline routing.src/services: audio validation/transcription/cleanup, security checks, and report generation.src/agents: LLM provider factory, structured summarization, and QA scoring.src/database: SQLAlchemy models, repository helpers, and session management.src/pipeline_models.py: shared typed models for pipeline state, audio metadata, transcript results, summary/QA outputs, report payloads, compliance flags, and structured errors.
The pipeline stages are:
intake: validate file existence, supported format, 50 MB size limit, and 60 minute duration limit.transcription: transcribe with Groq, fall back to Groq Turbo and local faster-whisper, assign speaker labels, cache transcripts by SHA-256 hash, and flag low-quality audio by confidence.injection_check: stop malicious prompt-injection transcripts before LLM calls and record matched injection pattern names.pii_redaction: redact SSN, credit card, email, and phone values before LLM calls.summarize_qa: generate a full structured summary and 1-5 QA scorecard with token usage.supervisor: route critical compliance severity calls for supervisor review.report: persist call/report data and generate PDF/JSON artifacts.error: persist failed or blocked calls with minimal records and audit details.
The graph stores terminal calls with one of four statuses: completed, flagged, blocked, or failed. Completed and flagged calls include reports; blocked and failed calls are still visible in observability because the error path persists a minimal call record.
UI Capabilities
Analyze Call: upload audio, optionally provide caller ID and department metadata, run the full pipeline, inspect speaker-bubble conversation view, transcript, summary, QA scorecard, token usage, processing status, and PDF/JSON report downloads.MP3 History: review previously analyzed MP3 calls from the database and reload their transcript, summary, QA scorecard, and stored report downloads without rerunning analysis.Observability: inspect call status counts, success rate, average QA score, compliance flags, storage diagnostics, LangSmith trace link, audit events, and CSV audit export.
Setup Instructions
Create and activate a Python 3.11 environment:
python3.11 -m venv venv
source venv/bin/activateInstall dependencies:
make installCreate a local .env file from the example:
cp .env.example .envFill in the provider keys you plan to use. At minimum, set the API key for LLM_PROVIDER.
Common environment variables:
LLM_PROVIDER:openai,gemini, orgroq.OPENAI_MODEL,GEMINI_MODEL,GROQ_LLM_MODEL: model IDs for summary and QA scoring.GROQ_API_KEY: required for hosted audio transcription.MIN_CONFIDENCE_THRESHOLD: transcript confidence threshold for low-quality audio warnings.GRADIO_SERVER_PORT: optional explicit Gradio port.LANGSMITH_API_KEY,LANGSMITH_PROJECT,LANGSMITH_PROJECT_URL: optional tracing setup.
How To Run Locally
Start the Gradio app:
make runOpen the local URL printed by Gradio, usually:
http://127.0.0.1:7860The root app.py initializes the SQLite database, preloads the local faster-whisper fallback model, and launches the UI.
How To Run Tests
Run CI-safe tests that do not require real external API calls:
make testRun only integration-marked tests that may require real API keys:
make test-integrationRun the full suite locally:
make test-allRun Ruff linting and formatting:
make lint
make formatQuality And Security Controls
- Audio intake accepts
.mp3,.wav,.m4a, and.flacand rejects files over 50 MB or 60 minutes. - WAV duration is read from the RIFF header before size-based rejection so long WAV files surface the rubric-required duration error.
- Transcript cache is reused only for transcription. Summary, QA scoring, compliance routing, and reports are regenerated on each analysis so scores use the latest prompts and logic.
- Prompt-injection detection blocks analysis before LLM calls and stores matched pattern names in state and UI/audit messages.
- PII redaction scans transcript text, transcript segments, caller ID, and department metadata before storage or LLM use.
- Low-quality audio is flagged when transcription confidence falls below
MIN_CONFIDENCE_THRESHOLD. - Supervisor routing is based on explicit
compliance_severity == "critical"rather than a proxy of boolean compliance flag plus low score.
GPU And Startup Notes
The local faster-whisper fallback is preloaded at app startup through preload_whisper_model(). It auto-detects CUDA; if CUDA is available, it uses GPU execution with float16, otherwise it falls back to CPU with int8.
For GPU deployment:
- Use a CUDA-enabled base image and install a CUDA-compatible PyTorch build.
- Mount or persist Hugging Face/model caches to avoid repeated model downloads.
- Ensure
ffmpegandlibsndfileare available in the runtime image. - Keep
BEAM_SIZE=1for lower latency unless accuracy requirements justify a larger beam.
The provided Dockerfile uses python:3.11-slim and is CPU-oriented.
Docker Persistence
Runtime state is stored under /app/data in the container, including SQLite observability data, reports, uploaded audio copies, and the transcription cache. Mount that directory as a volume when running Docker; otherwise, recreating the container starts with a fresh database and observability will show zero historical stats.
docker run --env-file .env -p 7860:7860 -v call-center-data:/app/data call-center-intelligenceIf port 7860 is already allocated, stop the existing container or map a different host port:
docker run --env-file .env -p 7861:7860 -v call-center-data:/app/data call-center-intelligenceSample Usage / Screenshots
Analyze a call:
- Open the
Analyze Calltab. - Upload an
.mp3,.wav,.m4a, or.flacfile. - Optionally enter caller ID and department metadata.
- Click
Analyze Call. - Watch the current pipeline step and progress percentage.
- Review the speaker transcript, summary, QA scorecard, token usage, and downloads.
History:
- Open the
MP3 Historytab. - Select a stored MP3 call.
- Review the persisted analysis and download stored reports.
Observability:
- Open the
Observabilitytab. - Review status counts, success rate, average QA score, compliance flags, storage diagnostics, and LangSmith status.
- Scroll the audit table to inspect pipeline events.
- Click
Export Audit Logto reveal a CSV download button.
Report Contents
Generated reports include:
- Call metadata, transcript, speaker segments, confidence, and low-quality audio indicator.
- Summary, sentiment, call purpose, agent behavior, key entities, key discussion points, action items, resolution status, and sentiment trajectory.
- QA scores on a 1-5 scale for empathy, resolution, compliance, communication, professionalism, and overall performance.
- Compliance severity, violation description, timestamp evidence, and supervisor-review flag.
- Token usage for summary and QA scoring when provider usage metadata is available.
Implementation Notes
- PII redaction uses Presidio plus deterministic regex fallbacks.
- Speaker assignment uses transcript timing plus call-center and emergency-call cue scoring. It is still heuristic diarization, not voice-embedding diarization.
- The database includes a separate
reportstable in addition tocall_records,audit_log, andtranscription_cache. Keeping reports separate preserves a cleaner call/report boundary. Full generated report JSON is also stored inreports.report_jsonfor history reloads. - SQLAlchemy uses a module-level
sessionmakerand asession_scopecontext manager for commit/rollback handling. - Existing SQLite databases are migrated at startup with additive column checks for status, metadata, report JSON, and compliance fields.
- User-specific persistence is not implemented yet. A shared deployment with one mounted
/app/datavolume shows shared history and observability to all visitors unless an authentication/user partition layer is added.
