File size: 10,733 Bytes
06520ee
6197856
 
06520ee
 
 
6197856
06520ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6197856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6040b2c
6197856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6040b2c
6197856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6040b2c
 
6197856
 
 
 
 
 
 
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
from crewai import Task
import sys
        
class CrewAITasks:
    def __init__(self,llm,prompt,lst_agents) -> None:
        self.prompt = prompt
        self.topic = prompt
        self.llm = llm 
        self.lst_agents = lst_agents
    

    def create_tasks(self):
        task_plan = Task(
            description=f"""Consider how you would go about the task, '{self.prompt}'.
                        Create a plan to complete the task.
                        The final step should always require delivering feature complete code""",
            agent=self.lst_agents[0],
            expected_output="A detailed plan for the team to complete the task.",
        )

        task_code = Task(
            description="Write feature complete code that is simple, efficient and adheres to object oriented principles.",
            agent=self.lst_agents[1],
            expected_output="Well-written and structured code that is feature complete, simple, efficient and adheres to object oriented principles.",
        )

        return [task_plan, task_code]
    
    
    
    def create_tasks_gen(self):
        try:
            researcher_task = Task(
                description=f"""
                These responsibilities highlight the role of the AI Research Assistant in supporting the content creation process by leveraging AI and machine learning techniques to streamline research, gather relevant data and insights, and facilitate collaboration between AI and human content creators based on the user input {self.prompt}.
                """,
                agent=self.lst_agents[0], #researcher_agent,
                expected_output=f"""
                Structuring a content plan that includes headings, subheadings, and key points to cover for the {self.prompt}.

                Exaple output:
                ### Title: The Role of AI in Healthcare

                ### Introduction:
                - Brief overview of ....

                ### 1: AI Applications in Diagnosis and Disease Detection
                * 1.1: Medical Imaging and Radiology
                    * Key points:
                        - Use of AI algorithms to analyze medical images (X-rays, MRIs, CT scans) for early detection of diseases.
                        - Improved accuracy and efficiency in identifying abnormalities and diagnosing conditions such as cancer, fractures, and cardiovascular diseases.
                * 1.2: .......

                ### Conclusion:
                - Summary of the key roles and applications of AI in healthcare, from diagnosis and treatment to personalized medicine and remote monitoring.
                - Discussion of the potential benefits and challenges of AI adoption in healthcare, along with considerations for future developments.
                - Call-to-action encouraging readers to stay informed about advancements in AI healthcare and to engage in discussions about the ethical and regulatory implications.
                - Closing remarks emphasizing the transformative potential of AI in improving patient care and shaping the future of healthcare delivery.

                """,
                llm=self.llm,
                output_file="outputs/content_creator.md"
            )

            content_creator_task = Task(
                description="""
                The role of generating initial drafts of content requires a blend of creativity, research skills, attention to detail, and adherence to guidelines. By effectively translating research insights into compelling content drafts, content creators lay the groundwork for successful content marketing campaigns that resonate with the target audience and achieve business objectives.
                """,
                agent=self.lst_agents[1], #content_creator_agent,
                expected_output="""
                - Based on the content plan, generate a draft using an AI text-generation model. This should form the body of your content.
                - Generating creative ideas for content, including headlines, taglines, and calls-to-action.
                """,
                llm= self.llm
            )

            content_curator_task = Task(
                description="""
                The Content Curator plays a pivotal role in guaranteeing that published content is error-free, stylistically appropriate, and prepared to meet the publication's standards and expectations.
                """,
                agent=self.lst_agents[2], #content_curator_agent,
                expected_output="""
                - Apply SEO best practices to the generated content. This may involve:
                    - Keyword optimization.
                    - Meta tags and descriptions.
                    - Readability improvements.

                The expected output of a Content Curator is optimizing content for SEO best practices, including keyword density, meta descriptions, and title tags. Recommending improvements to enhance content ranking on search engines. Monitoring content performance and providing insights for content optimization.
                """,
                llm=self.llm,
                context=[researcher_task]
            )

            # visual_content_creator_task = Task(
            #     description="""
            #     Incorporate an AI-based image generation model to create relevant images for the content. Ensure these images are saved locally.
            #     """,
            #     agent= self.lst_agents[3] , # visual_content_creator_agent,
            #     expected_output="""Generate a .png or .jpg file image based on the input and return it in images folder."""
            # )

            seo_analyst_task = Task(
                description="""
                The role involves optimizing content for search engines by analyzing, recommending improvements, and monitoring performance, ultimately aiming to enhance content discoverability online and improve its ranking on search engine results pages.
                """,
                agent=self.lst_agents[3], # seo_analyst_agent,
                expected_output="""
                Apply SEO best practices to the generated content. This may involve:
                - Keyword optimization.
                - Meta tags and descriptions.
                - Readability improvements.

                The expected output of an SEO Analyst is analyzing content for SEO best practices, including keyword density, meta descriptions, and title tags. Recommending improvements to enhance content ranking on search engines. Monitoring content performance and providing insights for content optimization.
                """,
                context=[content_creator_task]
            )

            editorial_assistant_task = Task(
                description="""
                The Editorial Assistant plays a pivotal role in guaranteeing that published content is error-free, stylistically appropriate, and prepared to meet the publication's standards and expectations.
                """,
                agent=self.lst_agents[4] , # editorial_assistant_agent,
                expected_output="""
                The expected output is high-quality content that is polished, accurate, and in line with the publication's editorial standards, ensuring a positive reader experience and maintaining the publication's reputation for excellence.
                """,
                context=[seo_analyst_task],
                output_file="outputs/content_creator.md"
            )

        except Exception as err:
            raise ValueError(err, sys)

        return [researcher_task, content_creator_task, content_curator_task,seo_analyst_task,editorial_assistant_task]


    def create_tasks_image_gen(self):
        try:
            content_creator_task = Task(
                description="""
                The role of generating initial drafts of content requires a blend of creativity, research skills, attention to detail, and adherence to guidelines. By effectively translating research insights into compelling content drafts, content creators lay the groundwork for successful content marketing campaigns that resonate with the target audience and achieve business objectives.
                """,
                agent=self.lst_agents[0],
                expected_output=f"""
                Structuring a content plan that includes headings, subheadings, and key points to cover for the {self.topic} in brief of each section.

                Example output:
                ### Title: The Role of AI in Healthcare

                ### Introduction:
                - Brief overview of ....

                ### 1: AI Applications in Diagnosis and Disease Detection
                * 1.1: Medical Imaging and Radiology
                    * Key points:
                        - Use of AI algorithms to analyze medical images (X-rays, MRIs, CT scans) for early detection of diseases.
                        - Improved accuracy and efficiency in identifying abnormalities and diagnosing conditions such as cancer, fractures, and cardiovascular diseases.
                * 1.2: .......

                ### Conclusion:
                - Summary of the key roles and applications of AI in healthcare, from diagnosis and treatment to personalized medicine and remote monitoring.
                - Discussion of the potential benefits and challenges of AI adoption in healthcare, along with considerations for future developments.
                - Call-to-action encouraging readers to stay informed about advancements in AI healthcare and to engage in discussions about the ethical and regulatory implications.
                - Closing remarks emphasizing the transformative potential of AI in improving patient care and shaping the future of healthcare delivery.

                """,
                llm=self.llm,
                output_file="outputs/content_creator.md"
        
            )

            visual_content_creator_task = Task(
                description="""
                Incorporate an AI-based image generation model to create relevant images for the content. Ensure these images are saved locally.
                """,
                agent=self.lst_agents[1],
                #context=[content_creator_task],
                expected_output=f"""Generate a High Resolution image in .png or .jpg file image based on the {self.topic} and return it in images folder and append it in output_file="./images/gen_*""",
                output_file="./outputs/img_creator.png"
                
            )
         
        except Exception as err:
            raise ValueError(err, sys)

        return [content_creator_task,  visual_content_creator_task]