Update crew.py
Browse files
crew.py
CHANGED
|
@@ -31,27 +31,27 @@ CrewAIInstrumentor().instrument(tracer_provider=tracer_provider)
|
|
| 31 |
def run_crew(question, file_name):
|
| 32 |
# Tools
|
| 33 |
|
|
|
|
| 34 |
python_coding_tool = CodeInterpreterTool()
|
| 35 |
-
image_search_tool = VisionTool()
|
| 36 |
web_search_tool = SerperDevTool()
|
| 37 |
web_rag_tool = WebsiteSearchTool()
|
| 38 |
-
|
| 39 |
|
| 40 |
# Agents
|
| 41 |
|
| 42 |
image_analysis_agent = Agent(
|
| 43 |
-
role="
|
| 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 |
-
|
| 49 |
-
tools=[
|
| 50 |
-
verbose=
|
| 51 |
)
|
| 52 |
|
| 53 |
python_coding_agent = Agent(
|
| 54 |
-
role="
|
| 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,
|
|
@@ -62,18 +62,18 @@ def run_crew(question, file_name):
|
|
| 62 |
)
|
| 63 |
|
| 64 |
video_analysis_agent = Agent(
|
| 65 |
-
role="
|
| 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=[
|
| 72 |
verbose=False
|
| 73 |
)
|
| 74 |
|
| 75 |
web_search_agent = Agent(
|
| 76 |
-
role="
|
| 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,
|
|
@@ -84,18 +84,18 @@ def run_crew(question, file_name):
|
|
| 84 |
)
|
| 85 |
|
| 86 |
manager_agent = Agent(
|
| 87 |
-
role="
|
| 88 |
goal="Try to answer the following question. If needed, delegate to **one** of your coworkers, image_analysis_agent, python_coding_agent, web_search_agent, or video_analysis_agent for help. Question: \"{topic}\" ",
|
| 89 |
backstory="As an expert manager assistant, you answer the question. ",
|
| 90 |
allow_delegation=True,
|
| 91 |
llm=MANAGER_MODEL,
|
| 92 |
max_iter=5,
|
| 93 |
-
tools=[],
|
| 94 |
verbose=True
|
| 95 |
)
|
| 96 |
|
| 97 |
# Tasks
|
| 98 |
|
|
|
|
| 99 |
image_analysis_task = Task(
|
| 100 |
agent=image_analysis_agent,
|
| 101 |
description="Analyze image to help answer question \"{topic}\". ",
|
|
@@ -119,6 +119,7 @@ def run_crew(question, file_name):
|
|
| 119 |
description="Search the web to help answer question \"{topic}\", then scrape the most relevant web page. ",
|
| 120 |
expected_output="Content to help answer the question. "
|
| 121 |
)
|
|
|
|
| 122 |
|
| 123 |
manager_task = Task(
|
| 124 |
agent=manager_agent,
|
|
|
|
| 31 |
def run_crew(question, file_name):
|
| 32 |
# Tools
|
| 33 |
|
| 34 |
+
image_analysis_tool = VisionTool()
|
| 35 |
python_coding_tool = CodeInterpreterTool()
|
|
|
|
| 36 |
web_search_tool = SerperDevTool()
|
| 37 |
web_rag_tool = WebsiteSearchTool()
|
| 38 |
+
video_analysis_tool = YoutubeVideoSearchTool()
|
| 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,
|
| 49 |
+
tools=[image_analysis_tool],
|
| 50 |
+
verbose=False
|
| 51 |
)
|
| 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,
|
|
|
|
| 62 |
)
|
| 63 |
|
| 64 |
video_analysis_agent = Agent(
|
| 65 |
+
role="Video 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=[video_analysis_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,
|
|
|
|
| 84 |
)
|
| 85 |
|
| 86 |
manager_agent = Agent(
|
| 87 |
+
role="Manager Agent",
|
| 88 |
goal="Try to answer the following question. If needed, delegate to **one** of your coworkers, image_analysis_agent, python_coding_agent, web_search_agent, or video_analysis_agent for help. Question: \"{topic}\" ",
|
| 89 |
backstory="As an expert manager assistant, you answer the question. ",
|
| 90 |
allow_delegation=True,
|
| 91 |
llm=MANAGER_MODEL,
|
| 92 |
max_iter=5,
|
|
|
|
| 93 |
verbose=True
|
| 94 |
)
|
| 95 |
|
| 96 |
# Tasks
|
| 97 |
|
| 98 |
+
"""
|
| 99 |
image_analysis_task = Task(
|
| 100 |
agent=image_analysis_agent,
|
| 101 |
description="Analyze image to help answer question \"{topic}\". ",
|
|
|
|
| 119 |
description="Search the web to help answer question \"{topic}\", then scrape the most relevant web page. ",
|
| 120 |
expected_output="Content to help answer the question. "
|
| 121 |
)
|
| 122 |
+
"""
|
| 123 |
|
| 124 |
manager_task = Task(
|
| 125 |
agent=manager_agent,
|