-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCrewAI-task.py
123 lines (107 loc) · 3.94 KB
/
CrewAI-task.py
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
from crewai import Agent, Task, Crew
import os
from utils import get_openai_api_key
os.environ["OPENAI_API_KEY"] = get_openai_api_key()
openai_api_key = get_openai_api_key()
os.environ["OPENAI_MODEL_NAME"] = 'gpt-3.5-turbo'
support_agent = Agent(
role="Senior Support Representative",
goal="Be the most friendly and helpful "
"support representative in your team",
backstory=(
"You work at crewAI (https://crewai.com) and "
" are now working on providing "
"support to {customer}, a super important customer "
" for your company."
"You need to make sure that you provide the best support!"
"Make sure to provide full complete answers, "
" and make no assumptions."
),
allow_delegation=False,
verbose=True
)
support_quality_assurance_agent = Agent(
role="Support Quality Assurance Specialist",
goal="Get recognition for providing the "
"best support quality assurance in your team",
backstory=(
"You work at crewAI (https://crewai.com) and "
"are now working with your team "
"on a request from {customer} ensuring that "
"the support representative is "
"providing the best support possible.\n"
"You need to make sure that the support representative "
"is providing full"
"complete answers, and make no assumptions."
),
verbose=True
)
from crewai_tools import SerperDevTool, \
ScrapeWebsiteTool, \
WebsiteSearchTool
docs_scrape_tool = ScrapeWebsiteTool(
website_url="https://docs.crewai.com/how-to/Creating-a-Crew-and-kick-it-off/"
)
inquiry_resolution = Task(
description=(
"{customer} just reached out with a super important ask:\n"
"{inquiry}\n\n"
"{person} from {customer} is the one that reached out. "
"Make sure to use everything you know "
"to provide the best support possible."
"You must strive to provide a complete "
"and accurate response to the customer's inquiry."
),
expected_output=(
"A detailed, informative response to the "
"customer's inquiry that addresses "
"all aspects of their question.\n"
"The response should include references "
"to everything you used to find the answer, "
"including external data or solutions. "
"Ensure the answer is complete, "
"leaving no questions unanswered, and maintain a helpful and friendly "
"tone throughout."
),
tools=[docs_scrape_tool],
agent=support_agent,
)
quality_assurance_review = Task(
description=(
"Review the response drafted by the Senior Support Representative for {customer}'s inquiry. "
"Ensure that the answer is comprehensive, accurate, and adheres to the "
"high-quality standards expected for customer support.\n"
"Verify that all parts of the customer's inquiry "
"have been addressed "
"thoroughly, with a helpful and friendly tone.\n"
"Check for references and sources used to "
" find the information, "
"ensuring the response is well-supported and "
"leaves no questions unanswered."
),
expected_output=(
"A final, detailed, and informative response "
"ready to be sent to the customer.\n"
"This response should fully address the "
"customer's inquiry, incorporating all "
"relevant feedback and improvements.\n"
"Don't be too formal, we are a chill and cool company "
"but maintain a professional and friendly tone throughout."
),
agent=support_quality_assurance_agent,
)
crew = Crew(
agents=[support_agent, support_quality_assurance_agent],
tasks=[inquiry_resolution, quality_assurance_review],
verbose=2,
memory=True
)
inputs = {
"customer": "Reyzenello",
"person": "Riccardo Bruzzese",
"inquiry": "I need help with setting up a Crew "
"and kicking it off, specifically "
"how can I add memory to my crew? "
"Can you provide guidance?"
}
result = crew.kickoff(inputs=inputs)