-
Notifications
You must be signed in to change notification settings - Fork 85
/
main.py
89 lines (75 loc) · 2.87 KB
/
main.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
84
85
86
87
88
89
from crewai import Crew, Process
from agents import YoutubeAutomationAgents
from tasks import YoutubeAutomationTasks
from langchain_openai import ChatOpenAI
from tools.youtube_video_details_tool import YoutubeVideoDetailsTool
from tools.youtube_video_search_tool import YoutubeVideoSearchTool
from dotenv import load_dotenv
load_dotenv()
# Initialize the OpenAI GPT-4 language model
OpenAIGPT4 = ChatOpenAI(
model="gpt-4"
)
agents = YoutubeAutomationAgents()
tasks = YoutubeAutomationTasks()
youtube_video_search_tool = YoutubeVideoSearchTool()
youtube_video_details_tool = YoutubeVideoDetailsTool()
youtube_manager = agents.youtube_manager()
research_manager = agents.research_manager(
youtube_video_search_tool, youtube_video_details_tool)
title_creator = agents.title_creator()
description_creator = agents.description_creator()
email_creator = agents.email_creator()
# TODO: UPDATE THE VIDEO DETAILS - The purpose of this video is to talk about how I've automated my YouTube video creation process using CrewAI, cover new CrewAI features, and how to build custom CrewAI tools
video_topic = "Automating Tasks Using CrewAI"
video_details = """
In this video, we're diving into the innovative ways I'm using CrewAI to
automate my YouTube channel. From conducting thorough research to
streamline video preparation, CrewAI is revolutionizing how I create content.
But that's not all - I'm also exploring how to harness the power of CrewAI
to generate personalized emails for my subscribers. Join me on this journey
as I unlock the potential of AI to enhance my YouTube channel and connect
with my audience like never before.
"""
manage_youtube_video_creation = tasks.manage_youtube_video_creation(
agent=youtube_manager,
video_topic=video_topic,
video_details=video_details
)
manage_youtube_video_research = tasks.manage_youtube_video_research(
agent=research_manager,
video_topic=video_topic,
video_details=video_details,
)
create_youtube_video_title = tasks.create_youtube_video_title(
agent=title_creator,
video_topic=video_topic,
video_details=video_details
)
create_youtube_video_description = tasks.create_youtube_video_description(
agent=description_creator,
video_topic=video_topic,
video_details=video_details
)
create_email_announcement_for_new_video = tasks.create_email_announcement_for_new_video(
agent=email_creator,
video_topic=video_topic,
video_details=video_details
)
# Create a new Crew instance
crew = Crew(
agents=[youtube_manager,
research_manager,
email_creator,
],
tasks=[manage_youtube_video_creation,
manage_youtube_video_research,
create_email_announcement_for_new_video],
process=Process.hierarchical,
manager_llm=OpenAIGPT4
)
# Kick of the crew
results = crew.kickoff()
print("Crew usage", crew.usage_metrics)
print("Crew work results:")
print(results)