Spaces:
Sleeping
Sleeping
Commit
·
71a99b7
1
Parent(s):
c631b4c
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
'''
|
3 |
+
from crewai.agent import Agent
|
4 |
+
from crewai.crew import Crew
|
5 |
+
from crewai.process import Process
|
6 |
+
from crewai.task import Task
|
7 |
+
'''
|
8 |
+
|
9 |
+
import os
|
10 |
+
from crewai import Agent, Task, Crew, Process
|
11 |
+
|
12 |
+
os.environ["OPENAI_API_KEY"] = "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"
|
13 |
+
|
14 |
+
|
15 |
+
# Define your agents with roles and goals
|
16 |
+
researcher = Agent(
|
17 |
+
role='Senior Research Analyst',
|
18 |
+
goal='Uncover cutting-edge developments in AI and data science in',
|
19 |
+
backstory="""You are a Senior Research Analyst at a leading tech think tank.
|
20 |
+
Your expertise lies in identifying emerging trends and technologies in AI and
|
21 |
+
data science. You have a knack for dissecting complex data and presenting
|
22 |
+
actionable insights.""",
|
23 |
+
verbose=True,
|
24 |
+
allow_delegation=False,
|
25 |
+
|
26 |
+
)
|
27 |
+
writer = Agent(
|
28 |
+
role='Tech Content Strategist',
|
29 |
+
goal='Craft compelling content on tech advancements',
|
30 |
+
backstory="""You are a renowned Tech Content Strategist, known for your insightful
|
31 |
+
and engaging articles on technology and innovation. With a deep understanding of
|
32 |
+
the tech industry, you transform complex concepts into compelling narratives.""",
|
33 |
+
verbose=True,
|
34 |
+
allow_delegation=True
|
35 |
+
)
|
36 |
+
|
37 |
+
# Create tasks for your agents
|
38 |
+
task1 = Task(
|
39 |
+
description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
|
40 |
+
Identify key trends, breakthrough technologies, and potential industry impacts.
|
41 |
+
Compile your findings in a detailed report. Your final answer MUST be a full analysis report""",
|
42 |
+
agent=researcher
|
43 |
+
)
|
44 |
+
|
45 |
+
task2 = Task(
|
46 |
+
description="""Using the insights from the researcher's report, develop an engaging blog
|
47 |
+
post that highlights the most significant AI advancements.
|
48 |
+
Your post should be informative yet accessible, catering to a tech-savvy audience.
|
49 |
+
Aim for a narrative that captures the essence of these breakthroughs and their
|
50 |
+
implications for the future. Your final answer MUST be the full blog post of at least 3 paragraphs.""",
|
51 |
+
agent=writer
|
52 |
+
)
|
53 |
+
|
54 |
+
# Instantiate your crew with a sequential process
|
55 |
+
crew = Crew(
|
56 |
+
agents=[researcher, writer],
|
57 |
+
tasks=[task1, task2],
|
58 |
+
verbose=2, # Crew verbose more will let you know what tasks are being worked on, you can set it to 1 or 2 to different logging levels
|
59 |
+
process=Process.sequential # Sequential process will have tasks executed one after the other and the outcome of the previous one is passed as extra content into this next.
|
60 |
+
)
|
61 |
+
|
62 |
+
# Get your crew to work!
|
63 |
+
result = crew.kickoff()
|
64 |
+
|
65 |
+
print("######################")
|
66 |
+
print(result)
|