Spaces:
Running
Running
Delete agents.py
Browse files
agents.py
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
# Reference: https://github.com/openai/build-hours/blob/main/2-assistants/7_orchestration.py
|
2 |
-
|
3 |
-
from openai import OpenAI
|
4 |
-
|
5 |
-
from tools import transfer_to_sales_agent, transfer_to_issues_repairs_agent, transfer_to_triage_agent
|
6 |
-
from tools import escalate_to_human
|
7 |
-
from tools import execute_order, execute_refund, look_up_item
|
8 |
-
|
9 |
-
from utils import function_to_schema
|
10 |
-
|
11 |
-
MODEL = "gpt-4o-mini"
|
12 |
-
|
13 |
-
def create_triage_agent(client):
|
14 |
-
return client.beta.assistants.create(
|
15 |
-
name="Triage Agent",
|
16 |
-
instructions=(
|
17 |
-
"You are a customer service bot for ACME Inc. "
|
18 |
-
"Introduce yourself. Always be very brief. "
|
19 |
-
"Gather information to direct the customer to the right department. "
|
20 |
-
"But make your questions subtle and natural."
|
21 |
-
),
|
22 |
-
model=MODEL,
|
23 |
-
tools=[{"type": "function", "function": function_to_schema(transfer_to_sales_agent)},
|
24 |
-
{"type": "function", "function": function_to_schema(transfer_to_issues_repairs_agent)},
|
25 |
-
{"type": "function", "function": function_to_schema(escalate_to_human)}],
|
26 |
-
)
|
27 |
-
|
28 |
-
def create_sales_agent(client):
|
29 |
-
return client.beta.assistants.create(
|
30 |
-
name="Sales Agent",
|
31 |
-
instructions=(
|
32 |
-
"You are a sales agent for ACME Inc."
|
33 |
-
"Always answer in a sentence or less."
|
34 |
-
"Follow the following routine with the user:"
|
35 |
-
"1. Ask them about any problems in their life related to catching roadrunners.\n"
|
36 |
-
"2. Casually mention one of ACME's crazy made-up products can help.\n"
|
37 |
-
" - Don't mention price.\n"
|
38 |
-
"3. Once the user is bought in, drop a ridiculous price.\n"
|
39 |
-
"4. Only after everything, and if the user says yes, "
|
40 |
-
"tell them a crazy caveat and execute their order.\n"
|
41 |
-
""
|
42 |
-
),
|
43 |
-
model=MODEL,
|
44 |
-
tools=[{"type": "function", "function": function_to_schema(execute_order)},
|
45 |
-
{"type": "function", "function": function_to_schema(transfer_to_triage_agent)}],
|
46 |
-
)
|
47 |
-
|
48 |
-
def create_issues_repairs_agent(client):
|
49 |
-
return client.beta.assistants.create(
|
50 |
-
name="Issues and Repairs Agent",
|
51 |
-
instructions=(
|
52 |
-
"You are a customer support agent for ACME Inc."
|
53 |
-
"Always answer in a sentence or less."
|
54 |
-
"Follow the following routine with the user:"
|
55 |
-
"1. First, ask probing questions and understand the user's problem deeper.\n"
|
56 |
-
" - unless the user has already provided a reason.\n"
|
57 |
-
"2. Propose a fix (make one up).\n"
|
58 |
-
"3. ONLY if not satesfied, offer a refund.\n"
|
59 |
-
"4. If accepted, search for the ID and then execute refund."
|
60 |
-
""
|
61 |
-
),
|
62 |
-
model=MODEL,
|
63 |
-
tools=[{"type": "function", "function": function_to_schema(look_up_item)},
|
64 |
-
{"type": "function", "function": function_to_schema(execute_refund)},
|
65 |
-
{"type": "function", "function": function_to_schema(transfer_to_triage_agent)}],
|
66 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|