Update crew.py
Browse files
crew.py
CHANGED
@@ -13,7 +13,7 @@ from openinference.instrumentation.crewai import CrewAIInstrumentor
|
|
13 |
from phoenix.otel import register
|
14 |
from util import get_final_answer
|
15 |
|
16 |
-
|
17 |
AGENT_MODEL = "gpt-4.5-preview"
|
18 |
|
19 |
PHOENIX_API_KEY = os.environ["PHOENIX_API_KEY"]
|
@@ -83,6 +83,13 @@ def run_crew(question, file_name):
|
|
83 |
verbose=False
|
84 |
)
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
# Tasks
|
87 |
|
88 |
image_analysis_task = Task(
|
@@ -107,17 +114,25 @@ def run_crew(question, file_name):
|
|
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 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
121 |
)
|
122 |
|
123 |
if file_name:
|
|
|
13 |
from phoenix.otel import register
|
14 |
from util import get_final_answer
|
15 |
|
16 |
+
MANAGER_MODEL = "gpt-4.5-preview"
|
17 |
AGENT_MODEL = "gpt-4.5-preview"
|
18 |
|
19 |
PHOENIX_API_KEY = os.environ["PHOENIX_API_KEY"]
|
|
|
83 |
verbose=False
|
84 |
)
|
85 |
|
86 |
+
manager_agent = Agent(
|
87 |
+
role="Manager",
|
88 |
+
goal="Select one of your agents to answer question \"{topic}\" ",
|
89 |
+
backstory="As an expert manager assistant, you select one of your agents to answer the question. ",
|
90 |
+
allow_delegation=True,
|
91 |
+
)
|
92 |
+
|
93 |
# Tasks
|
94 |
|
95 |
image_analysis_task = Task(
|
|
|
114 |
agent=web_search_agent,
|
115 |
description="Search the web to help answer question \"{topic}\", then scrape the most relevant web page. ",
|
116 |
expected_output="Content to help answer the question. "
|
117 |
+
)
|
118 |
|
119 |
+
manager_task = Task(
|
120 |
+
agent=manager_agent,
|
121 |
+
description="Select one of your agents to answer question \"{topic}\" ",
|
122 |
+
expected_output="The answer to the question. "
|
123 |
+
)
|
124 |
+
|
125 |
# Crew
|
126 |
|
127 |
crew = Crew(
|
128 |
agents=[image_analysis_agent, python_coding_agent, web_search_agent, video_analysis_agent],
|
129 |
+
#planning=True,
|
130 |
+
manager_agent=manager_agent,
|
131 |
+
manager_llm=MANAGER_MODEL,
|
132 |
+
process=Process.hierarchical,
|
133 |
+
#tasks=[image_analysis_task, python_coding_task, web_search_task, video_analysis_task],
|
134 |
+
tasks=[manager_task],
|
135 |
+
verbose=True
|
136 |
)
|
137 |
|
138 |
if file_name:
|