Update agents/crew.py
Browse files- agents/crew.py +77 -7
agents/crew.py
CHANGED
|
@@ -75,6 +75,12 @@ class GAIACrew():
|
|
| 75 |
|
| 76 |
@agent
|
| 77 |
def web_search_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
return Agent(
|
| 79 |
config=self.agents_config["web_search_agent"],
|
| 80 |
allow_delegation=False,
|
|
@@ -88,6 +94,12 @@ class GAIACrew():
|
|
| 88 |
|
| 89 |
@agent
|
| 90 |
def web_browser_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
return Agent(
|
| 92 |
config=self.agents_config["web_browser_agent"],
|
| 93 |
allow_delegation=False,
|
|
@@ -101,6 +113,12 @@ class GAIACrew():
|
|
| 101 |
|
| 102 |
@agent
|
| 103 |
def chess_analysis_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
return Agent(
|
| 105 |
config=self.agents_config["chess_analysis_agent"],
|
| 106 |
allow_delegation=False,
|
|
@@ -114,6 +132,12 @@ class GAIACrew():
|
|
| 114 |
|
| 115 |
@agent
|
| 116 |
def image_analysis_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
return Agent(
|
| 118 |
config=self.agents_config["image_analysis_agent"],
|
| 119 |
allow_delegation=False,
|
|
@@ -127,6 +151,12 @@ class GAIACrew():
|
|
| 127 |
|
| 128 |
@agent
|
| 129 |
def audio_analysis_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
return Agent(
|
| 131 |
config=self.agents_config["audio_analysis_agent"],
|
| 132 |
allow_delegation=False,
|
|
@@ -140,6 +170,12 @@ class GAIACrew():
|
|
| 140 |
|
| 141 |
@agent
|
| 142 |
def video_analysis_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
return Agent(
|
| 144 |
config=self.agents_config["video_analysis_agent"],
|
| 145 |
allow_delegation=False,
|
|
@@ -153,6 +189,12 @@ class GAIACrew():
|
|
| 153 |
|
| 154 |
@agent
|
| 155 |
def youtube_analysis_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
return Agent(
|
| 157 |
config=self.agents_config["youtube_analysis_agent"],
|
| 158 |
allow_delegation=False,
|
|
@@ -166,6 +208,12 @@ class GAIACrew():
|
|
| 166 |
|
| 167 |
@agent
|
| 168 |
def document_analysis_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
return Agent(
|
| 170 |
config=self.agents_config["document_analysis_agent"],
|
| 171 |
allow_delegation=False,
|
|
@@ -179,6 +227,12 @@ class GAIACrew():
|
|
| 179 |
|
| 180 |
@agent
|
| 181 |
def arithmetic_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
return Agent(
|
| 183 |
config=self.agents_config["document_analysis_agent"],
|
| 184 |
allow_delegation=False,
|
|
@@ -196,6 +250,12 @@ class GAIACrew():
|
|
| 196 |
|
| 197 |
@agent
|
| 198 |
def code_generation_and_execution_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
return Agent(
|
| 200 |
config=self.agents_config["code_generation_and_execution_agent"],
|
| 201 |
allow_delegation=False,
|
|
@@ -209,6 +269,12 @@ class GAIACrew():
|
|
| 209 |
|
| 210 |
@agent
|
| 211 |
def code_execution_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
return Agent(
|
| 213 |
config=self.agents_config["code_execution_agent"],
|
| 214 |
allow_delegation=False,
|
|
@@ -222,6 +288,12 @@ class GAIACrew():
|
|
| 222 |
|
| 223 |
@agent
|
| 224 |
def manager_agent(self) -> Agent:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
return Agent(
|
| 226 |
config=self.agents_config["manager_agent"],
|
| 227 |
allow_delegation=True,
|
|
@@ -240,6 +312,11 @@ class GAIACrew():
|
|
| 240 |
|
| 241 |
@crew
|
| 242 |
def crew(self) -> Crew:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
return Crew(
|
| 244 |
agents=self.agents,
|
| 245 |
tasks=self.tasks,
|
|
@@ -271,14 +348,7 @@ def run_crew(question, file_path):
|
|
| 271 |
final_question = _get_final_question(question, file_path)
|
| 272 |
|
| 273 |
print(f"π€ Crew execution started")
|
| 274 |
-
print(f"π€ Crew planning: {PLANNING_CREW}")
|
| 275 |
-
print(f"π€ Crew memory: {MEMORY_CREW}")
|
| 276 |
-
print(f"π€ Crew verbose: {VERBOSE_CREW}")
|
| 277 |
-
print(f"π€ Manager verbose: {VERBOSE_MANAGER}")
|
| 278 |
-
print(f"π€ Agent verbose: {VERBOSE_AGENT}")
|
| 279 |
-
|
| 280 |
answer = GAIACrew().crew().kickoff(inputs={"question": final_question})
|
| 281 |
-
|
| 282 |
print(f"π€ Crew execution completed")
|
| 283 |
|
| 284 |
final_answer = AITools.final_answer_tool(question, answer)
|
|
|
|
| 75 |
|
| 76 |
@agent
|
| 77 |
def web_search_agent(self) -> Agent:
|
| 78 |
+
print(f"π€ Web search agent reasoning: {REASONING_AGENT}")
|
| 79 |
+
print(f"π€ Web search agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 80 |
+
print(f"π€ Web search agent max iterations: {MAX_ITER_AGENT}")
|
| 81 |
+
print(f"π€ Web search agent verbose: {VERBOSE_AGENT}")
|
| 82 |
+
print(f"π€ Web search agent LLM: {LLM_AGENT}")
|
| 83 |
+
|
| 84 |
return Agent(
|
| 85 |
config=self.agents_config["web_search_agent"],
|
| 86 |
allow_delegation=False,
|
|
|
|
| 94 |
|
| 95 |
@agent
|
| 96 |
def web_browser_agent(self) -> Agent:
|
| 97 |
+
print(f"π€ Web browser agent reasoning: {REASONING_AGENT}")
|
| 98 |
+
print(f"π€ Web browser agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 99 |
+
print(f"π€ Web browser agent max iterations: {MAX_ITER_AGENT}")
|
| 100 |
+
print(f"π€ Web browser agent verbose: {VERBOSE_AGENT}")
|
| 101 |
+
print(f"π€ Web browser agent LLM: {LLM_AGENT}")
|
| 102 |
+
|
| 103 |
return Agent(
|
| 104 |
config=self.agents_config["web_browser_agent"],
|
| 105 |
allow_delegation=False,
|
|
|
|
| 113 |
|
| 114 |
@agent
|
| 115 |
def chess_analysis_agent(self) -> Agent:
|
| 116 |
+
print(f"π€ Chess analysis agent reasoning: {REASONING_AGENT}")
|
| 117 |
+
print(f"π€ Chess analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 118 |
+
print(f"π€ Chess analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 119 |
+
print(f"π€ Chess analysis agent verbose: {VERBOSE_AGENT}")
|
| 120 |
+
print(f"π€ Chess analysis agent LLM: {LLM_AGENT}")
|
| 121 |
+
|
| 122 |
return Agent(
|
| 123 |
config=self.agents_config["chess_analysis_agent"],
|
| 124 |
allow_delegation=False,
|
|
|
|
| 132 |
|
| 133 |
@agent
|
| 134 |
def image_analysis_agent(self) -> Agent:
|
| 135 |
+
print(f"π€ Image analysis agent reasoning: {REASONING_AGENT}")
|
| 136 |
+
print(f"π€ Image analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 137 |
+
print(f"π€ Image analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 138 |
+
print(f"π€ Image analysis agent verbose: {VERBOSE_AGENT}")
|
| 139 |
+
print(f"π€ Image analysis agent LLM: {LLM_AGENT}")
|
| 140 |
+
|
| 141 |
return Agent(
|
| 142 |
config=self.agents_config["image_analysis_agent"],
|
| 143 |
allow_delegation=False,
|
|
|
|
| 151 |
|
| 152 |
@agent
|
| 153 |
def audio_analysis_agent(self) -> Agent:
|
| 154 |
+
print(f"π€ Audio analysis agent reasoning: {REASONING_AGENT}")
|
| 155 |
+
print(f"π€ Audio analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 156 |
+
print(f"π€ Audio analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 157 |
+
print(f"π€ Audio analysis agent verbose: {VERBOSE_AGENT}")
|
| 158 |
+
print(f"π€ Audio analysis agent LLM: {LLM_AGENT}")
|
| 159 |
+
|
| 160 |
return Agent(
|
| 161 |
config=self.agents_config["audio_analysis_agent"],
|
| 162 |
allow_delegation=False,
|
|
|
|
| 170 |
|
| 171 |
@agent
|
| 172 |
def video_analysis_agent(self) -> Agent:
|
| 173 |
+
print(f"π€ Video analysis agent reasoning: {REASONING_AGENT}")
|
| 174 |
+
print(f"π€ Video analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 175 |
+
print(f"π€ Video analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 176 |
+
print(f"π€ Video analysis agent verbose: {VERBOSE_AGENT}")
|
| 177 |
+
print(f"π€ Video analysis agent LLM: {LLM_AGENT}")
|
| 178 |
+
|
| 179 |
return Agent(
|
| 180 |
config=self.agents_config["video_analysis_agent"],
|
| 181 |
allow_delegation=False,
|
|
|
|
| 189 |
|
| 190 |
@agent
|
| 191 |
def youtube_analysis_agent(self) -> Agent:
|
| 192 |
+
print(f"π€ Youtube analysis agent reasoning: {REASONING_AGENT}")
|
| 193 |
+
print(f"π€ Youtube analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 194 |
+
print(f"π€ Youtube analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 195 |
+
print(f"π€ Youtube analysis agent verbose: {VERBOSE_AGENT}")
|
| 196 |
+
print(f"π€ Youtube analysis agent LLM: {LLM_AGENT}")
|
| 197 |
+
|
| 198 |
return Agent(
|
| 199 |
config=self.agents_config["youtube_analysis_agent"],
|
| 200 |
allow_delegation=False,
|
|
|
|
| 208 |
|
| 209 |
@agent
|
| 210 |
def document_analysis_agent(self) -> Agent:
|
| 211 |
+
print(f"π€ Document analysis agent reasoning: {REASONING_AGENT}")
|
| 212 |
+
print(f"π€ Document analysis agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 213 |
+
print(f"π€ Document analysis agent max iterations: {MAX_ITER_AGENT}")
|
| 214 |
+
print(f"π€ Document analysis agent verbose: {VERBOSE_AGENT}")
|
| 215 |
+
print(f"π€ Document analysis agent LLM: {LLM_AGENT}")
|
| 216 |
+
|
| 217 |
return Agent(
|
| 218 |
config=self.agents_config["document_analysis_agent"],
|
| 219 |
allow_delegation=False,
|
|
|
|
| 227 |
|
| 228 |
@agent
|
| 229 |
def arithmetic_agent(self) -> Agent:
|
| 230 |
+
print(f"π€ Arithmetic agent reasoning: {REASONING_AGENT}")
|
| 231 |
+
print(f"π€ Arithmetic agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 232 |
+
print(f"π€ Arithmetic agent max iterations: {MAX_ITER_AGENT}")
|
| 233 |
+
print(f"π€ Arithmetic agent verbose: {VERBOSE_AGENT}")
|
| 234 |
+
print(f"π€ Arithmetic agent LLM: {LLM_AGENT}")
|
| 235 |
+
|
| 236 |
return Agent(
|
| 237 |
config=self.agents_config["document_analysis_agent"],
|
| 238 |
allow_delegation=False,
|
|
|
|
| 250 |
|
| 251 |
@agent
|
| 252 |
def code_generation_and_execution_agent(self) -> Agent:
|
| 253 |
+
print(f"π€ Code generation and execution agent reasoning: {REASONING_AGENT}")
|
| 254 |
+
print(f"π€ Code generation and execution agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 255 |
+
print(f"π€ Code generation and execution agent max iterations: {MAX_ITER_AGENT}")
|
| 256 |
+
print(f"π€ Code generation and execution agent verbose: {VERBOSE_AGENT}")
|
| 257 |
+
print(f"π€ Code generation and execution agent LLM: {LLM_AGENT}")
|
| 258 |
+
|
| 259 |
return Agent(
|
| 260 |
config=self.agents_config["code_generation_and_execution_agent"],
|
| 261 |
allow_delegation=False,
|
|
|
|
| 269 |
|
| 270 |
@agent
|
| 271 |
def code_execution_agent(self) -> Agent:
|
| 272 |
+
print(f"π€ Code execution agent reasoning: {REASONING_AGENT}")
|
| 273 |
+
print(f"π€ Code execution agent reasoning max attempts: {MAX_REASONING_ATTEMPTS_AGENT}")
|
| 274 |
+
print(f"π€ Code execution agent max iterations: {MAX_ITER_AGENT}")
|
| 275 |
+
print(f"π€ Code execution agent verbose: {VERBOSE_AGENT}")
|
| 276 |
+
print(f"π€ Code execution agent LLM: {LLM_AGENT}")
|
| 277 |
+
|
| 278 |
return Agent(
|
| 279 |
config=self.agents_config["code_execution_agent"],
|
| 280 |
allow_delegation=False,
|
|
|
|
| 288 |
|
| 289 |
@agent
|
| 290 |
def manager_agent(self) -> Agent:
|
| 291 |
+
print(f"π€ Manager reasoning: {REASONING_MANAGER}")
|
| 292 |
+
print(f"π€ Manager reasoning max attempts: {MAX_REASONING_ATTEMPTS_MANAGER}")
|
| 293 |
+
print(f"π€ Manager max iterations: {MAX_ITER_MANAGER}")
|
| 294 |
+
print(f"π€ Manager verbose: {VERBOSE_MANAGER}")
|
| 295 |
+
print(f"π€ Manager LLM: {LLM_MANAGER}")
|
| 296 |
+
|
| 297 |
return Agent(
|
| 298 |
config=self.agents_config["manager_agent"],
|
| 299 |
allow_delegation=True,
|
|
|
|
| 312 |
|
| 313 |
@crew
|
| 314 |
def crew(self) -> Crew:
|
| 315 |
+
print(f"π€ Crew planning: {PLANNING_CREW}")
|
| 316 |
+
print(f"π€ Crew memory: {MEMORY_CREW}")
|
| 317 |
+
print(f"π€ Crew verbose: {VERBOSE_CREW}")
|
| 318 |
+
print(f"π€ Crew planning LLM: {LLM_CREW_PLANNING}")
|
| 319 |
+
|
| 320 |
return Crew(
|
| 321 |
agents=self.agents,
|
| 322 |
tasks=self.tasks,
|
|
|
|
| 348 |
final_question = _get_final_question(question, file_path)
|
| 349 |
|
| 350 |
print(f"π€ Crew execution started")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
answer = GAIACrew().crew().kickoff(inputs={"question": final_question})
|
|
|
|
| 352 |
print(f"π€ Crew execution completed")
|
| 353 |
|
| 354 |
final_answer = AITools.final_answer_tool(question, answer)
|