Spaces:
Sleeping
Sleeping
Update src/tech_news/crew.py
Browse files- src/tech_news/crew.py +72 -72
src/tech_news/crew.py
CHANGED
@@ -1,72 +1,72 @@
|
|
1 |
-
from crewai import Agent, Crew, Process, Task, LLM
|
2 |
-
from crewai.project import CrewBase, agent, crew, task
|
3 |
-
from crewai_tools import SerperDevTool , ScrapeWebsiteTool
|
4 |
-
|
5 |
-
|
6 |
-
# Uncomment the following line to use an example of a custom tool
|
7 |
-
# from tech_news.tools.custom_tool import MyCustomTool
|
8 |
-
|
9 |
-
# Check our tools documentations for more information on how to use them
|
10 |
-
# from crewai_tools import SerperDevTool
|
11 |
-
|
12 |
-
@CrewBase
|
13 |
-
class TechNewsCrew():
|
14 |
-
"""TechNews crew"""
|
15 |
-
|
16 |
-
@agent
|
17 |
-
def tech_news_enthusiast(self) -> Agent:
|
18 |
-
return Agent(
|
19 |
-
config=self.agents_config['tech_news_enthusiast'],
|
20 |
-
verbose=True,
|
21 |
-
llm=LLM("gemini/gemini-1.5-flash"),
|
22 |
-
tools=[
|
23 |
-
SerperDevTool(n_results=
|
24 |
-
]
|
25 |
-
)
|
26 |
-
|
27 |
-
@agent
|
28 |
-
def tech_article_curator(self) -> Agent:
|
29 |
-
return Agent(
|
30 |
-
config=self.agents_config['tech_article_curator'],
|
31 |
-
tools=[ScrapeWebsiteTool()],
|
32 |
-
llm=LLM("gemini/gemini-1.5-flash"),
|
33 |
-
verbose=True
|
34 |
-
)
|
35 |
-
|
36 |
-
@agent
|
37 |
-
def tech_news_reporter(self) -> Agent:
|
38 |
-
return Agent(
|
39 |
-
config=self.agents_config['tech_news_reporter'],
|
40 |
-
llm=LLM("gemini/gemini-1.5-flash"),
|
41 |
-
verbose=True
|
42 |
-
)
|
43 |
-
|
44 |
-
@task
|
45 |
-
def tech_news_enthusiast_task(self) -> Task:
|
46 |
-
return Task(
|
47 |
-
config=self.tasks_config['tech_news_enthusiast_task'],
|
48 |
-
)
|
49 |
-
|
50 |
-
@task
|
51 |
-
def tech_curator_task(self) -> Task:
|
52 |
-
return Task(
|
53 |
-
config=self.tasks_config['tech_curator_task']
|
54 |
-
)
|
55 |
-
|
56 |
-
@task
|
57 |
-
def tech_reporter_task(self) -> Task:
|
58 |
-
return Task(
|
59 |
-
config=self.tasks_config['tech_reporter_task']
|
60 |
-
)
|
61 |
-
|
62 |
-
@crew
|
63 |
-
def crew(self) -> Crew:
|
64 |
-
"""Creates the TechNews crew"""
|
65 |
-
return Crew(
|
66 |
-
agents=self.agents, # Automatically created by the @agent decorator
|
67 |
-
tasks=self.tasks, # Automatically created by the @task decorator
|
68 |
-
process=Process.sequential,
|
69 |
-
verbose=True,
|
70 |
-
# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
|
71 |
-
)
|
72 |
-
|
|
|
1 |
+
from crewai import Agent, Crew, Process, Task, LLM
|
2 |
+
from crewai.project import CrewBase, agent, crew, task
|
3 |
+
from crewai_tools import SerperDevTool , ScrapeWebsiteTool
|
4 |
+
|
5 |
+
|
6 |
+
# Uncomment the following line to use an example of a custom tool
|
7 |
+
# from tech_news.tools.custom_tool import MyCustomTool
|
8 |
+
|
9 |
+
# Check our tools documentations for more information on how to use them
|
10 |
+
# from crewai_tools import SerperDevTool
|
11 |
+
|
12 |
+
@CrewBase
|
13 |
+
class TechNewsCrew():
|
14 |
+
"""TechNews crew"""
|
15 |
+
|
16 |
+
@agent
|
17 |
+
def tech_news_enthusiast(self) -> Agent:
|
18 |
+
return Agent(
|
19 |
+
config=self.agents_config['tech_news_enthusiast'],
|
20 |
+
verbose=True,
|
21 |
+
llm=LLM("gemini/gemini-1.5-flash"),
|
22 |
+
tools=[
|
23 |
+
SerperDevTool(n_results=10)
|
24 |
+
]
|
25 |
+
)
|
26 |
+
|
27 |
+
@agent
|
28 |
+
def tech_article_curator(self) -> Agent:
|
29 |
+
return Agent(
|
30 |
+
config=self.agents_config['tech_article_curator'],
|
31 |
+
tools=[ScrapeWebsiteTool()],
|
32 |
+
llm=LLM("gemini/gemini-1.5-flash"),
|
33 |
+
verbose=True
|
34 |
+
)
|
35 |
+
|
36 |
+
@agent
|
37 |
+
def tech_news_reporter(self) -> Agent:
|
38 |
+
return Agent(
|
39 |
+
config=self.agents_config['tech_news_reporter'],
|
40 |
+
llm=LLM("gemini/gemini-1.5-flash"),
|
41 |
+
verbose=True
|
42 |
+
)
|
43 |
+
|
44 |
+
@task
|
45 |
+
def tech_news_enthusiast_task(self) -> Task:
|
46 |
+
return Task(
|
47 |
+
config=self.tasks_config['tech_news_enthusiast_task'],
|
48 |
+
)
|
49 |
+
|
50 |
+
@task
|
51 |
+
def tech_curator_task(self) -> Task:
|
52 |
+
return Task(
|
53 |
+
config=self.tasks_config['tech_curator_task']
|
54 |
+
)
|
55 |
+
|
56 |
+
@task
|
57 |
+
def tech_reporter_task(self) -> Task:
|
58 |
+
return Task(
|
59 |
+
config=self.tasks_config['tech_reporter_task']
|
60 |
+
)
|
61 |
+
|
62 |
+
@crew
|
63 |
+
def crew(self) -> Crew:
|
64 |
+
"""Creates the TechNews crew"""
|
65 |
+
return Crew(
|
66 |
+
agents=self.agents, # Automatically created by the @agent decorator
|
67 |
+
tasks=self.tasks, # Automatically created by the @task decorator
|
68 |
+
process=Process.sequential,
|
69 |
+
verbose=True,
|
70 |
+
# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
|
71 |
+
)
|
72 |
+
|