bstraehle commited on
Commit
15ce3a3
Β·
verified Β·
1 Parent(s): 2e1beaf

Upload crew.py

Browse files
Files changed (1) hide show
  1. agents/crew.py +40 -2
agents/crew.py CHANGED
@@ -35,7 +35,7 @@ FirstTimeTraceHandler._show_tracing_declined_message = _noop
35
 
36
  # Configuration
37
 
38
- PLANNING_CREW = False
39
  MEMORY_CREW = False
40
  VERBOSE_CREW = False
41
 
@@ -68,6 +68,14 @@ tracer_provider = register(
68
  logging.getLogger("openinference").setLevel(logging.CRITICAL)
69
  logging.getLogger("opentelemetry").setLevel(logging.CRITICAL)
70
 
 
 
 
 
 
 
 
 
71
  @CrewBase
72
  class GAIACrew():
73
  agents: List[BaseAgent]
@@ -75,6 +83,8 @@ 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 +98,8 @@ 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,8 @@ 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 +128,8 @@ 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 +143,8 @@ 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 +158,8 @@ 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 +173,8 @@ 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 +188,8 @@ 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 +203,8 @@ 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 +222,8 @@ 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 +237,8 @@ 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 +252,8 @@ 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 +272,12 @@ class GAIACrew():
240
 
241
  @crew
242
  def crew(self) -> Crew:
 
 
 
 
 
 
243
  return Crew(
244
  agents=self.agents,
245
  tasks=self.tasks,
@@ -265,8 +303,8 @@ def _get_final_question(question, file_path):
265
 
266
  def run_crew(question, file_path):
267
  print("")
268
-
269
  print(f"πŸ€– Question: {question}")
 
270
 
271
  final_question = _get_final_question(question, file_path)
272
 
 
35
 
36
  # Configuration
37
 
38
+ PLANNING_CREW = True
39
  MEMORY_CREW = False
40
  VERBOSE_CREW = False
41
 
 
68
  logging.getLogger("openinference").setLevel(logging.CRITICAL)
69
  logging.getLogger("opentelemetry").setLevel(logging.CRITICAL)
70
 
71
+ def _print_agent_config(agent_name: str, reasoning: bool, max_reasoning_attempts: int, max_iter: int, verbose: bool, llm):
72
+ print("")
73
+ print(f"πŸ€– {agent_name} reasoning: {reasoning}")
74
+ print(f"πŸ€– {agent_name} reasoning max attempts: {max_reasoning_attempts}")
75
+ print(f"πŸ€– {agent_name} max iterations: {max_iter}")
76
+ print(f"πŸ€– {agent_name} verbose: {verbose}")
77
+ print(f"πŸ€– {agent_name} LLM: {llm}")
78
+
79
  @CrewBase
80
  class GAIACrew():
81
  agents: List[BaseAgent]
 
83
 
84
  @agent
85
  def web_search_agent(self) -> Agent:
86
+ _print_agent_config("Web search agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
87
+
88
  return Agent(
89
  config=self.agents_config["web_search_agent"],
90
  allow_delegation=False,
 
98
 
99
  @agent
100
  def web_browser_agent(self) -> Agent:
101
+ _print_agent_config("Web browser agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, 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_agent_config("Chess analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
117
+
118
  return Agent(
119
  config=self.agents_config["chess_analysis_agent"],
120
  allow_delegation=False,
 
128
 
129
  @agent
130
  def image_analysis_agent(self) -> Agent:
131
+ _print_agent_config("Image analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
132
+
133
  return Agent(
134
  config=self.agents_config["image_analysis_agent"],
135
  allow_delegation=False,
 
143
 
144
  @agent
145
  def audio_analysis_agent(self) -> Agent:
146
+ _print_agent_config("Audio analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
147
+
148
  return Agent(
149
  config=self.agents_config["audio_analysis_agent"],
150
  allow_delegation=False,
 
158
 
159
  @agent
160
  def video_analysis_agent(self) -> Agent:
161
+ _print_agent_config("Video analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
162
+
163
  return Agent(
164
  config=self.agents_config["video_analysis_agent"],
165
  allow_delegation=False,
 
173
 
174
  @agent
175
  def youtube_analysis_agent(self) -> Agent:
176
+ _print_agent_config("Youtube analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
177
+
178
  return Agent(
179
  config=self.agents_config["youtube_analysis_agent"],
180
  allow_delegation=False,
 
188
 
189
  @agent
190
  def document_analysis_agent(self) -> Agent:
191
+ _print_agent_config("Document analysis agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
192
+
193
  return Agent(
194
  config=self.agents_config["document_analysis_agent"],
195
  allow_delegation=False,
 
203
 
204
  @agent
205
  def arithmetic_agent(self) -> Agent:
206
+ _print_agent_config("Arithmetic agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
207
+
208
  return Agent(
209
  config=self.agents_config["document_analysis_agent"],
210
  allow_delegation=False,
 
222
 
223
  @agent
224
  def code_generation_and_execution_agent(self) -> Agent:
225
+ _print_agent_config("Code generation and execution agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
226
+
227
  return Agent(
228
  config=self.agents_config["code_generation_and_execution_agent"],
229
  allow_delegation=False,
 
237
 
238
  @agent
239
  def code_execution_agent(self) -> Agent:
240
+ _print_agent_config("Code execution agent", REASONING_AGENT, MAX_REASONING_ATTEMPTS_AGENT, MAX_ITER_AGENT, VERBOSE_AGENT, LLM_AGENT)
241
+
242
  return Agent(
243
  config=self.agents_config["code_execution_agent"],
244
  allow_delegation=False,
 
252
 
253
  @agent
254
  def manager_agent(self) -> Agent:
255
+ _print_agent_config("Manager", REASONING_MANAGER, MAX_REASONING_ATTEMPTS_MANAGER, MAX_ITER_MANAGER, VERBOSE_MANAGER, LLM_MANAGER)
256
+
257
  return Agent(
258
  config=self.agents_config["manager_agent"],
259
  allow_delegation=True,
 
272
 
273
  @crew
274
  def crew(self) -> Crew:
275
+ print("")
276
+ print(f"πŸ€– Crew planning: {PLANNING_CREW}")
277
+ print(f"πŸ€– Crew memory: {MEMORY_CREW}")
278
+ print(f"πŸ€– Crew verbose: {VERBOSE_CREW}")
279
+ print(f"πŸ€– Crew planning LLM: {LLM_CREW_PLANNING}")
280
+
281
  return Crew(
282
  agents=self.agents,
283
  tasks=self.tasks,
 
303
 
304
  def run_crew(question, file_path):
305
  print("")
 
306
  print(f"πŸ€– Question: {question}")
307
+ print("")
308
 
309
  final_question = _get_final_question(question, file_path)
310