-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathycrew_tasks.py
83 lines (71 loc) · 2.95 KB
/
ycrew_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
72
73
74
75
76
77
78
79
80
81
82
83
from crewai import Task
from textwrap import dedent
class MarkdownReportCreationTasks:
def __tip_section(self):
return "If you do your BEST WORK and return exactly what I ask, I'll give you a $10,000 commission!"
def parse_input(self, agent, data: str):
return Task(
description=dedent(f"""
**Task**: Extract relevant data from string.
**Description**: Take the input string and get the company
symbol out of it and also any metrics that are available.
**Parameters**:
- data: {data}
**Notes**
{self.__tip_section()}
"""
),
agent=agent,
expected_output="""A list of dictionaries containing the symbol and metric.
Example output: `[{'symbol': 'MSTR', 'metric': 'cogs'}, {'symbol': 'MSTR', 'metric': 'fcf'}]`"""
)
def get_data_from_api(self, agent, context):
return Task(
description=dedent(f"""
**Description**: For each metric, look up the metric for the symbol provided by using the tool.
**Notes**
You MUST use QuickFS to get data for EVERY metric that the client requests. You may have to complete this task multiple times.
{self.__tip_section()}
"""
),
agent=agent,
context=context,
expected_output="""A list of metrics and the data retrieved for each one.
Example output: [
{metric:'fcf', data: [...data_points],
{metric:'cogs', data: [...data_points],
{...}
]"""
)
def create_charts(self, agent, context) -> Task:
return Task(
description=dedent(f"""
Create graphics of the data representing financial metrics of a company. DO NOT change the metric name when you create the title of the chart.
{self.__tip_section()}
"""),
agent=agent,
context=context,
expected_output="""
A list of the file locations of the created charts.
Example output: [fcf_chart.png, cogs_chart.png]
"""
)
def write_markdown(self, agent, context):
return Task(
description=dedent(f"""
**Task**: Insert markdown syntax to md file
**Description**: Take the input file location and insert it into a markdown file.
For Example: writes ![](fcf_chart.png) to markdown file.
YOU MUST USE MARKDOWN SYNTAX AT ALL TIMES.
**Notes**
{self.__tip_section()}
"""
),
agent=agent,
expected_output="""A report.md file formatted in markdown syntax.
Example output:
![](./COGS_chart.png)\n
![](./FCF_chart.png)
""",
context = context,
)