Update app.py
Browse files
app.py
CHANGED
|
@@ -647,7 +647,9 @@ def query_with_llm(request: QueryRequest):
|
|
| 647 |
return 0
|
| 648 |
|
| 649 |
context = f"""
|
| 650 |
-
You are a telecom analytics AI assistant analyzing customer data. Provide clear, actionable insights.
|
|
|
|
|
|
|
| 651 |
|
| 652 |
CUSTOMER DATABASE STATISTICS:
|
| 653 |
|
|
@@ -679,38 +681,46 @@ CUSTOMER DATABASE STATISTICS:
|
|
| 679 |
|
| 680 |
USER QUESTION: {request.question}
|
| 681 |
|
| 682 |
-
|
| 683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
|
| 685 |
**1. USAGE PROFILE**
|
| 686 |
-
|
| 687 |
-
-
|
| 688 |
-
- Mention ALL significant time periods (generally >25% is significant)
|
| 689 |
- Recognize patterns: bimodal (2 peaks), uniform (balanced), concentrated (1 dominant)
|
| 690 |
- Consider work patterns: morning+night = commuter, night-heavy = night owl, etc.
|
| 691 |
|
| 692 |
**2. RECOMMENDED PACKAGE**
|
| 693 |
-
|
| 694 |
-
- Size the package to cover 120-150% of their actual usage for growth headroom
|
| 695 |
- EXCLUDE services with 0 usage (if data=0 MB, don't include data)
|
| 696 |
- Name should reflect the dominant pattern intelligently
|
| 697 |
-
-
|
|
|
|
|
|
|
|
|
|
| 698 |
|
| 699 |
**3. KEY BENEFITS**
|
| 700 |
-
[List 3-4 specific benefits with bullet points]
|
| 701 |
- Focus on: cost savings, usage coverage, flexibility, value match
|
| 702 |
- Quantify benefits where possible ("save 20%", "covers 150% of usage")
|
| 703 |
-
- Address their specific pain points
|
| 704 |
|
| 705 |
**4. PRICING STRATEGY**
|
| 706 |
-
|
| 707 |
-
-
|
| 708 |
-
- Include upsell opportunities for underutilized services
|
| 709 |
- Quantify expected impact (ARPU increase, churn reduction)
|
| 710 |
-
|
| 711 |
-
- Use data-driven insights from statistics above
|
| 712 |
-
- Be specific with numbers and percentages
|
| 713 |
-
- Include all 4 sections - DO NOT skip any
|
| 714 |
"""
|
| 715 |
|
| 716 |
try:
|
|
|
|
| 647 |
return 0
|
| 648 |
|
| 649 |
context = f"""
|
| 650 |
+
You are a telecom analytics AI assistant analyzing Pakistani telecom customer data. Provide clear, actionable insights.
|
| 651 |
+
|
| 652 |
+
IMPORTANT: This is Pakistani telecom data. Use PKR (Pakistani Rupees) for all pricing. Market context: Pakistan has competitive telecom pricing with packages ranging PKR 500-2500/month.
|
| 653 |
|
| 654 |
CUSTOMER DATABASE STATISTICS:
|
| 655 |
|
|
|
|
| 681 |
|
| 682 |
USER QUESTION: {request.question}
|
| 683 |
|
| 684 |
+
RESPONSE INSTRUCTIONS:
|
| 685 |
+
|
| 686 |
+
📌 **ONLY use the 4-section package format below if:**
|
| 687 |
+
- The question explicitly contains "package", "recommend", "plan", "pricing", or "offer"
|
| 688 |
+
- AND it's about an INDIVIDUAL customer (mentions specific usage numbers for one person)
|
| 689 |
+
|
| 690 |
+
📌 **For all other questions** (insights, trends, analysis, comparisons):
|
| 691 |
+
- Provide 3 concise, actionable insights
|
| 692 |
+
- Focus on business opportunities, patterns, and strategies
|
| 693 |
+
- DO NOT format as package recommendations
|
| 694 |
+
- Keep it brief and data-driven
|
| 695 |
+
|
| 696 |
+
---
|
| 697 |
+
|
| 698 |
+
IF PACKAGE RECOMMENDATION (Individual Customer Only):
|
| 699 |
|
| 700 |
**1. USAGE PROFILE**
|
| 701 |
+
- Intelligently identify usage patterns from time distribution percentages
|
| 702 |
+
- Mention ALL significant time periods (>25% is significant)
|
|
|
|
| 703 |
- Recognize patterns: bimodal (2 peaks), uniform (balanced), concentrated (1 dominant)
|
| 704 |
- Consider work patterns: morning+night = commuter, night-heavy = night owl, etc.
|
| 705 |
|
| 706 |
**2. RECOMMENDED PACKAGE**
|
| 707 |
+
- Size to cover 120-150% of actual usage for growth headroom
|
|
|
|
| 708 |
- EXCLUDE services with 0 usage (if data=0 MB, don't include data)
|
| 709 |
- Name should reflect the dominant pattern intelligently
|
| 710 |
+
- Realistic pricing in PKR (Pakistani Rupees): PKR 500-2500/month typical range
|
| 711 |
+
* Basic packages: PKR 500-900/month
|
| 712 |
+
* Mid-tier packages: PKR 900-1600/month
|
| 713 |
+
* Premium packages: PKR 1600-2500/month
|
| 714 |
|
| 715 |
**3. KEY BENEFITS**
|
|
|
|
| 716 |
- Focus on: cost savings, usage coverage, flexibility, value match
|
| 717 |
- Quantify benefits where possible ("save 20%", "covers 150% of usage")
|
|
|
|
| 718 |
|
| 719 |
**4. PRICING STRATEGY**
|
| 720 |
+
- Specific discounts with business justification (in PKR)
|
| 721 |
+
- Upsell opportunities for underutilized services
|
|
|
|
| 722 |
- Quantify expected impact (ARPU increase, churn reduction)
|
| 723 |
+
- Consider Pakistani market competition and customer affordability
|
|
|
|
|
|
|
|
|
|
| 724 |
"""
|
| 725 |
|
| 726 |
try:
|