Spaces:
Running
Running
Create tools.py
Browse files
tools.py
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def escalate_to_human(summary):
|
2 |
+
"""Only call this if explicitly asked to."""
|
3 |
+
print("Escalating to human agent...")
|
4 |
+
print("\n=== Escalation Report ===")
|
5 |
+
print(f"Summary: {summary}")
|
6 |
+
print("=========================\n")
|
7 |
+
exit()
|
8 |
+
|
9 |
+
def transfer_to_sales_agent():
|
10 |
+
"""Use for anything sales or buying related."""
|
11 |
+
return sales_agent
|
12 |
+
|
13 |
+
def transfer_to_issues_repairs_agent():
|
14 |
+
"""Use for issues, repairs, or refunds."""
|
15 |
+
return issues_and_repairs_agent
|
16 |
+
|
17 |
+
def transfer_to_triage_agent():
|
18 |
+
"""Call this if the user brings up a topic outside of your purview,
|
19 |
+
including escalating to human."""
|
20 |
+
return triage_agent
|
21 |
+
|
22 |
+
def execute_order(product, price: int):
|
23 |
+
"""Price should be in USD."""
|
24 |
+
print("\n\n=== Order Summary ===")
|
25 |
+
print(f"Product: {product}")
|
26 |
+
print(f"Price: ${price}")
|
27 |
+
print("=================\n")
|
28 |
+
confirm = input("Confirm order? y/n: ").strip().lower()
|
29 |
+
if confirm == "y":
|
30 |
+
print("Order execution successful!")
|
31 |
+
return "Success"
|
32 |
+
else:
|
33 |
+
print(color("Order cancelled!", "red"))
|
34 |
+
return "User cancelled order."
|
35 |
+
|
36 |
+
def look_up_item(search_query):
|
37 |
+
"""Use to find item ID.
|
38 |
+
Search query can be a description or keywords."""
|
39 |
+
item_id = "item_132612938"
|
40 |
+
print("Found item:", item_id)
|
41 |
+
return item_id
|
42 |
+
|
43 |
+
def execute_refund(item_id, reason="not provided"):
|
44 |
+
print("\n\n=== Refund Summary ===")
|
45 |
+
print(f"Item ID: {item_id}")
|
46 |
+
print(f"Reason: {reason}")
|
47 |
+
print("=================\n")
|
48 |
+
print("Refund execution successful!")
|
49 |
+
return "Success"
|