bstraehle commited on
Commit
0282890
·
verified ·
1 Parent(s): e080246

Update crew.py

Browse files
Files changed (1) hide show
  1. crew.py +123 -123
crew.py CHANGED
@@ -52,129 +52,6 @@ tracer_provider = register(
52
  class GAIACrew():
53
  agents: List[BaseAgent]
54
  tasks: List[Task]
55
-
56
- @agent
57
- def web_search_agent(self) -> Agent:
58
- return Agent(
59
- config=self.agents_config["web_search_agent"],
60
- allow_delegation=False,
61
- llm=AGENT_MODEL,
62
- max_iter=2,
63
- tools=[web_search_tool],
64
- verbose=True
65
- )
66
-
67
- @agent
68
- def image_analysis_agent(self) -> Agent:
69
- return Agent(
70
- config=self.agents_config["image_analysis_agent"],
71
- allow_delegation=False,
72
- llm=AGENT_MODEL,
73
- max_iter=2,
74
- tools=[image_analysis_tool],
75
- verbose=True
76
- )
77
-
78
- @agent
79
- def audio_analysis_agent(self) -> Agent:
80
- return Agent(
81
- config=self.agents_config["audio_analysis_agent"],
82
- allow_delegation=False,
83
- llm=AGENT_MODEL,
84
- max_iter=2,
85
- tools=[audio_analysis_tool],
86
- verbose=True
87
- )
88
-
89
- @agent
90
- def video_analysis_agent(self) -> Agent:
91
- return Agent(
92
- config=self.agents_config["video_analysis_agent"],
93
- allow_delegation=False,
94
- llm=AGENT_MODEL,
95
- max_iter=2,
96
- tools=[video_analysis_tool],
97
- verbose=True
98
- )
99
-
100
- @agent
101
- def youtube_analysis_agent(self) -> Agent:
102
- return Agent(
103
- config=self.agents_config["youtube_analysis_agent"],
104
- allow_delegation=False,
105
- llm=AGENT_MODEL,
106
- max_iter=2,
107
- tools=[youtube_analysis_tool],
108
- verbose=True
109
- )
110
-
111
- @agent
112
- def document_analysis_agent(self) -> Agent:
113
- return Agent(
114
- config=self.agents_config["document_analysis_agent"],
115
- allow_delegation=False,
116
- llm=AGENT_MODEL,
117
- max_iter=2,
118
- tools=[document_analysis_tool],
119
- verbose=True
120
- )
121
-
122
- @agent
123
- def document_analysis_agent(self) -> Agent:
124
- return Agent(
125
- config=self.agents_config["document_analysis_agent"],
126
- allow_delegation=False,
127
- llm=AGENT_MODEL,
128
- max_iter=2,
129
- tools=[arithmetic_tool],
130
- verbose=True
131
- )
132
-
133
- @agent
134
- def code_execution_agent(self) -> Agent:
135
- return Agent(
136
- config=self.agents_config["code_execution_agent"],
137
- allow_delegation=False,
138
- llm=AGENT_MODEL,
139
- max_iter=3,
140
- tools=[code_execution_tool],
141
- verbose=True
142
- )
143
-
144
- @agent
145
- def code_generation_agent(self) -> Agent:
146
- return Agent(
147
- config=self.agents_config["code_generation_agent"],
148
- allow_delegation=False,
149
- llm=AGENT_MODEL,
150
- max_iter=3,
151
- tools=[code_generation_tool],
152
- verbose=True
153
- )
154
-
155
- @agent
156
- def manager_agent(self) -> Agent:
157
- return Agent(
158
- config=self.agents_config["manager_agent"],
159
- allow_delegation=True,
160
- llm=MANAGER_MODEL,
161
- max_iter=5,
162
- verbose=True
163
- )
164
-
165
- @task
166
- def manager_task(self) -> Task:
167
- return Task(
168
- config=self.tasks_config["manager_task"]
169
- )
170
-
171
- @crew
172
- def crew(self) -> Crew:
173
- return Crew(
174
- agents=self.agents,
175
- tasks=self.tasks,
176
- verbose=True
177
- )
178
 
179
  @tool("Web Search Tool")
180
  def web_search_tool(question: str) -> str:
@@ -438,6 +315,129 @@ class GAIACrew():
438
  except Exception as e:
439
  raise RuntimeError(f"Processing failed: {str(e)}")
440
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  def run_crew(question, file_path):
442
  final_question = question
443
 
 
52
  class GAIACrew():
53
  agents: List[BaseAgent]
54
  tasks: List[Task]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
  @tool("Web Search Tool")
57
  def web_search_tool(question: str) -> str:
 
315
  except Exception as e:
316
  raise RuntimeError(f"Processing failed: {str(e)}")
317
 
318
+ @agent
319
+ def web_search_agent(self) -> Agent:
320
+ return Agent(
321
+ config=self.agents_config["web_search_agent"],
322
+ allow_delegation=False,
323
+ llm=AGENT_MODEL,
324
+ max_iter=2,
325
+ tools=[web_search_tool],
326
+ verbose=True
327
+ )
328
+
329
+ @agent
330
+ def image_analysis_agent(self) -> Agent:
331
+ return Agent(
332
+ config=self.agents_config["image_analysis_agent"],
333
+ allow_delegation=False,
334
+ llm=AGENT_MODEL,
335
+ max_iter=2,
336
+ tools=[image_analysis_tool],
337
+ verbose=True
338
+ )
339
+
340
+ @agent
341
+ def audio_analysis_agent(self) -> Agent:
342
+ return Agent(
343
+ config=self.agents_config["audio_analysis_agent"],
344
+ allow_delegation=False,
345
+ llm=AGENT_MODEL,
346
+ max_iter=2,
347
+ tools=[audio_analysis_tool],
348
+ verbose=True
349
+ )
350
+
351
+ @agent
352
+ def video_analysis_agent(self) -> Agent:
353
+ return Agent(
354
+ config=self.agents_config["video_analysis_agent"],
355
+ allow_delegation=False,
356
+ llm=AGENT_MODEL,
357
+ max_iter=2,
358
+ tools=[video_analysis_tool],
359
+ verbose=True
360
+ )
361
+
362
+ @agent
363
+ def youtube_analysis_agent(self) -> Agent:
364
+ return Agent(
365
+ config=self.agents_config["youtube_analysis_agent"],
366
+ allow_delegation=False,
367
+ llm=AGENT_MODEL,
368
+ max_iter=2,
369
+ tools=[youtube_analysis_tool],
370
+ verbose=True
371
+ )
372
+
373
+ @agent
374
+ def document_analysis_agent(self) -> Agent:
375
+ return Agent(
376
+ config=self.agents_config["document_analysis_agent"],
377
+ allow_delegation=False,
378
+ llm=AGENT_MODEL,
379
+ max_iter=2,
380
+ tools=[document_analysis_tool],
381
+ verbose=True
382
+ )
383
+
384
+ @agent
385
+ def document_analysis_agent(self) -> Agent:
386
+ return Agent(
387
+ config=self.agents_config["document_analysis_agent"],
388
+ allow_delegation=False,
389
+ llm=AGENT_MODEL,
390
+ max_iter=2,
391
+ tools=[arithmetic_tool],
392
+ verbose=True
393
+ )
394
+
395
+ @agent
396
+ def code_execution_agent(self) -> Agent:
397
+ return Agent(
398
+ config=self.agents_config["code_execution_agent"],
399
+ allow_delegation=False,
400
+ llm=AGENT_MODEL,
401
+ max_iter=3,
402
+ tools=[code_execution_tool],
403
+ verbose=True
404
+ )
405
+
406
+ @agent
407
+ def code_generation_agent(self) -> Agent:
408
+ return Agent(
409
+ config=self.agents_config["code_generation_agent"],
410
+ allow_delegation=False,
411
+ llm=AGENT_MODEL,
412
+ max_iter=3,
413
+ tools=[code_generation_tool],
414
+ verbose=True
415
+ )
416
+
417
+ @agent
418
+ def manager_agent(self) -> Agent:
419
+ return Agent(
420
+ config=self.agents_config["manager_agent"],
421
+ allow_delegation=True,
422
+ llm=MANAGER_MODEL,
423
+ max_iter=5,
424
+ verbose=True
425
+ )
426
+
427
+ @task
428
+ def manager_task(self) -> Task:
429
+ return Task(
430
+ config=self.tasks_config["manager_task"]
431
+ )
432
+
433
+ @crew
434
+ def crew(self) -> Crew:
435
+ return Crew(
436
+ agents=self.agents,
437
+ tasks=self.tasks,
438
+ verbose=True
439
+ )
440
+
441
  def run_crew(question, file_path):
442
  final_question = question
443