Update crew.py
Browse files
crew.py
CHANGED
|
@@ -39,11 +39,10 @@ def run_crew(question, file_name):
|
|
| 39 |
|
| 40 |
# Agents
|
| 41 |
|
| 42 |
-
|
| 43 |
-
role="Image
|
| 44 |
-
|
| 45 |
-
|
| 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 |
-
|
| 57 |
-
|
| 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 |
-
|
| 67 |
-
role="
|
| 68 |
-
goal="
|
| 69 |
-
backstory="As an expert
|
| 70 |
allow_delegation=False,
|
| 71 |
llm=AGENT_MODEL,
|
| 72 |
max_iter=1,
|
| 73 |
-
tools=[
|
| 74 |
verbose=False
|
| 75 |
)
|
| 76 |
|
| 77 |
-
|
| 78 |
-
role="
|
| 79 |
-
goal="Search
|
| 80 |
-
backstory="As an expert
|
| 81 |
allow_delegation=False,
|
| 82 |
llm=AGENT_MODEL,
|
| 83 |
max_iter=1,
|
| 84 |
-
tools=[
|
| 85 |
verbose=False
|
| 86 |
)
|
| 87 |
|
| 88 |
# Tasks
|
| 89 |
|
| 90 |
-
|
| 91 |
-
agent=
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
expected_output="Content to help answer the image related question. "
|
| 95 |
)
|
| 96 |
|
| 97 |
python_coding_task = Task(
|
| 98 |
agent=python_coding_agent,
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
expected_output="Content to help answer the Phyton coding related question. "
|
| 102 |
)
|
| 103 |
|
| 104 |
-
|
| 105 |
-
agent=
|
| 106 |
-
description="
|
| 107 |
-
expected_output="Content to help answer the
|
| 108 |
)
|
| 109 |
|
| 110 |
-
|
| 111 |
-
agent=
|
| 112 |
-
description="Search
|
| 113 |
-
expected_output="Content to help answer the
|
| 114 |
-
)
|
| 115 |
|
| 116 |
# Crew
|
| 117 |
|
| 118 |
crew = Crew(
|
| 119 |
-
agents=[
|
| 120 |
planning=True,
|
| 121 |
planning_llm=CREW_MODEL,
|
| 122 |
process=Process.sequential,
|
| 123 |
-
tasks=[
|
| 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 |
|