bstraehle commited on
Commit
1c7a0a7
·
verified ·
1 Parent(s): f3dd2c8

Update crew.py

Browse files
Files changed (1) hide show
  1. crew.py +50 -16
crew.py CHANGED
@@ -1,21 +1,55 @@
1
- from crewai import Crew, Process
2
- from langchain_openai import ChatOpenAI
3
 
4
- from agents import get_researcher_agent, get_writer_agent
5
- from tasks import get_research_task, get_write_task
6
-
7
- LLM_MANAGER="o4-mini"
8
- LLM_AGENT="gpt-4o-mini"
9
-
10
- VERBOSE = True
11
 
12
  def get_crew():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  return Crew(
14
- agents=[get_researcher_agent(LLM_AGENT, VERBOSE),
15
- get_writer_agent(LLM_AGENT, VERBOSE)],
16
- tasks=[get_research_task(LLM_AGENT, VERBOSE),
17
- get_write_task(LLM_AGENT, VERBOSE)],
18
- manager_llm=ChatOpenAI(model=LLM_MANAGER),
19
- process=Process.sequential,
20
- verbose=VERBOSE
21
  )
 
1
+ import os
 
2
 
3
+ from crewai import Agent, Task, Crew
4
+ from crewai_tools import (
5
+ DirectoryReadTool,
6
+ FileReadTool,
7
+ SerperDevTool,
8
+ WebsiteSearchTool
9
+ )
10
 
11
  def get_crew():
12
+ # Instantiate tools
13
+ docs_tool = DirectoryReadTool(directory='./blog-posts')
14
+ file_tool = FileReadTool()
15
+ search_tool = SerperDevTool()
16
+ web_rag_tool = WebsiteSearchTool()
17
+
18
+ # Create agents
19
+ researcher = Agent(
20
+ role='Market Research Analyst',
21
+ goal='Provide up-to-date market analysis of the AI industry',
22
+ backstory='An expert analyst with a keen eye for market trends.',
23
+ tools=[search_tool, web_rag_tool],
24
+ verbose=True
25
+ )
26
+
27
+ writer = Agent(
28
+ role='Content Writer',
29
+ goal='Craft engaging blog posts about the AI industry',
30
+ backstory='A skilled writer with a passion for technology.',
31
+ tools=[docs_tool, file_tool],
32
+ verbose=True
33
+ )
34
+
35
+ # Define tasks
36
+ research = Task(
37
+ description='Research the latest trends in the AI industry and provide a summary.',
38
+ expected_output='A summary of the top 3 trending developments in the AI industry with a unique perspective on their significance.',
39
+ agent=researcher
40
+ )
41
+
42
+ write = Task(
43
+ description='Write an engaging blog post about the AI industry, based on the research analyst's summary. Draw inspiration from the latest blog posts in the directory.',
44
+ expected_output='A 4-paragraph blog post formatted in markdown with engaging, informative, and accessible content, avoiding complex jargon.',
45
+ agent=writer,
46
+ output_file='blog-posts/new_post.md' # The final blog post will be saved here
47
+ )
48
+
49
+ # Assemble a crew with planning enabled
50
  return Crew(
51
+ agents=[researcher, writer],
52
+ tasks=[research, write],
53
+ verbose=True,
54
+ planning=True, # Enable planning feature
 
 
 
55
  )