Update crew.py
Browse files
crew.py
CHANGED
@@ -41,8 +41,8 @@ def run_crew(question, file_name):
|
|
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=3,
|
@@ -52,8 +52,8 @@ def run_crew(question, file_name):
|
|
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=5,
|
@@ -63,8 +63,8 @@ def run_crew(question, file_name):
|
|
63 |
|
64 |
web_search_agent = Agent(
|
65 |
role="Web Search Agent",
|
66 |
-
goal="Search the web to help answer question \"{topic}\", then scrape the most relevant web page.
|
67 |
-
backstory="As an expert web search assistant, you search the web to help answer the question.
|
68 |
allow_delegation=False,
|
69 |
llm=AGENT_MODEL,
|
70 |
max_iter=3,
|
@@ -74,8 +74,8 @@ def run_crew(question, file_name):
|
|
74 |
|
75 |
youtube_analysis_agent = Agent(
|
76 |
role="YouTube Analysis Agent",
|
77 |
-
goal="Analyze YouTube video to help answer question \"{topic}\"
|
78 |
-
backstory="As an expert YouTube video analysis assistant, you analyze the video to help answer the question.
|
79 |
allow_delegation=False,
|
80 |
llm=AGENT_MODEL,
|
81 |
max_iter=3,
|
@@ -87,8 +87,8 @@ def run_crew(question, file_name):
|
|
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 YouTube Analysis Agent for help. "
|
89 |
"If there is no good coworker, delegate to the Python Coding Agent to implement a tool for the task. "
|
90 |
-
"Question: \"{topic}\"
|
91 |
-
backstory="As an expert manager assistant, you answer the question.
|
92 |
allow_delegation=True,
|
93 |
llm=MANAGER_MODEL,
|
94 |
max_iter=5,
|
@@ -99,8 +99,8 @@ def run_crew(question, file_name):
|
|
99 |
|
100 |
manager_task = Task(
|
101 |
agent=manager_agent,
|
102 |
-
description="Try to answer the following question. If needed, delegate to **one** of your coworkers, Image Analysis Agent, Python Coding Agent, Web Search Agent, or YouTube Analysis Agent for help. Question: \"{topic}\"
|
103 |
-
expected_output="The answer to the question.
|
104 |
)
|
105 |
|
106 |
# Crew
|
@@ -115,8 +115,8 @@ def run_crew(question, file_name):
|
|
115 |
# Processing
|
116 |
|
117 |
if file_name:
|
118 |
-
question = f"{question} File name: data/{file_name}.
|
119 |
-
if file_name.endswith(".py"):
|
120 |
with open(f"data/{file_name}", "r") as file:
|
121 |
question = f"{question} File data:\n{file.read()}"
|
122 |
|
|
|
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=3,
|
|
|
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=5,
|
|
|
63 |
|
64 |
web_search_agent = Agent(
|
65 |
role="Web Search Agent",
|
66 |
+
goal="Search the web to help answer question \"{topic}\", then scrape the most relevant web page.",
|
67 |
+
backstory="As an expert web search assistant, you search the web to help answer the question.",
|
68 |
allow_delegation=False,
|
69 |
llm=AGENT_MODEL,
|
70 |
max_iter=3,
|
|
|
74 |
|
75 |
youtube_analysis_agent = Agent(
|
76 |
role="YouTube Analysis Agent",
|
77 |
+
goal="Analyze YouTube video to help answer question \"{topic}\"",
|
78 |
+
backstory="As an expert YouTube video analysis assistant, you analyze the video to help answer the question.",
|
79 |
allow_delegation=False,
|
80 |
llm=AGENT_MODEL,
|
81 |
max_iter=3,
|
|
|
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 YouTube Analysis Agent for help. "
|
89 |
"If there is no good coworker, delegate to the Python Coding Agent to implement a tool for the task. "
|
90 |
+
"Question: \"{topic}\"",
|
91 |
+
backstory="As an expert manager assistant, you answer the question.",
|
92 |
allow_delegation=True,
|
93 |
llm=MANAGER_MODEL,
|
94 |
max_iter=5,
|
|
|
99 |
|
100 |
manager_task = Task(
|
101 |
agent=manager_agent,
|
102 |
+
description="Try to answer the following question. If needed, delegate to **one** of your coworkers, Image Analysis Agent, Python Coding Agent, Web Search Agent, or YouTube Analysis Agent for help. Question: \"{topic}\"",
|
103 |
+
expected_output="The answer to the question."
|
104 |
)
|
105 |
|
106 |
# Crew
|
|
|
115 |
# Processing
|
116 |
|
117 |
if file_name:
|
118 |
+
question = f"{question} File name: data/{file_name}."
|
119 |
+
if file_name.endswith(".py") or file_name.endswith(".xlsx"):
|
120 |
with open(f"data/{file_name}", "r") as file:
|
121 |
question = f"{question} File data:\n{file.read()}"
|
122 |
|