Spaces:
Running
Running
Rename assistants.py to agents.py
Browse files- assistants.py → agents.py +1 -51
assistants.py → agents.py
RENAMED
|
@@ -63,54 +63,4 @@ def create_issues_repairs_agent(client):
|
|
| 63 |
{"type": "transfer_to_triage_agent"}],
|
| 64 |
)
|
| 65 |
show_json("assistant", assistant)
|
| 66 |
-
return assistant
|
| 67 |
-
|
| 68 |
-
def escalate_to_human(summary):
|
| 69 |
-
"""Only call this if explicitly asked to."""
|
| 70 |
-
print("Escalating to human agent...")
|
| 71 |
-
print("\n=== Escalation Report ===")
|
| 72 |
-
print(f"Summary: {summary}")
|
| 73 |
-
print("=========================\n")
|
| 74 |
-
exit()
|
| 75 |
-
|
| 76 |
-
def transfer_to_sales_agent():
|
| 77 |
-
"""Use for anything sales or buying related."""
|
| 78 |
-
return sales_agent
|
| 79 |
-
|
| 80 |
-
def transfer_to_issues_repairs_agent():
|
| 81 |
-
"""Use for issues, repairs, or refunds."""
|
| 82 |
-
return issues_and_repairs_agent
|
| 83 |
-
|
| 84 |
-
def transfer_to_triage_agent():
|
| 85 |
-
"""Call this if the user brings up a topic outside of your purview,
|
| 86 |
-
including escalating to human."""
|
| 87 |
-
return triage_agent
|
| 88 |
-
|
| 89 |
-
def execute_order(product, price: int):
|
| 90 |
-
"""Price should be in USD."""
|
| 91 |
-
print("\n\n=== Order Summary ===")
|
| 92 |
-
print(f"Product: {product}")
|
| 93 |
-
print(f"Price: ${price}")
|
| 94 |
-
print("=================\n")
|
| 95 |
-
confirm = input("Confirm order? y/n: ").strip().lower()
|
| 96 |
-
if confirm == "y":
|
| 97 |
-
print("Order execution successful!")
|
| 98 |
-
return "Success"
|
| 99 |
-
else:
|
| 100 |
-
print(color("Order cancelled!", "red"))
|
| 101 |
-
return "User cancelled order."
|
| 102 |
-
|
| 103 |
-
def look_up_item(search_query):
|
| 104 |
-
"""Use to find item ID.
|
| 105 |
-
Search query can be a description or keywords."""
|
| 106 |
-
item_id = "item_132612938"
|
| 107 |
-
print("Found item:", item_id)
|
| 108 |
-
return item_id
|
| 109 |
-
|
| 110 |
-
def execute_refund(item_id, reason="not provided"):
|
| 111 |
-
print("\n\n=== Refund Summary ===")
|
| 112 |
-
print(f"Item ID: {item_id}")
|
| 113 |
-
print(f"Reason: {reason}")
|
| 114 |
-
print("=================\n")
|
| 115 |
-
print("Refund execution successful!")
|
| 116 |
-
return "Success"
|
|
|
|
| 63 |
{"type": "transfer_to_triage_agent"}],
|
| 64 |
)
|
| 65 |
show_json("assistant", assistant)
|
| 66 |
+
return assistant
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|