simple-chatbot-crewai/tasks.py

43 lines
1.2 KiB
Python
Raw Permalink Normal View History

2024-12-06 13:06:17 +07:00
# To know more about the Task class, visit: https://docs.crewai.com/concepts/tasks
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 task_1_name(self, agent, var1, var2):
return Task(
description=dedent(
f"""
Do something as part of task 1
{self.__tip_section()}
Make sure to use the most recent data as possible.
Use this variable: {var1}
And also this variable: {var2}
"""
),
expected_output="The expected output of the task",
agent=agent,
)
def task_2_name(self, agent):
return Task(
description=dedent(
f"""
Take the input from task 1 and do something with it.
generate the result in nicely formatted markdown
{self.__tip_section()}
Make sure to do something else.
"""
),
expected_output="The expected output of the task",
agent=agent,
)