bstraehle commited on
Commit
b6591d5
·
verified ·
1 Parent(s): 7a83529

Update crew.py

Browse files
Files changed (1) hide show
  1. crew.py +33 -37
crew.py CHANGED
@@ -39,11 +39,10 @@ def run_crew(question, file_name):
39
 
40
  # Agents
41
 
42
- image_search_agent = Agent(
43
- role="Image Search Agent",
44
- #goal="Search an image for question \"{topic}\". ",
45
- goal="{topic} ",
46
- backstory="As an expert image search assistant, you search an image for the question. ",
47
  allow_delegation=False,
48
  llm=AGENT_MODEL,
49
  #max_iter=1,
@@ -53,9 +52,8 @@ def run_crew(question, file_name):
53
 
54
  python_coding_agent = Agent(
55
  role="Python Coding Agent",
56
- #goal="Write and execute Python code to solve question \"{topic}\". ",
57
- goal="{topic} ",
58
- backstory="As an expert Python coding assistant, you write and execute Python for the question. ",
59
  allow_delegation=False,
60
  llm=AGENT_MODEL,
61
  max_iter=1,
@@ -63,64 +61,62 @@ def run_crew(question, file_name):
63
  verbose=False,
64
  )
65
 
66
- web_search_agent = Agent(
67
- role="Web Search Agent",
68
- goal="Search the web for question \"{topic}\" and scrape the most relevant web page. ",
69
- backstory="As an expert web search assistant, you search the web for the question and scrape the most relevant web page. ",
70
  allow_delegation=False,
71
  llm=AGENT_MODEL,
72
  max_iter=1,
73
- tools=[web_search_tool, web_rag_tool],
74
  verbose=False
75
  )
76
 
77
- youtube_search_agent = Agent(
78
- role="YouTube Search Agent",
79
- goal="Search a YouTube video for question \"{topic}\". ",
80
- backstory="As an expert YouTube search assistant, you search a YouTube video for the question. ",
81
  allow_delegation=False,
82
  llm=AGENT_MODEL,
83
  max_iter=1,
84
- tools=[youtube_search_tool],
85
  verbose=False
86
  )
87
 
88
  # Tasks
89
 
90
- image_search_task = Task(
91
- agent=image_search_agent,
92
- #description="Search an image for question \"{topic}\". ",
93
- description="{topic} ",
94
- expected_output="Content to help answer the image related question. "
95
  )
96
 
97
  python_coding_task = Task(
98
  agent=python_coding_agent,
99
- #description="Write and execute Python code to solve question \"{topic}\". ",
100
- description="{topic} ",
101
- expected_output="Content to help answer the Phyton coding related question. "
102
  )
103
 
104
- web_search_task = Task(
105
- agent=web_search_agent,
106
- description="Search the web for question \"{topic}\" and scrape the most relevant web page. ",
107
- expected_output="Content to help answer the web related question. "
108
  )
109
 
110
- youtube_search_task = Task(
111
- agent=youtube_search_agent,
112
- description="Search a YouTube video for question \"{topic}\". ",
113
- expected_output="Content to help answer the YouTube related question. "
114
- )
115
 
116
  # Crew
117
 
118
  crew = Crew(
119
- agents=[image_search_agent, python_coding_agent, web_search_agent, youtube_search_agent],
120
  planning=True,
121
  planning_llm=CREW_MODEL,
122
  process=Process.sequential,
123
- tasks=[image_search_task, python_coding_task, web_search_task, youtube_search_task],
124
  verbose=False
125
  )
126
 
 
39
 
40
  # Agents
41
 
42
+ image_analysis_agent = Agent(
43
+ role="Image Analysis Agent",
44
+ goal="Analyze image to help answer question \"{topic}\". ",
45
+ backstory="As an expert image analysis assistant, you analyze the image to help answer the question. ",
 
46
  allow_delegation=False,
47
  llm=AGENT_MODEL,
48
  #max_iter=1,
 
52
 
53
  python_coding_agent = Agent(
54
  role="Python Coding Agent",
55
+ goal="Write and/or execute Python code to help answer question \"{topic}\". ",
56
+ backstory="As an expert Python coding assistant, you write and/or execute Python code to help answer the question. ",
 
57
  allow_delegation=False,
58
  llm=AGENT_MODEL,
59
  max_iter=1,
 
61
  verbose=False,
62
  )
63
 
64
+ video_analysis_agent = Agent(
65
+ role="Vidoe Analysis Agent",
66
+ goal="Analyze video to help answer question \"{topic}\". ",
67
+ backstory="As an expert video analysis assistant, you analyze the video to help answer the question. ",
68
  allow_delegation=False,
69
  llm=AGENT_MODEL,
70
  max_iter=1,
71
+ tools=[youtube_search_tool],
72
  verbose=False
73
  )
74
 
75
+ web_search_agent = Agent(
76
+ role="Web Search Agent",
77
+ goal="Search the web to help answer question \"{topic}\", then scrape the most relevant web page. ",
78
+ backstory="As an expert web search assistant, you search the web to help answer the question. ",
79
  allow_delegation=False,
80
  llm=AGENT_MODEL,
81
  max_iter=1,
82
+ tools=[web_search_tool, web_rag_tool],
83
  verbose=False
84
  )
85
 
86
  # Tasks
87
 
88
+ image_analysis_task = Task(
89
+ agent=image_analysis_agent,
90
+ description="Analyze image to help answer question \"{topic}\". ",
91
+ expected_output="Content to help answer the question. "
 
92
  )
93
 
94
  python_coding_task = Task(
95
  agent=python_coding_agent,
96
+ description="Write and/or execute Python code to help answer question \"{topic}\". ",
97
+ expected_output="Content to help answer the question. "
 
98
  )
99
 
100
+ video_analysis_task = Task(
101
+ agent=video_analysis_agent,
102
+ description="Analyze video to help answer question \"{topic}\". ",
103
+ expected_output="Content to help answer the question. "
104
  )
105
 
106
+ web_search_task = Task(
107
+ agent=web_search_agent,
108
+ description="Search the web to help answer question \"{topic}\", then scrape the most relevant web page. ",
109
+ expected_output="Content to help answer the question. "
110
+ )
111
 
112
  # Crew
113
 
114
  crew = Crew(
115
+ agents=[image_analysis_agent, python_coding_agent, web_search_agent, video_analysis_agent],
116
  planning=True,
117
  planning_llm=CREW_MODEL,
118
  process=Process.sequential,
119
+ tasks=[image_analysis_task, python_coding_task, web_search_task, video_analysis_task],
120
  verbose=False
121
  )
122