-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.py
More file actions
47 lines (41 loc) · 1.36 KB
/
Copy pathagent.py
File metadata and controls
47 lines (41 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import random
import os
def get_random_reply():
responses = [
"We will resolve your issue.",
"Our team is looking into it.",
"We apologize and will fix this soon.",
"Thank you for your patience, we are handling this.",
"We’re sorry for the inconvenience caused."
]
return random.choice(responses)
def agent(ticket):
ticket = ticket.lower()
# PRODUCT ISSUES
if any(word in ticket for word in ["damaged", "broken", "defective", "not working", "bad condition", "poor quality", "wrong item"]):
return {
"issue": "product",
"action": "replace",
"reply": get_random_reply()
}
# BILLING ISSUES
elif any(word in ticket for word in ["charged", "payment", "deducted", "refund", "overcharged"]):
return {
"issue": "billing",
"action": "refund",
"reply": get_random_reply()
}
# SHIPPING ISSUES
elif any(word in ticket for word in ["delayed", "delivery", "not arrived", "shipment", "late", "not delivered", "status"]):
return {
"issue": "shipping",
"action": "escalate",
"reply": get_random_reply()
}
# DEFAULT
else:
return {
"issue": "shipping",
"action": "escalate",
"reply": get_random_reply()
}