TanujInsane
fix: restore completely original constants.py and clean agent.py imports
7ff371f
Raw History Blame Contribute Delete
8.23 kB
# Category Definitions for all difficulties
CATEGORIES = {
"easy": {
0: "General",
1: "Billing",
2: "Support",
3: "Technical",
4: "HR"
},
"medium": {
0: "General",
1: "Billing",
2: "Billing-Dispute",
3: "Support",
4: "Technical",
5: "Technical-Bug",
6: "HR-Payroll",
7: "HR-Benefits",
8: "Legal",
9: "Executive"
},
"hard": {
0: "General", 1: "Billing", 2: "Billing-Dispute", 3: "Billing-Refund",
4: "Support-Urgent", 5: "Support-Normal", 6: "Technical", 7: "Technical-Bug",
8: "Technical-Feature", 9: "HR-Payroll", 10: "HR-Benefits", 11: "HR-Complaint",
12: "Legal", 13: "Legal-Contract", 14: "Legal-Compliance", 15: "Executive",
16: "Executive-Strategic", 17: "Finance", 18: "Marketing", 19: "Operations",
20: "Finance-Tax", 21: "Marketing-Social"
}
}
# Keyword overrides for early classification
CATEGORY_KWORDS = {
"Technical": ["crash", "crashes", "bug", "error", "not working", "broken", "upload fail",
"application", "software", "login fail", "404", "500", "exception",
"loading", "slow", "freeze", "hang", "install", "update failed", "glitch"],
"Billing": ["invoice", "charge", "charged", "payment", "refund", "subscription", "billing",
"amount", "price", "cost", "fee", "receipt", "transaction", "overcharged"],
"HR": ["leave", "salary", "policy", "maternity", "paternity", "holiday", "resignation",
"offer letter", "payslip", "appraisal", "human resources", "benefits"],
"Legal": ["legal", "lawsuit", "compliance", "gdpr", "contract", "terms", "court",
"attorney", "lawyer", "liability", "copyright", "trademark"],
"Marketing": ["ad", "campaign", "social media", "market", "promotion", "outreach"],
"Finance": ["budget", "expense", "tax", "audit", "fiscal"],
}
# Priority detection rules
PRIORITY_RULES = {
"urgent": ["urgent", "asap", "immediately", "critical", "emergency", "not working",
"broken", "down", "error", "failed", "crashes", "crash"],
"high": ["incorrect", "wrong", "missing", "cannot", "can't", "unable",
"problem", "issue", "complaint"],
"medium": ["review", "check", "update", "change", "request", "need", "want", "please"],
"low": ["inquiry", "question", "info", "information", "general", "curious", "wondering"]
}
# Department routing and SLAs
DEPARTMENT_MAP = {
"General": {"team": "General Enquiries", "email": "hello@company.com", "sla": "48h"},
"Billing": {"team": "Billing & Finance", "email": "billing@company.com", "sla": "24h"},
"Billing-Dispute": {"team": "Billing & Finance", "email": "billing@company.com", "sla": "24h"},
"Billing-Refund": {"team": "Billing & Finance", "email": "billing@company.com", "sla": "24h"},
"Support": {"team": "Customer Support", "email": "support@company.com", "sla": "12h"},
"Support-Urgent": {"team": "Customer Support", "email": "support@company.com", "sla": "4h"},
"Support-Normal": {"team": "Customer Support", "email": "support@company.com", "sla": "12h"},
"Technical": {"team": "Tech Support", "email": "techsupport@company.com","sla": "4h"},
"Technical-Bug": {"team": "Tech Support", "email": "techsupport@company.com","sla": "4h"},
"Technical-Feature": {"team": "Engineering", "email": "dev@company.com", "sla": "72h"},
"HR": {"team": "Human Resources", "email": "hr@company.com", "sla": "48h"},
"HR-Payroll": {"team": "Payroll Team", "email": "hr@company.com", "sla": "48h"},
"HR-Benefits": {"team": "Benefits Admin", "email": "hr@company.com", "sla": "48h"},
"HR-Complaint": {"team": "Employee Relations", "email": "hr@company.com", "sla": "24h"},
"Legal": {"team": "Legal & Compliance", "email": "legal@company.com", "sla": "72h"},
"Legal-Contract": {"team": "Legal & Compliance", "email": "legal@company.com", "sla": "72h"},
"Legal-Compliance": {"team": "Legal & Compliance", "email": "legal@company.com", "sla": "72h"},
"Executive": {"team": "Executive Office", "email": "exec@company.com", "sla": "48h"},
"Executive-Strategic": {"team": "Executive Office", "email": "exec@company.com", "sla": "48h"},
"Finance": {"team": "Finance", "email": "finance@company.com", "sla": "24h"},
"Finance-Tax": {"team": "Finance", "email": "finance@company.com", "sla": "48h"},
"Marketing": {"team": "Marketing", "email": "marketing@company.com", "sla": "48h"},
"Marketing-Social": {"team": "Marketing", "email": "marketing@company.com", "sla": "24h"},
"Operations": {"team": "Operations", "email": "ops@company.com", "sla": "24h"},
}
# Template mapping
REPLY_TEMPLATES = {
"General": """Dear Customer,
Thank you for your inquiry.
We have received your message and will respond within 48 hours.
Reference ID: {ref_id}
Priority: {priority}
Best regards,
General Enquiries Team""",
"Billing": """Dear Customer,
Thank you for contacting us regarding your billing inquiry.
We have received your request and our Billing & Finance team will review your account details within 24 hours.
What we'll do:
- Review your invoice/payment details
- Verify the transaction in question
- Send you a detailed resolution
Reference ID: {ref_id}
Priority: {priority}
Expected resolution: {sla}
If urgent, call: +1-800-BILLING
Best regards,
Billing & Finance Team""",
"Technical": """Dear Customer,
Thank you for reporting this technical issue.
Our Tech Support team has been notified and will respond within 4 hours.
Immediate steps you can try:
- Clear browser cache and retry
- Check our status page: status.company.com
- Restart the application
Reference ID: {ref_id}
Priority: {priority}
Expected resolution: {sla}
For critical issues: techsupport@company.com
Best regards,
Tech Support Team""",
"HR": """Dear Team Member,
Thank you for reaching out to Human Resources.
Your query has been received and will be handled with full confidentiality.
Our HR team will respond within 48 hours regarding:
- Policy clarifications
- Benefits & compensation
- Workplace concerns
Reference ID: {ref_id}
Priority: {priority}
Expected resolution: {sla}
Best regards,
Human Resources Team""",
"Support": """Dear Customer,
Thank you for contacting Customer Support.
We have logged your request and a support agent will be in touch within 12 hours.
Reference ID: {ref_id}
Priority: {priority}
Expected resolution: {sla}
Track your ticket: support.company.com/track/{ref_id}
Best regards,
Customer Support Team""",
}
# Hierarchy map - categories that are "close" get partial credit
CATEGORY_HIERARCHY = {
"Billing": ["Billing-Dispute", "Billing-Refund"],
"Billing-Dispute": ["Billing", "Billing-Refund"],
"Billing-Refund": ["Billing", "Billing-Dispute"],
"Support": ["Support-Urgent", "Support-Normal"],
"Support-Urgent": ["Support", "Support-Normal"],
"Support-Normal": ["Support", "Support-Urgent"],
"Technical": ["Technical-Bug", "Technical-Feature"],
"Technical-Bug": ["Technical", "Technical-Feature"],
"Technical-Feature": ["Technical", "Technical-Bug"],
"HR": ["HR-Payroll", "HR-Benefits", "HR-Complaint"],
"HR-Payroll": ["HR", "HR-Benefits"],
"HR-Benefits": ["HR", "HR-Payroll"],
"HR-Complaint": ["HR"],
"Legal": ["Legal-Contract", "Legal-Compliance"],
"Legal-Contract": ["Legal", "Legal-Compliance"],
"Legal-Compliance": ["Legal", "Legal-Contract"],
"Executive": ["Executive-Strategic"],
"Executive-Strategic": ["Executive"],
}
# Helper to find parent category
def get_parent_category(cat):
if "-" in cat:
return cat.split("-")[0]
return cat
# Helper to map any category to a template
def get_reply_template(cat):
parent = get_parent_category(cat)
return REPLY_TEMPLATES.get(cat, REPLY_TEMPLATES.get(parent, REPLY_TEMPLATES["General"]))