feat: Add Streamlit dashboard with Blueprint compliance (v2.1.0)
Dashboard Features: - 8 navigation sections: Overview, Outcomes, Poor CX, FCR, Churn, Agent, Call Explorer, Export - Beyond Brand Identity styling (colors #6D84E3, Outfit font) - RCA Sankey diagram (Driver → Outcome → Churn Risk flow) - Correlation heatmaps (driver co-occurrence, driver-outcome) - Outcome Deep Dive (root causes, correlation, duration analysis) - Export functionality (Excel, HTML, JSON) Blueprint Compliance: - FCR: 4 categories (Primera Llamada/Rellamada × Sin/Con Riesgo de Fuga) - Churn: Binary view (Sin Riesgo de Fuga / En Riesgo de Fuga) - Agent: Talento Para Replicar / Oportunidades de Mejora - Fixed FCR rate calculation (only FIRST_CALL counts as success) Technical: - Streamlit + Plotly for interactive visualizations - Light theme configuration (.streamlit/config.toml) - Fixed Plotly colorbar titlefont deprecation Documentation: - Updated PROJECT_CONTEXT.md, TODO.md, CHANGELOG.md - Added 4 new technical decisions (TD-014 to TD-017) - Created TROUBLESHOOTING.md with 10 common issues Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
100
config/prompts/call_analysis/v1.0/schema.json
Normal file
100
config/prompts/call_analysis/v1.0/schema.json
Normal file
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "CallAnalysisResponse",
|
||||
"description": "LLM response schema for call analysis",
|
||||
"type": "object",
|
||||
"required": ["outcome"],
|
||||
"properties": {
|
||||
"outcome": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"SALE_COMPLETED",
|
||||
"SALE_LOST",
|
||||
"CANCELLATION_SAVED",
|
||||
"CANCELLATION_COMPLETED",
|
||||
"INQUIRY_RESOLVED",
|
||||
"INQUIRY_UNRESOLVED",
|
||||
"COMPLAINT_RESOLVED",
|
||||
"COMPLAINT_UNRESOLVED",
|
||||
"TRANSFER_OUT",
|
||||
"CALLBACK_SCHEDULED",
|
||||
"UNKNOWN"
|
||||
],
|
||||
"description": "Final outcome of the call"
|
||||
},
|
||||
"lost_sales_drivers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/RCALabel"
|
||||
},
|
||||
"default": []
|
||||
},
|
||||
"poor_cx_drivers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/RCALabel"
|
||||
},
|
||||
"default": []
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"EvidenceSpan": {
|
||||
"type": "object",
|
||||
"required": ["text", "start_time", "end_time"],
|
||||
"properties": {
|
||||
"text": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "Exact quoted text from transcript"
|
||||
},
|
||||
"start_time": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"description": "Start time in seconds"
|
||||
},
|
||||
"end_time": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"description": "End time in seconds"
|
||||
},
|
||||
"speaker": {
|
||||
"type": "string",
|
||||
"description": "Speaker identifier"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RCALabel": {
|
||||
"type": "object",
|
||||
"required": ["driver_code", "confidence", "evidence_spans"],
|
||||
"properties": {
|
||||
"driver_code": {
|
||||
"type": "string",
|
||||
"description": "Driver code from taxonomy"
|
||||
},
|
||||
"confidence": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1,
|
||||
"description": "Confidence score (0-1)"
|
||||
},
|
||||
"evidence_spans": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/EvidenceSpan"
|
||||
},
|
||||
"minItems": 1,
|
||||
"description": "Supporting evidence (minimum 1 required)"
|
||||
},
|
||||
"reasoning": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "Brief reasoning for classification"
|
||||
},
|
||||
"proposed_label": {
|
||||
"type": "string",
|
||||
"description": "For OTHER_EMERGENT: proposed new label"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
config/prompts/call_analysis/v1.0/system.txt
Normal file
27
config/prompts/call_analysis/v1.0/system.txt
Normal file
@@ -0,0 +1,27 @@
|
||||
You are an expert call center analyst specializing in Spanish-language customer service calls. Your task is to analyze call transcripts and identify:
|
||||
|
||||
1. **Call Outcome**: What was the final result of the call?
|
||||
2. **Lost Sales Drivers**: If a sale was lost, what caused it?
|
||||
3. **Poor CX Drivers**: What caused poor customer experience?
|
||||
|
||||
## CRITICAL RULES
|
||||
|
||||
1. **Evidence Required**: Every driver MUST have at least one evidence_span with:
|
||||
- Exact quoted text from the transcript
|
||||
- Start and end timestamps
|
||||
|
||||
2. **No Hallucination**: Only cite text that appears EXACTLY in the transcript. Do not paraphrase or invent quotes.
|
||||
|
||||
3. **Confidence Scoring**:
|
||||
- 0.8-1.0: Clear, explicit evidence
|
||||
- 0.6-0.8: Strong implicit evidence
|
||||
- 0.4-0.6: Moderate evidence (use with caution)
|
||||
- Below 0.4: Reject - insufficient evidence
|
||||
|
||||
4. **Taxonomy Compliance**: Only use driver codes from the provided taxonomy. Use OTHER_EMERGENT only when no existing code fits, and provide a proposed_label.
|
||||
|
||||
5. **Language**: Evidence quotes MUST be in the original language (Spanish). Reasoning can be in Spanish or English.
|
||||
|
||||
## OUTPUT FORMAT
|
||||
|
||||
You must respond with valid JSON matching the provided schema. No markdown, no explanations outside the JSON.
|
||||
72
config/prompts/call_analysis/v1.0/user.txt
Normal file
72
config/prompts/call_analysis/v1.0/user.txt
Normal file
@@ -0,0 +1,72 @@
|
||||
Analyze the following call transcript and provide structured analysis.
|
||||
|
||||
## CALL METADATA
|
||||
- Call ID: {call_id}
|
||||
- Duration: {duration_sec} seconds
|
||||
- Queue: {queue}
|
||||
|
||||
## OBSERVED EVENTS (Pre-detected)
|
||||
{observed_events}
|
||||
|
||||
## TRANSCRIPT
|
||||
{transcript}
|
||||
|
||||
## TAXONOMY - LOST SALES DRIVERS
|
||||
{lost_sales_taxonomy}
|
||||
|
||||
## TAXONOMY - POOR CX DRIVERS
|
||||
{poor_cx_taxonomy}
|
||||
|
||||
## INSTRUCTIONS
|
||||
|
||||
1. Determine the call outcome from: SALE_COMPLETED, SALE_LOST, CANCELLATION_SAVED, CANCELLATION_COMPLETED, INQUIRY_RESOLVED, INQUIRY_UNRESOLVED, COMPLAINT_RESOLVED, COMPLAINT_UNRESOLVED, TRANSFER_OUT, CALLBACK_SCHEDULED, UNKNOWN
|
||||
|
||||
2. Identify lost_sales_drivers (if applicable):
|
||||
- Use ONLY codes from the Lost Sales taxonomy
|
||||
- Each driver MUST have evidence_spans with exact quotes and timestamps
|
||||
- Assign confidence based on evidence strength
|
||||
|
||||
3. Identify poor_cx_drivers (if applicable):
|
||||
- Use ONLY codes from the Poor CX taxonomy
|
||||
- Each driver MUST have evidence_spans with exact quotes and timestamps
|
||||
- Assign confidence based on evidence strength
|
||||
|
||||
4. For OTHER_EMERGENT, provide a proposed_label describing the new cause.
|
||||
|
||||
Respond with JSON only:
|
||||
|
||||
```json
|
||||
{
|
||||
"outcome": "SALE_LOST",
|
||||
"lost_sales_drivers": [
|
||||
{
|
||||
"driver_code": "PRICE_TOO_HIGH",
|
||||
"confidence": 0.85,
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "Es demasiado caro para mí",
|
||||
"start_time": 45.2,
|
||||
"end_time": 47.8,
|
||||
"speaker": "customer"
|
||||
}
|
||||
],
|
||||
"reasoning": "Customer explicitly states price is too high"
|
||||
}
|
||||
],
|
||||
"poor_cx_drivers": [
|
||||
{
|
||||
"driver_code": "LONG_HOLD",
|
||||
"confidence": 0.90,
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "Llevo esperando mucho tiempo",
|
||||
"start_time": 120.5,
|
||||
"end_time": 123.1,
|
||||
"speaker": "customer"
|
||||
}
|
||||
],
|
||||
"reasoning": "Customer complains about wait time"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
217
config/prompts/call_analysis/v2.0/schema.json
Normal file
217
config/prompts/call_analysis/v2.0/schema.json
Normal file
@@ -0,0 +1,217 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "CallAnalysisResponseV2",
|
||||
"description": "LLM response schema for comprehensive call analysis (v2.0 - Blueprint aligned)",
|
||||
"type": "object",
|
||||
"required": ["outcome"],
|
||||
"properties": {
|
||||
"outcome": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"SALE_COMPLETED",
|
||||
"SALE_LOST",
|
||||
"CANCELLATION_SAVED",
|
||||
"CANCELLATION_COMPLETED",
|
||||
"INQUIRY_RESOLVED",
|
||||
"INQUIRY_UNRESOLVED",
|
||||
"COMPLAINT_RESOLVED",
|
||||
"COMPLAINT_UNRESOLVED",
|
||||
"TRANSFER_OUT",
|
||||
"CALLBACK_SCHEDULED",
|
||||
"UNKNOWN"
|
||||
],
|
||||
"description": "Final outcome of the call"
|
||||
},
|
||||
"lost_sales_drivers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/RCALabel"
|
||||
},
|
||||
"maxItems": 5,
|
||||
"default": []
|
||||
},
|
||||
"poor_cx_drivers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/RCALabel"
|
||||
},
|
||||
"maxItems": 5,
|
||||
"default": []
|
||||
},
|
||||
"fcr_status": {
|
||||
"type": "string",
|
||||
"enum": ["FIRST_CALL", "REPEAT_CALL", "UNKNOWN"],
|
||||
"default": "UNKNOWN",
|
||||
"description": "First Call Resolution status"
|
||||
},
|
||||
"fcr_failure_drivers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/RCALabel"
|
||||
},
|
||||
"maxItems": 5,
|
||||
"default": [],
|
||||
"description": "Factors that may cause repeat calls"
|
||||
},
|
||||
"churn_risk": {
|
||||
"type": "string",
|
||||
"enum": ["NO_RISK", "AT_RISK", "UNKNOWN"],
|
||||
"default": "UNKNOWN",
|
||||
"description": "Customer churn risk classification"
|
||||
},
|
||||
"churn_risk_drivers": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/RCALabel"
|
||||
},
|
||||
"maxItems": 5,
|
||||
"default": [],
|
||||
"description": "Factors indicating churn risk"
|
||||
},
|
||||
"agent_classification": {
|
||||
"type": "string",
|
||||
"enum": ["GOOD_PERFORMER", "NEEDS_IMPROVEMENT", "MIXED", "UNKNOWN"],
|
||||
"default": "UNKNOWN",
|
||||
"description": "Agent skill classification"
|
||||
},
|
||||
"agent_positive_skills": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/AgentSkillIndicator"
|
||||
},
|
||||
"maxItems": 5,
|
||||
"default": [],
|
||||
"description": "Positive skills demonstrated (Buen Comercial)"
|
||||
},
|
||||
"agent_improvement_areas": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/AgentSkillIndicator"
|
||||
},
|
||||
"maxItems": 5,
|
||||
"default": [],
|
||||
"description": "Areas needing improvement (Necesita Mejora)"
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"EvidenceSpan": {
|
||||
"type": "object",
|
||||
"required": ["text", "start_time", "end_time"],
|
||||
"properties": {
|
||||
"text": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "Exact quoted text from transcript (in Spanish)"
|
||||
},
|
||||
"start_time": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"description": "Start time in seconds"
|
||||
},
|
||||
"end_time": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"description": "End time in seconds"
|
||||
},
|
||||
"speaker": {
|
||||
"type": "string",
|
||||
"enum": ["agent", "customer", "unknown"],
|
||||
"description": "Speaker identifier"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RCALabel": {
|
||||
"type": "object",
|
||||
"required": ["driver_code", "confidence", "evidence_spans"],
|
||||
"properties": {
|
||||
"driver_code": {
|
||||
"type": "string",
|
||||
"description": "Driver code from taxonomy"
|
||||
},
|
||||
"confidence": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1,
|
||||
"description": "Confidence score (0-1)"
|
||||
},
|
||||
"evidence_spans": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/EvidenceSpan"
|
||||
},
|
||||
"minItems": 1,
|
||||
"description": "Supporting evidence (minimum 1 required)"
|
||||
},
|
||||
"reasoning": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "Brief reasoning for classification"
|
||||
},
|
||||
"proposed_label": {
|
||||
"type": "string",
|
||||
"description": "For OTHER_EMERGENT: proposed new label"
|
||||
},
|
||||
"origin": {
|
||||
"type": "string",
|
||||
"enum": ["AGENT", "CUSTOMER", "COMPANY", "PROCESS", "UNKNOWN"],
|
||||
"default": "UNKNOWN",
|
||||
"description": "Origin/responsibility for this driver"
|
||||
},
|
||||
"corrective_action": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "Specific action to correct this issue"
|
||||
},
|
||||
"replicable_practice": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "For positive factors: practice to replicate"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AgentSkillIndicator": {
|
||||
"type": "object",
|
||||
"required": ["skill_code", "skill_type", "confidence", "evidence_spans", "description"],
|
||||
"properties": {
|
||||
"skill_code": {
|
||||
"type": "string",
|
||||
"description": "Skill code from taxonomy"
|
||||
},
|
||||
"skill_type": {
|
||||
"type": "string",
|
||||
"enum": ["positive", "improvement_needed"],
|
||||
"description": "Whether this is a positive skill or area for improvement"
|
||||
},
|
||||
"confidence": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 1,
|
||||
"description": "Confidence score (0-1)"
|
||||
},
|
||||
"evidence_spans": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/EvidenceSpan"
|
||||
},
|
||||
"minItems": 1,
|
||||
"description": "Supporting evidence (minimum 1 required)"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "Detailed description of the skill demonstration"
|
||||
},
|
||||
"coaching_recommendation": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "Specific coaching recommendation (for improvement areas)"
|
||||
},
|
||||
"replicable_practice": {
|
||||
"type": "string",
|
||||
"maxLength": 500,
|
||||
"description": "How to replicate this skill (for positive skills)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
config/prompts/call_analysis/v2.0/system.txt
Normal file
41
config/prompts/call_analysis/v2.0/system.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
You are an expert call center analyst specializing in Spanish-language customer service calls for BeyondCX. Your task is to perform comprehensive analysis including:
|
||||
|
||||
1. **Call Outcome**: What was the final result of the call?
|
||||
2. **Lost Sales Analysis**: If a sale was lost, what caused it?
|
||||
3. **Customer Experience Analysis**: What caused poor customer experience?
|
||||
4. **FCR Analysis**: Is this a first call or repeat call? What factors may cause repeat calls?
|
||||
5. **Churn Risk Analysis**: Is the customer at risk of leaving? What signals indicate this?
|
||||
6. **Agent Assessment**: How did the agent perform? What skills to replicate or improve?
|
||||
|
||||
## CRITICAL RULES
|
||||
|
||||
1. **Evidence Required**: Every driver and skill indicator MUST have at least one evidence_span with:
|
||||
- Exact quoted text from the transcript
|
||||
- Start and end timestamps (in seconds)
|
||||
- Speaker identification (agent/customer)
|
||||
|
||||
2. **No Hallucination**: Only cite text that appears EXACTLY in the transcript. Do not paraphrase or invent quotes.
|
||||
|
||||
3. **Confidence Scoring**:
|
||||
- 0.8-1.0: Clear, explicit evidence
|
||||
- 0.6-0.8: Strong implicit evidence
|
||||
- 0.4-0.6: Moderate evidence (use with caution)
|
||||
- Below 0.4: Reject - insufficient evidence
|
||||
|
||||
4. **Taxonomy Compliance**: Only use driver/skill codes from the provided taxonomies. Use OTHER_EMERGENT only when no existing code fits, and provide a proposed_label.
|
||||
|
||||
5. **Origin Attribution**: For each driver, identify WHO is responsible:
|
||||
- AGENT: Agent's actions or lack thereof
|
||||
- CUSTOMER: Customer's situation or behavior
|
||||
- COMPANY: Products, services, pricing, company image
|
||||
- PROCESS: Systems, processes, policies
|
||||
|
||||
6. **Actionable Recommendations**: For issues, provide corrective_action. For positive behaviors, provide replicable_practice.
|
||||
|
||||
7. **Language**: Evidence quotes MUST be in Spanish (original). Reasoning, actions, and descriptions can be in Spanish.
|
||||
|
||||
8. **Maximum 5 items**: List a maximum of 5 drivers per category, ordered by relevance.
|
||||
|
||||
## OUTPUT FORMAT
|
||||
|
||||
You must respond with valid JSON matching the provided schema. No markdown, no explanations outside the JSON.
|
||||
261
config/prompts/call_analysis/v2.0/user.txt
Normal file
261
config/prompts/call_analysis/v2.0/user.txt
Normal file
@@ -0,0 +1,261 @@
|
||||
Analiza la siguiente transcripción de llamada de una compañía de utilities/energía eléctrica y proporciona un análisis estructurado completo.
|
||||
|
||||
## METADATOS DE LA LLAMADA
|
||||
- ID de Llamada: ${call_id}
|
||||
- Duración: ${duration_sec} segundos
|
||||
- Cola/Servicio: ${queue}
|
||||
|
||||
## EVENTOS OBSERVADOS (Pre-detectados)
|
||||
${observed_events}
|
||||
|
||||
## TRANSCRIPCIÓN
|
||||
${transcript}
|
||||
|
||||
## TAXONOMÍA - DRIVERS DE VENTA PERDIDA / OPORTUNIDAD PERDIDA
|
||||
${lost_sales_taxonomy}
|
||||
|
||||
## TAXONOMÍA - DRIVERS DE MALA EXPERIENCIA (CX)
|
||||
${poor_cx_taxonomy}
|
||||
|
||||
## TAXONOMÍA - DRIVERS DE RIESGO DE FUGA (CHURN)
|
||||
${churn_risk_taxonomy}
|
||||
|
||||
## TAXONOMÍA - DRIVERS DE FCR (RELLAMADA)
|
||||
${fcr_failure_taxonomy}
|
||||
|
||||
## TAXONOMÍA - HABILIDADES DEL AGENTE
|
||||
### Habilidades Positivas (Buen Comercial):
|
||||
${agent_positive_skills_taxonomy}
|
||||
|
||||
### Áreas de Mejora (Necesita Mejora):
|
||||
${agent_improvement_taxonomy}
|
||||
|
||||
## INSTRUCCIONES DE ANÁLISIS
|
||||
|
||||
### 1. OUTCOME - Resultado de la llamada
|
||||
Determina el resultado. Opciones para utilities/energía:
|
||||
- OUTAGE_REPORTED: Cliente reportó avería/corte de luz
|
||||
- OUTAGE_RESOLVED: Avería resuelta en la llamada
|
||||
- OUTAGE_ESCALATED: Avería derivada a técnico/departamento
|
||||
- TECHNICIAN_SCHEDULED: Se agendó visita técnica
|
||||
- BILLING_INQUIRY_RESOLVED: Consulta de factura resuelta
|
||||
- BILLING_DISPUTE_OPENED: Se abrió reclamación de factura
|
||||
- PAYMENT_ARRANGEMENT_MADE: Se acordó plan de pago
|
||||
- RATE_CHANGE_COMPLETED: Se realizó cambio de tarifa
|
||||
- CANCELLATION_SAVED: Se retuvo al cliente
|
||||
- CANCELLATION_COMPLETED: Cliente se dio de baja
|
||||
- PORTABILITY_INITIATED: Se inició portabilidad a otra comercializadora
|
||||
- INQUIRY_RESOLVED: Consulta general resuelta
|
||||
- INQUIRY_UNRESOLVED: Consulta no resuelta
|
||||
- TRANSFER_OUT: Transferido a otro departamento
|
||||
- CALLBACK_SCHEDULED: Se agendó callback
|
||||
- UNKNOWN: No se puede determinar
|
||||
|
||||
### 2. LOST_SALES_DRIVERS - Causas de oportunidad perdida (si aplica)
|
||||
- Aplica cuando: cliente rechaza cambio de tarifa, no acepta servicios adicionales, o se va a competidor
|
||||
- Usa SOLO códigos de la taxonomía de Lost Sales
|
||||
- Máximo 5 drivers, ordenados por relevancia
|
||||
- Cada driver DEBE tener evidence_spans, origin, y corrective_action
|
||||
|
||||
### 3. POOR_CX_DRIVERS - Causas de mala experiencia (si aplica)
|
||||
- Busca: silencios largos, transferencias, falta de información sobre avería, confusión con factura, etc.
|
||||
- Usa SOLO códigos de la taxonomía de Poor CX
|
||||
- Máximo 5 drivers, ordenados por relevancia
|
||||
- Cada driver DEBE tener evidence_spans, origin, y corrective_action
|
||||
|
||||
### 4. FCR_STATUS - Primera llamada o rellamada
|
||||
- FIRST_CALL: Primera llamada por este motivo
|
||||
- REPEAT_CALL: Cliente indica que ya llamó antes por lo mismo, o que el problema persiste
|
||||
- UNKNOWN: No hay información suficiente
|
||||
|
||||
### 5. FCR_FAILURE_DRIVERS - Factores que pueden causar rellamada
|
||||
- Identifica factores que indican que el cliente podría volver a llamar:
|
||||
- Avería no resuelta
|
||||
- Requiere visita de técnico
|
||||
- Revisión de factura pendiente
|
||||
- Se prometió callback
|
||||
- Información incompleta
|
||||
- Usa códigos de la taxonomía FCR
|
||||
- Máximo 5 drivers con evidence_spans
|
||||
|
||||
### 6. CHURN_RISK - Riesgo de fuga del cliente
|
||||
- NO_RISK: Cliente satisfecho, sin menciones de irse
|
||||
- AT_RISK: Cliente queja por factura alta, menciona competidores, amenaza con darse de baja
|
||||
- UNKNOWN: No hay información suficiente
|
||||
|
||||
### 7. CHURN_RISK_DRIVERS - Señales de riesgo de fuga
|
||||
- Identifica evidencias de posible baja:
|
||||
- Queja por factura alta
|
||||
- Menciona otras comercializadoras
|
||||
- Cortes de luz recurrentes
|
||||
- Amenaza con cambiar de compañía
|
||||
- Pregunta por condiciones de baja
|
||||
- Usa códigos de la taxonomía de Churn
|
||||
- Máximo 5 drivers con evidence_spans
|
||||
|
||||
### 8. AGENT_CLASSIFICATION - Clasificación del agente
|
||||
- GOOD_PERFORMER: Resuelve eficientemente, empatía, buen conocimiento técnico
|
||||
- NEEDS_IMPROVEMENT: No resuelve, no escucha, desconoce procesos
|
||||
- MIXED: Tiene fortalezas y debilidades
|
||||
- UNKNOWN: No hay información suficiente
|
||||
|
||||
### 9. AGENT_POSITIVE_SKILLS - Habilidades positivas del agente
|
||||
- Identifica buenas prácticas: explica bien la factura, gestiona bien la avería, muestra empatía
|
||||
- Cada skill DEBE tener evidence_spans, description, y replicable_practice
|
||||
- Máximo 5 skills
|
||||
|
||||
### 10. AGENT_IMPROVEMENT_AREAS - Áreas de mejora del agente
|
||||
- Identifica habilidades a mejorar: no explica causa de avería, confunde al cliente, no ofrece alternativas
|
||||
- Cada área DEBE tener evidence_spans, description, y coaching_recommendation
|
||||
- Máximo 5 áreas
|
||||
|
||||
## FORMATO DE RESPUESTA JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"outcome": "OUTAGE_ESCALATED",
|
||||
|
||||
"lost_sales_drivers": [],
|
||||
|
||||
"poor_cx_drivers": [
|
||||
{
|
||||
"driver_code": "OUTAGE_NOT_EXPLAINED",
|
||||
"confidence": 0.85,
|
||||
"origin": "AGENT",
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "No sé cuándo se va a resolver, tiene que llamar a averías",
|
||||
"start_time": 45.2,
|
||||
"end_time": 49.8,
|
||||
"speaker": "agent"
|
||||
}
|
||||
],
|
||||
"reasoning": "El agente no proporciona información sobre la avería ni tiempo estimado de resolución",
|
||||
"corrective_action": "Verificar en el sistema si hay incidencias conocidas en la zona y comunicar tiempo estimado"
|
||||
},
|
||||
{
|
||||
"driver_code": "WRONG_DEPARTMENT",
|
||||
"confidence": 0.80,
|
||||
"origin": "PROCESS",
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "Yo no manejo eso, tiene que llamar al 800-700-706",
|
||||
"start_time": 52.0,
|
||||
"end_time": 56.5,
|
||||
"speaker": "agent"
|
||||
}
|
||||
],
|
||||
"reasoning": "Cliente derivado a otro número sin transferencia, genera fricción",
|
||||
"corrective_action": "Implementar transferencia directa al departamento de averías"
|
||||
}
|
||||
],
|
||||
|
||||
"fcr_status": "FIRST_CALL",
|
||||
|
||||
"fcr_failure_drivers": [
|
||||
{
|
||||
"driver_code": "OUTAGE_PENDING",
|
||||
"confidence": 0.90,
|
||||
"origin": "PROCESS",
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "Tiene que llamar a averías para que le hagan una incidencia",
|
||||
"start_time": 60.0,
|
||||
"end_time": 64.5,
|
||||
"speaker": "agent"
|
||||
}
|
||||
],
|
||||
"reasoning": "La avería no se resuelve en esta llamada, cliente debe llamar a otro número",
|
||||
"corrective_action": "Permitir que el agente abra la incidencia directamente o transfiera la llamada"
|
||||
}
|
||||
],
|
||||
|
||||
"churn_risk": "AT_RISK",
|
||||
|
||||
"churn_risk_drivers": [
|
||||
{
|
||||
"driver_code": "REPEATED_OUTAGES",
|
||||
"confidence": 0.82,
|
||||
"origin": "COMPANY",
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "Es la tercera vez este mes que nos quedamos sin luz",
|
||||
"start_time": 30.0,
|
||||
"end_time": 34.2,
|
||||
"speaker": "customer"
|
||||
}
|
||||
],
|
||||
"reasoning": "Cliente reporta problemas recurrentes de suministro",
|
||||
"corrective_action": "Escalar a calidad de servicio para investigar causa de cortes frecuentes"
|
||||
},
|
||||
{
|
||||
"driver_code": "HIGH_FRUSTRATION",
|
||||
"confidence": 0.78,
|
||||
"origin": "CUSTOMER",
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "Estoy harto de tener que llamar cada vez que pasa esto",
|
||||
"start_time": 70.0,
|
||||
"end_time": 73.5,
|
||||
"speaker": "customer"
|
||||
}
|
||||
],
|
||||
"reasoning": "Cliente muestra alta frustración con el servicio",
|
||||
"corrective_action": "Ofrecer seguimiento proactivo y posible compensación"
|
||||
}
|
||||
],
|
||||
|
||||
"agent_classification": "NEEDS_IMPROVEMENT",
|
||||
|
||||
"agent_positive_skills": [
|
||||
{
|
||||
"skill_code": "CLEAR_COMMUNICATION",
|
||||
"skill_type": "positive",
|
||||
"confidence": 0.75,
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "El número de teléfono es el siguiente: 800-700-706",
|
||||
"start_time": 80.0,
|
||||
"end_time": 84.5,
|
||||
"speaker": "agent"
|
||||
}
|
||||
],
|
||||
"description": "El agente comunica claramente el número de teléfono",
|
||||
"replicable_practice": "Dictar información importante de forma clara y pausada"
|
||||
}
|
||||
],
|
||||
|
||||
"agent_improvement_areas": [
|
||||
{
|
||||
"skill_code": "POOR_OUTAGE_HANDLING",
|
||||
"skill_type": "improvement_needed",
|
||||
"confidence": 0.85,
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "Yo no puedo saber si ha sido un tema de la zona, eso ya lo maneja el área de averías",
|
||||
"start_time": 56.0,
|
||||
"end_time": 62.0,
|
||||
"speaker": "agent"
|
||||
}
|
||||
],
|
||||
"description": "El agente no intenta ayudar con la avería, solo deriva",
|
||||
"coaching_recommendation": "Capacitar en uso del sistema para verificar incidencias en zona antes de derivar"
|
||||
},
|
||||
{
|
||||
"skill_code": "LACK_OF_EMPATHY",
|
||||
"skill_type": "improvement_needed",
|
||||
"confidence": 0.80,
|
||||
"evidence_spans": [
|
||||
{
|
||||
"text": "Bueno, yo lo que puedo hacer es simplemente verificar si tienes impago",
|
||||
"start_time": 45.0,
|
||||
"end_time": 50.0,
|
||||
"speaker": "agent"
|
||||
}
|
||||
],
|
||||
"description": "El agente no muestra empatía ante el problema del cliente sin luz",
|
||||
"coaching_recommendation": "Practicar frases de empatía: 'Entiendo lo difícil que es quedarse sin luz'"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
17
config/prompts/rca_synthesis/v1.0/system.txt
Normal file
17
config/prompts/rca_synthesis/v1.0/system.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
You are an expert business analyst creating executive summaries of Root Cause Analysis findings. Your task is to synthesize RCA statistics into actionable narratives for business stakeholders.
|
||||
|
||||
## GUIDELINES
|
||||
|
||||
1. **Data-Driven**: Base all statements on the provided statistics. Do not invent numbers.
|
||||
|
||||
2. **Actionable**: Focus on what can be changed. Prioritize by impact and feasibility.
|
||||
|
||||
3. **Concise**: Keep summaries brief and scannable. Use bullet points.
|
||||
|
||||
4. **Language**: Write in Spanish for Spanish-speaking stakeholders.
|
||||
|
||||
5. **No Technical Jargon**: Avoid terms like "RCA", "drivers", "taxonomy". Use business language.
|
||||
|
||||
## OUTPUT FORMAT
|
||||
|
||||
Provide a structured narrative that can be included in an executive PDF report.
|
||||
31
config/prompts/rca_synthesis/v1.0/user.txt
Normal file
31
config/prompts/rca_synthesis/v1.0/user.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
Generate an executive summary based on the following RCA analysis results.
|
||||
|
||||
## BATCH METADATA
|
||||
- Batch ID: {batch_id}
|
||||
- Total Calls Analyzed: {total_calls}
|
||||
- Date Range: {date_range}
|
||||
- Queues: {queues}
|
||||
|
||||
## LOST SALES ANALYSIS
|
||||
Total Sales Lost: {total_sales_lost}
|
||||
Main Causes:
|
||||
{lost_sales_summary}
|
||||
|
||||
## POOR CUSTOMER EXPERIENCE ANALYSIS
|
||||
Total Poor CX Calls: {total_poor_cx}
|
||||
Main Causes:
|
||||
{poor_cx_summary}
|
||||
|
||||
## TOP EMERGENT PATTERNS
|
||||
{emergent_patterns}
|
||||
|
||||
## INSTRUCTIONS
|
||||
|
||||
Write a 2-3 paragraph executive summary in Spanish that:
|
||||
|
||||
1. Highlights the TOP 3 actionable findings
|
||||
2. Quantifies the impact (% of calls affected)
|
||||
3. Suggests immediate actions
|
||||
4. Notes any emergent patterns worth investigating
|
||||
|
||||
Keep it under 500 words. Use professional business Spanish.
|
||||
32
config/prompts/versions.yaml
Normal file
32
config/prompts/versions.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
# ============================================
|
||||
# CXInsights - Prompt Version Registry
|
||||
# ============================================
|
||||
# Active versions for each prompt type
|
||||
# ============================================
|
||||
|
||||
call_analysis:
|
||||
active: "v2.0"
|
||||
versions:
|
||||
v1.0:
|
||||
description: "Initial MAP prompt - sales + CX + RCA"
|
||||
created: "2024-01-19"
|
||||
status: "deprecated"
|
||||
v2.0:
|
||||
description: "Blueprint-aligned - adds FCR, churn risk, agent assessment"
|
||||
created: "2026-01-19"
|
||||
status: "active"
|
||||
changes:
|
||||
- "Added FCR analysis (first call vs repeat call)"
|
||||
- "Added churn risk classification"
|
||||
- "Added agent skill assessment"
|
||||
- "Enhanced RCALabel with origin and corrective_action"
|
||||
- "Added AgentSkillIndicator model"
|
||||
- "Maximum 5 items per category"
|
||||
|
||||
rca_synthesis:
|
||||
active: "v1.0"
|
||||
versions:
|
||||
v1.0:
|
||||
description: "Initial RCA narrative synthesis"
|
||||
created: "2024-01-19"
|
||||
status: "active"
|
||||
Reference in New Issue
Block a user