Automated pipeline for identifying and analyzing customer conflicts in call center transcripts using OpenAI GPT API for CSR training and quality assurance.
This project analyzes real-world call center transcripts to identify customer conflicts, classify their types, and assess severity levels. The analysis uses a two-phase approach with GPT models to efficiently process large datasets at minimal cost.
- Automated sentiment classification using GPT-3.5-turbo
- Deep conflict analysis with GPT-4-turbo
- Cost-efficient two-phase pipeline ($1.87 for 1,500 transcripts)
- Structured output with full transcripts and metadata
- Reproducible results with configurable sampling
From 1,500 analyzed transcripts:
- Conflicts identified: 20 (1.3%)
- Top conflict types: Unmet expectations (85%), Miscommunication (50%), Service quality issues (40%)
- Severity distribution: 40% high (4), 55% medium (3), 5% low (2)
- Python 3.8+
- OpenAI API key
- Clone the repository: git clone https://github.com/maitribg/virtual-csr-eda.git cd virtual-csr-eda2. Install dependencies: pip install -r requirements.txt3. Configure API key:
echo "OPENAI_API_KEY=your-api-key-here" > .env## 📁 Dataset
Source: AIxBlock 92k Real-World Call Center Scripts
- Domain: Medicare/Healthcare inbound calls (dental, veterinary, allergy clinics)
- Total available: ~5,000 transcripts
- Features: Word-level timestamps, ASR confidence scores, PII-redacted
Place your data in data/medicare_inbound/medicare_inbound/ (directory excluded from git).
Analyzes all transcripts and identifies unsatisfied customers.
python phase1_sentiment_filter.pyOutputs:
phase1_sentiment_results.csv- All analyzed transcriptsphase1_unsatisfied_customers.csv- Filtered unsatisfied customers- Checkpoint files every 25 transcripts
Cost: ~$1.50 for 1,500 transcripts (GPT-3.5-turbo)
Interactive tool to browse unsatisfied customers.
python phase2_manual_review.py### Phase 3: Detailed Conflict Analysis
Deep analysis of conflicts with GPT-4.
python phase3_conflict_analysis.pyOutputs:
phase3_conflict_analysis.csv- Detailed conflict analysis with full transcripts
Cost: ~$0.30 for 20 transcripts (GPT-4-turbo)
transcript_id: Unique identifiersentiment: SATISFIED | NEUTRAL | UNSATISFIED | ANGRYfrustration_level: 1-5 scalereason: Brief explanationaudio_duration_seconds: Call lengthasr_confidence: Transcription qualityfull_text: Complete transcript
- All Phase 1 fields, plus:
has_conflict: Booleanconflict_types: Classified categoriesseverity: 1-5 scale (1=minor, 5=severe)trigger_moment: Quote showing conflict startcustomer_tone: calm | frustrated | angryresolution_attempted: Booleanresolution_successful: Boolean | nullkey_phrases: Notable customer quotessummary: One sentence description
Edit config.py to customize:
PHASE1_SAMPLE_SIZE = 1500 # Number of transcripts to analyze MAX_TRANSCRIPT_LENGTH = 4500 # Character limit for cost savings PHASE1_MODEL = "gpt-3.5-turbo" # Cheap model for filtering PHASE3_MODEL = "gpt-4-turbo-preview" # Better model for analysis## 📊 Methodology
Types:
- Pricing Dispute - Cost/billing disagreements
- Service Quality Issue - Poor service, wait times, transfers
- Miscommunication - Wrong information, confusion
- Unmet Expectations - Service didn't match promise
- Other - Any other frustration
Severity Scale:
- 1: Minor irritation
- 2: Mild frustration
- 3: Moderate conflict
- 4: Serious issue
- 5: Severe/emotional conflict
- Few-shot learning with 5 examples (3 positive, 2 negative)
- Structured JSON output for consistent parsing
- Low temperature (0.2-0.3) for reliability
- Input truncation (3,500-4,500 chars) for cost efficiency
| Phase | Model | Transcripts | Cost |
|---|---|---|---|
| Phase 1 | GPT-3.5-turbo | 1,500 | $1.57 |
| Phase 3 | GPT-4-turbo | 20 | $0.30 |
| Total | 1,520 | $1.87 |