-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathtasks.py
71 lines (65 loc) · 2.82 KB
/
tasks.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
from crewai import Task
from textwrap import dedent
class CustomTasks:
def __tip_section(self):
return "If you do your BEST WORK, I'll give you a $10,000 commission!"
def architecture_task(self, agent, tools, user_input):
return Task(
description=dedent(
f"""
Provide a high-level solution architecture for the given problem: {user_input}.
Your final answer must include a clear overview and major components involved.
{self.__tip_section()}
You have access to tools which can search the internet, read files, write files and create directories
"""
),
expected_output='A document outlining the high-level architecture.',
tools=tools,
agent=agent,
)
def implementation_task(self, agent, tools, context):
return Task(
description=dedent(
f"""
Implement the solution as per the architect's overview.
Your final answer must include the code implementing the solution.
{self.__tip_section()}
You have access to tools which can read files, write files and create directories
"""
),
expected_output='Python code (py files) implementing the solution.',
tools=tools,
agent=agent,
context=context
)
def testing_task(self, agent, tools, context):
return Task(
description=dedent(
f"""
Write and run test cases for the implemented code.
Your final answer must include test scripts and test results.
{self.__tip_section()}
You have access to tools which can read files, write files and create directories
"""
),
expected_output='Test scripts and test document for the implemented code.',
tools=tools,
agent=agent,
context=context
)
def reviewing_task(self, agent, tools, context):
return Task(
description=dedent(
f"""
Review the work done by each agent at each step.
Your final answer must include feedback and necessary revisions.
You should also know how to run the application which can be useful to the users.
{self.__tip_section()}
You have access to tools which can read files, write files and create directories
"""
),
expected_output='Feedback and revisions for each step of the process. Also a final document which has steps to run the code given which can serve as a documentation for users',
tools=tools,
agent=agent,
context=context
)