Spaces:
Build error
Build error
Update tasks.py
Browse files
tasks.py
CHANGED
|
@@ -1,58 +1,58 @@
|
|
| 1 |
-
from crewai import Task
|
| 2 |
-
from textwrap import dedent
|
| 3 |
-
|
| 4 |
-
class ContentTasks:
|
| 5 |
-
|
| 6 |
-
def __tip_section(self):
|
| 7 |
-
return "
|
| 8 |
-
|
| 9 |
-
def planner_task(self, agent, topic):
|
| 10 |
-
return Task(
|
| 11 |
-
description=dedent(f"""
|
| 12 |
-
1. Prioritize the latest trends, key players, and noteworthy news on {topic}.
|
| 13 |
-
2. Identify the target audience, considering their interests and pain points.
|
| 14 |
-
3. Develop a detailed content outline including an introduction, key points, a call to action, and some avenues for reflection.
|
| 15 |
-
4. Include SEO keywords and relevant data or sources.
|
| 16 |
-
5. Include a description of images that would be relevant to include in the article.
|
| 17 |
-
{self.__tip_section()}
|
| 18 |
-
"""),
|
| 19 |
-
expected_output=dedent(f"""
|
| 20 |
-
A comprehensive content plan document formatted as markdown with an outline, audience analysis,
|
| 21 |
-
SEO keywords, images description, and resources.
|
| 22 |
-
"""),
|
| 23 |
-
agent=agent
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
def researcher_task(self, agent, topic):
|
| 27 |
-
return Task(
|
| 28 |
-
description=dedent(f"""
|
| 29 |
-
1. Research the latest and accurate trends on the topic {topic}, then provide comprehensive and detailed knowledge. Each piece of knowledge is backed by a reference to its source.
|
| 30 |
-
2. Provide a list of open-source image links related to the topic, as well as each image's description and attribution.
|
| 31 |
-
3. Filter out controversial or racial information.
|
| 32 |
-
4. Filter out information related to harming people.
|
| 33 |
-
{self.__tip_section()}
|
| 34 |
-
"""),
|
| 35 |
-
expected_output=dedent(f"""
|
| 36 |
-
A comprehensive knowledge document on the topic {topic}; the document is to be formatted
|
| 37 |
-
as markdown with clear details on your web search results.
|
| 38 |
-
"""),
|
| 39 |
-
agent=agent
|
| 40 |
-
)
|
| 41 |
-
|
| 42 |
-
def writer_task(self, agent, topic):
|
| 43 |
-
return Task(
|
| 44 |
-
description=dedent(f"""
|
| 45 |
-
1. Use the content plan, the domain knowledge, and images to craft a compelling article on {topic}.
|
| 46 |
-
2. Incorporate SEO keywords naturally.
|
| 47 |
-
3. Name sections/subtitles in an engaging manner.
|
| 48 |
-
4. Ensure the article is structured with an engaging introduction, insightful body, some avenues for reflection, and a summarizing conclusion.
|
| 49 |
-
5. Use images only at relevant parts of the articles, while following best practices.
|
| 50 |
-
6. Proofread for grammatical errors and alignment with the brand's voice.
|
| 51 |
-
7. Proofread to confirm images and quotes are properly attributed.
|
| 52 |
-
{self.__tip_section()}
|
| 53 |
-
"""),
|
| 54 |
-
expected_output=dedent(f"""
|
| 55 |
-
A well-written article in markdown format, ready for publication; each section should have 3 or 4 paragraphs.
|
| 56 |
-
"""),
|
| 57 |
-
agent=agent
|
| 58 |
-
)
|
|
|
|
| 1 |
+
from crewai import Task
|
| 2 |
+
from textwrap import dedent
|
| 3 |
+
|
| 4 |
+
class ContentTasks:
|
| 5 |
+
|
| 6 |
+
def __tip_section(self):
|
| 7 |
+
return "Keep the content informative and engaging, focusing on providing value to the reader."
|
| 8 |
+
|
| 9 |
+
def planner_task(self, agent, topic):
|
| 10 |
+
return Task(
|
| 11 |
+
description=dedent(f"""
|
| 12 |
+
1. Prioritize the latest trends, key players, and noteworthy news on {topic}.
|
| 13 |
+
2. Identify the target audience, considering their interests and pain points.
|
| 14 |
+
3. Develop a detailed content outline including an introduction, key points, a call to action, and some avenues for reflection.
|
| 15 |
+
4. Include SEO keywords and relevant data or sources.
|
| 16 |
+
5. Include a description of images that would be relevant to include in the article.
|
| 17 |
+
{self.__tip_section()}
|
| 18 |
+
"""),
|
| 19 |
+
expected_output=dedent(f"""
|
| 20 |
+
A comprehensive content plan document formatted as markdown with an outline, audience analysis,
|
| 21 |
+
SEO keywords, images description, and resources.
|
| 22 |
+
"""),
|
| 23 |
+
agent=agent
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
def researcher_task(self, agent, topic):
|
| 27 |
+
return Task(
|
| 28 |
+
description=dedent(f"""
|
| 29 |
+
1. Research the latest and accurate trends on the topic {topic}, then provide comprehensive and detailed knowledge. Each piece of knowledge is backed by a reference to its source.
|
| 30 |
+
2. Provide a list of open-source image links related to the topic, as well as each image's description and attribution.
|
| 31 |
+
3. Filter out controversial or racial information.
|
| 32 |
+
4. Filter out information related to harming people.
|
| 33 |
+
{self.__tip_section()}
|
| 34 |
+
"""),
|
| 35 |
+
expected_output=dedent(f"""
|
| 36 |
+
A comprehensive knowledge document on the topic {topic}; the document is to be formatted
|
| 37 |
+
as markdown with clear details on your web search results.
|
| 38 |
+
"""),
|
| 39 |
+
agent=agent
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
def writer_task(self, agent, topic):
|
| 43 |
+
return Task(
|
| 44 |
+
description=dedent(f"""
|
| 45 |
+
1. Use the content plan, the domain knowledge, and images to craft a compelling article on {topic}.
|
| 46 |
+
2. Incorporate SEO keywords naturally.
|
| 47 |
+
3. Name sections/subtitles in an engaging manner.
|
| 48 |
+
4. Ensure the article is structured with an engaging introduction, insightful body, some avenues for reflection, and a summarizing conclusion.
|
| 49 |
+
5. Use images only at relevant parts of the articles, while following best practices.
|
| 50 |
+
6. Proofread for grammatical errors and alignment with the brand's voice.
|
| 51 |
+
7. Proofread to confirm images and quotes are properly attributed.
|
| 52 |
+
{self.__tip_section()}
|
| 53 |
+
"""),
|
| 54 |
+
expected_output=dedent(f"""
|
| 55 |
+
A well-written article in markdown format, ready for publication; each section should have 3 or 4 paragraphs.
|
| 56 |
+
"""),
|
| 57 |
+
agent=agent
|
| 58 |
+
)
|