24Arys11 commited on
Commit
e3e865e
·
1 Parent(s): 851947c

Reduced duplicate code by adding 'itf_agent'

Browse files
Files changed (3) hide show
  1. itf_agent.py +99 -0
  2. management.py +4 -4
  3. solver.py +77 -359
itf_agent.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from llama_index.core.workflow import Context
2
+
3
+
4
+ import os
5
+ from typing import List
6
+
7
+ from args import LLMInterface
8
+ from llm_factory import LLMFactory
9
+ from llama_index.core.agent.workflow import AgentWorkflow
10
+
11
+
12
+ class IAgent():
13
+ def __init__(self, temperature, max_tokens, sys_prompt_file, llm_itf: LLMInterface):
14
+ self.temperature, self.max_tokens = temperature, max_tokens
15
+ # Load the system prompt from a file
16
+ system_prompt_path = os.path.join(os.getcwd(), "system_prompts", sys_prompt_file)
17
+ self.system_prompt = ""
18
+ with open(system_prompt_path, "r") as file:
19
+ self.system_prompt = file.read().strip()
20
+ # Initialize the tool agents
21
+ self.tools = self.setup_tools()
22
+ self.slaves: List[IAgent] = self.setup_slaves()
23
+ # Define the LLM and agent
24
+ self.llm = LLMFactory.create(llm_itf, self.system_prompt, temperature, max_tokens)
25
+ self.agent = self._setup_agent()
26
+ self.ctx = Context(self.agent)
27
+
28
+ def setup_tools(self) -> List:
29
+ """
30
+ Abstract method to set up the tools.
31
+ This method must be overridden by subclasses to define custom tools this agent can use.
32
+ """
33
+ raise NotImplementedError("Subclasses must implement the setup_tools method.")
34
+
35
+ def setup_slaves(self) -> List:
36
+ """
37
+ Abstract method to set up the slave agents.
38
+ This method must be overridden by subclasses to define custom sub-agents this agent can use.
39
+ """
40
+ raise NotImplementedError("Subclasses must implement the setup_slaves method.")
41
+
42
+ def _setup_agent(self) -> AgentWorkflow:
43
+ """
44
+ Initializes and returns an agent workflow based on the presence of tools and slaves.
45
+ If both `self.tools` and `self.slaves` are empty, it sets up a default agent using the provided language model (`self.llm`).
46
+ Otherwise, it creates an agent workflow using the combined list of tools and slaves with the language model.
47
+ Returns:
48
+ AgentWorkflow: An instance of the agent workflow configured with the appropriate tools and language model.
49
+ """
50
+ if not self.tools and not self.slaves:
51
+ return AgentWorkflow.setup_agent(llm=self.llm)
52
+
53
+ # Create tools from slaves: each tool calls slave.query(question) asynchronously
54
+ slave_tools = []
55
+ for slave in self.slaves:
56
+ slave_tools.append(slave.query)
57
+
58
+ self.tools.extend(slave_tools)
59
+
60
+ return AgentWorkflow.from_tools_or_functions(
61
+ self.tools,
62
+ llm=self.llm
63
+ )
64
+
65
+ def get_system_prompt(self) -> str:
66
+ """
67
+ Retrieves the system prompt.
68
+
69
+ Returns:
70
+ str: The system prompt string.
71
+ """
72
+ return self.system_prompt
73
+
74
+ async def query(self, question: str) -> str:
75
+ """
76
+ Asynchronously queries the agent with a given question and returns the response.
77
+
78
+ Args:
79
+ question (str): The question to be sent to the agent.
80
+
81
+ Returns:
82
+ str: The response from the agent as a string.
83
+ """
84
+ response = await self.agent.run(question, ctx=self.ctx)
85
+ response = str(response)
86
+ return response
87
+
88
+ def clear_context(self):
89
+ """
90
+ Clears the current context of the agent, resetting any conversation history.
91
+ This is useful when starting a new conversation or when the context needs to be refreshed.
92
+ """
93
+ self.ctx = Context(self.agent)
94
+
95
+ if not self.slaves:
96
+ return
97
+
98
+ for slave in self.slaves:
99
+ slave.clear_context()
management.py CHANGED
@@ -72,18 +72,18 @@ class Manager:
72
  self.solver = Solver(temperature, max_tokens)
73
  self.summarizer = Summarizer(temperature, max_tokens)
74
 
75
- async def query(self, question: str, remember = True) -> str:
76
  """
77
  Process a question using the manager agent and return a response.
78
 
79
  Args:
80
  question: The question or task to process
81
- remember: Whether to maintain context between queries (default: True)
82
 
83
  Returns:
84
  The agent's response as a string
85
  """
86
- if remember:
87
  response = await self.agent.run(question, ctx=self.ctx)
88
  else:
89
  response = await self.agent.run(question)
@@ -117,7 +117,7 @@ class Manager:
117
  observation = ""
118
  if self.current_depth < self.max_depth:
119
  for task in tasks:
120
- solution = await self.query(task, remember=False)
121
  response = f"For task:\n\n{task}\n\nThe following break up has been provided:\n\n{solution}\n\n"
122
  observation += response
123
  elif try_solving:
 
72
  self.solver = Solver(temperature, max_tokens)
73
  self.summarizer = Summarizer(temperature, max_tokens)
74
 
75
+ async def query(self, question: str, has_context = True) -> str:
76
  """
77
  Process a question using the manager agent and return a response.
78
 
79
  Args:
80
  question: The question or task to process
81
+ has_context: Whether to maintain context between queries (default: True)
82
 
83
  Returns:
84
  The agent's response as a string
85
  """
86
+ if has_context:
87
  response = await self.agent.run(question, ctx=self.ctx)
88
  else:
89
  response = await self.agent.run(question)
 
117
  observation = ""
118
  if self.current_depth < self.max_depth:
119
  for task in tasks:
120
+ solution = await self.query(task, has_context=False)
121
  response = f"For task:\n\n{task}\n\nThe following break up has been provided:\n\n{solution}\n\n"
122
  observation += response
123
  elif try_solving:
solver.py CHANGED
@@ -1,413 +1,131 @@
1
- from llama_index.core.agent.workflow import AgentWorkflow
2
- from llama_index.core.tools import FunctionTool
3
- from llama_index.core.workflow import Context
4
 
5
- import asyncio
6
- import os
7
-
8
- from llm_factory import LLMFactory
9
  from toolbox import Toolbox
10
  from args import Args
11
 
12
 
13
- class Summarizer:
14
  def __init__(self, temperature, max_tokens):
15
- # Load the system prompt from a file
16
- system_prompt_path = os.path.join(os.getcwd(), "system_prompts", "04_summarizer.txt")
17
- self.system_prompt = ""
18
- with open(system_prompt_path, "r") as file:
19
- self.system_prompt = file.read().strip()
20
- # Define the LLM and agent
21
- llm = LLMFactory.create(Args.primary_llm_interface, self.system_prompt, temperature, max_tokens)
22
- self.agent = AgentWorkflow.setup_agent(llm=llm)
23
- self.ctx = Context(self.agent)
24
-
25
- def get_system_prompt(self) -> str:
26
- """
27
- Retrieves the system prompt.
28
-
29
- Returns:
30
- str: The system prompt string.
31
- """
32
- return self.system_prompt
33
 
34
- async def query(self, question: str) -> str:
35
  """
36
- Asynchronously queries the agent with a given question and returns the response.
37
-
38
- Args:
39
- question (str): The question to be sent to the agent.
40
-
41
- Returns:
42
- str: The response from the agent as a string.
43
  """
44
- response = await self.agent.run(question, ctx=self.ctx)
45
- response = str(response)
46
- return response
47
 
48
- def clear_context(self):
49
  """
50
- Clears the current context of the agent, resetting any conversation history.
51
- This is useful when starting a new conversation or when the context needs to be refreshed.
52
  """
53
- self.ctx = Context(self.agent)
54
 
55
 
56
- class Researcher:
57
  def __init__(self, temperature, max_tokens):
58
- # Load the system prompt from a file
59
- system_prompt_path = os.path.join(os.getcwd(), "system_prompts", "05_researcher.txt")
60
- self.system_prompt = ""
61
- with open(system_prompt_path, "r") as file:
62
- self.system_prompt = file.read().strip()
63
- # Define the LLM and agent
64
- llm = LLMFactory.create(Args.primary_llm_interface, self.system_prompt, temperature, max_tokens)
65
- self.agent = AgentWorkflow.from_tools_or_functions(
66
- Toolbox.web_search.duck_duck_go_tools,
67
- llm=llm
68
- )
69
- self.ctx = Context(self.agent)
70
-
71
- def get_system_prompt(self) -> str:
72
- """
73
- Retrieves the system prompt.
74
-
75
- Returns:
76
- str: The system prompt string.
77
- """
78
- return self.system_prompt
79
-
80
- async def query(self, question: str) -> str:
81
- """
82
- Asynchronously queries the agent with a given question and returns the response.
83
-
84
- Args:
85
- question (str): The question to be sent to the agent.
86
 
87
- Returns:
88
- str: The response from the agent as a string.
89
- """
90
- response = await self.agent.run(question, ctx=self.ctx)
91
- response = str(response)
92
- return response
93
 
94
- def clear_context(self):
95
- """
96
- Clears the current context of the agent, resetting any conversation history.
97
- This is useful when starting a new conversation or when the context needs to be refreshed.
98
- """
99
- self.ctx = Context(self.agent)
100
 
101
 
102
- class EncryptionExpert:
103
  def __init__(self, temperature, max_tokens):
104
- # Load the system prompt from a file
105
- system_prompt_path = os.path.join(os.getcwd(), "system_prompts", "06_encryption_expert.txt")
106
- self.system_prompt = ""
107
- with open(system_prompt_path, "r") as file:
108
- self.system_prompt = file.read().strip()
109
- # Define the LLM and agent
110
- llm = LLMFactory.create(Args.primary_llm_interface, self.system_prompt, temperature, max_tokens)
111
- self.agent = AgentWorkflow.from_tools_or_functions(
112
- [
113
  Toolbox.encryption.base64_encode,
114
  Toolbox.encryption.base64_decode,
115
  Toolbox.encryption.caesar_cipher_encode,
116
  Toolbox.encryption.caesar_cipher_decode,
117
  Toolbox.encryption.reverse_string
118
  # TODO: Add more encryption tools
119
- ],
120
- llm=llm
121
- )
122
- self.ctx = Context(self.agent)
123
- # Initialize the tool agents
124
- self.math_expert = MathExpert(temperature, max_tokens)
125
- self.reasoner = Reasoner(temperature, max_tokens)
126
-
127
- def get_system_prompt(self) -> str:
128
- """
129
- Retrieves the system prompt.
130
-
131
- Returns:
132
- str: The system prompt string.
133
- """
134
- return self.system_prompt
135
-
136
- async def query(self, question: str) -> str:
137
- """
138
- Asynchronously queries the agent with a given question and returns the response.
139
-
140
- Args:
141
- question (str): The question to be sent to the agent.
142
-
143
- Returns:
144
- str: The response from the agent as a string.
145
- """
146
- response = await self.agent.run(question, ctx=self.ctx)
147
- response = str(response)
148
- return response
149
 
150
- def clear_context(self):
151
- """
152
- Clears the current context of the agent, resetting any conversation history.
153
- This is useful when starting a new conversation or when the context needs to be refreshed.
154
- Also clears the context of any tool agents.
155
- """
156
- self.ctx = Context(self.agent)
157
- # Clear context for tool agents
158
- self.math_expert.clear_context()
159
- self.reasoner.clear_context()
160
 
161
 
162
- class MathExpert:
163
  def __init__(self, temperature, max_tokens):
164
- # Load the system prompt from a file
165
- system_prompt_path = os.path.join(os.getcwd(), "system_prompts", "07_math_expert.txt")
166
- self.system_prompt = ""
167
- with open(system_prompt_path, "r") as file:
168
- self.system_prompt = file.read().strip()
169
- # Define the LLM and agent
170
- llm = LLMFactory.create(Args.primary_llm_interface, self.system_prompt, temperature, max_tokens)
171
- self.agent = AgentWorkflow.from_tools_or_functions(
172
- [
173
  Toolbox.math.symbolic_calc,
174
  Toolbox.math.unit_converter,
175
- ],
176
- llm=llm
177
- )
178
- self.ctx = Context(self.agent)
179
- # Initialize the tool agents
180
- self.reasoner = Reasoner(temperature, max_tokens)
181
-
182
- def get_system_prompt(self) -> str:
183
- """
184
- Retrieves the system prompt.
185
-
186
- Returns:
187
- str: The system prompt string.
188
- """
189
- return self.system_prompt
190
-
191
- async def query(self, question: str) -> str:
192
- """
193
- Asynchronously queries the agent with a given question and returns the response.
194
 
195
- Args:
196
- question (str): The question to be sent to the agent.
 
197
 
198
- Returns:
199
- str: The response from the agent as a string.
200
- """
201
- response = await self.agent.run(question, ctx=self.ctx)
202
- response = str(response)
203
- return response
204
-
205
- def clear_context(self):
206
- """
207
- Clears the current context of the agent, resetting any conversation history.
208
- This is useful when starting a new conversation or when the context needs to be refreshed.
209
- Also clears the context of any tool agents.
210
- """
211
- self.ctx = Context(self.agent)
212
- self.reasoner.clear_context()
213
 
214
-
215
- class Reasoner:
216
  def __init__(self, temperature, max_tokens):
217
- # Load the system prompt from a file
218
- system_prompt_path = os.path.join(os.getcwd(), "system_prompts", "08_reasoner.txt")
219
- self.system_prompt = ""
220
- with open(system_prompt_path, "r") as file:
221
- self.system_prompt = file.read().strip()
222
- # Define the LLM and agent
223
- llm = LLMFactory.create(Args.primary_llm_interface, self.system_prompt, temperature, max_tokens)
224
- self.agent = AgentWorkflow.setup_agent(llm=llm)
225
- self.ctx = Context(self.agent)
226
-
227
- async def query(self, question: str) -> str:
228
- """
229
- Asynchronously queries the agent with a given question and returns the response.
230
-
231
- Args:
232
- question (str): The question to be sent to the agent.
233
-
234
- Returns:
235
- str: The response from the agent as a string.
236
- """
237
- response = await self.agent.run(question, ctx=self.ctx)
238
- response = str(response)
239
- return response
240
 
241
- def get_system_prompt(self) -> str:
242
- """
243
- Retrieves the system prompt.
244
 
245
- Returns:
246
- str: The system prompt string.
247
- """
248
- return self.system_prompt
249
-
250
- def clear_context(self):
251
- """
252
- Clears the current context of the agent, resetting any conversation history.
253
- This is useful when starting a new conversation or when the context needs to be refreshed.
254
- """
255
- self.ctx = Context(self.agent)
256
 
257
 
258
- class ImageHandler:
259
  def __init__(self, temperature, max_tokens):
260
- # Load the system prompt from a file
261
- system_prompt_path = os.path.join(os.getcwd(), "system_prompts", "09_image_handler.txt")
262
- self.system_prompt = ""
263
- with open(system_prompt_path, "r") as file:
264
- self.system_prompt = file.read().strip()
265
- pass
266
-
267
- def get_system_prompt(self) -> str:
268
- """
269
- Retrieves the system prompt.
270
 
271
- Returns:
272
- str: The system prompt string.
273
- """
274
- return self.system_prompt
275
 
276
- def clear_context(self):
277
- """
278
- Clears the current context of the agent, resetting any conversation history.
279
- This is useful when starting a new conversation or when the context needs to be refreshed.
280
- """
281
- if hasattr(self, 'ctx') and hasattr(self, 'agent'):
282
- self.ctx = Context(self.agent)
283
 
284
 
285
- class VideoHandler:
286
  def __init__(self, temperature, max_tokens):
287
- # Load the system prompt from a file
288
- system_prompt_path = os.path.join(os.getcwd(), "system_prompts", "10_video_handler.txt")
289
- self.system_prompt = ""
290
- with open(system_prompt_path, "r") as file:
291
- self.system_prompt = file.read().strip()
292
- # No implementation yet
293
- pass
294
-
295
- def get_system_prompt(self) -> str:
296
- """
297
- Retrieves the system prompt.
298
 
299
- Returns:
300
- str: The system prompt string.
301
- """
302
- return self.system_prompt
303
 
304
- def clear_context(self):
305
- """
306
- Clears the current context of the agent, resetting any conversation history.
307
- This is useful when starting a new conversation or when the context needs to be refreshed.
308
- """
309
- if hasattr(self, 'ctx') and hasattr(self, 'agent'):
310
- self.ctx = Context(self.agent)
311
 
312
 
313
- class Solver:
314
  def __init__(self, temperature, max_tokens):
315
- # Load the system prompt from a file
316
- system_prompt_path = os.path.join(os.getcwd(), "system_prompts", "03_solver.txt")
317
- self.system_prompt = ""
318
- with open(system_prompt_path, "r") as file:
319
- self.system_prompt = file.read().strip()
320
- # Define the LLM and agent
321
- llm = LLMFactory.create(Args.primary_llm_interface, self.system_prompt, temperature, max_tokens)
322
- self.agent = AgentWorkflow.from_tools_or_functions(
323
- [
324
- self.call_summarizer,
325
- self.call_researcher,
326
- self.call_encryption_expert,
327
- self.call_math_expert,
328
- self.call_reasoner,
329
- self.call_image_handler,
330
- self.call_video_handler
331
- ],
332
- llm=llm
333
- )
334
- self.ctx = Context(self.agent)
335
- # Initialize the tool agents
336
- self.summarizer = Summarizer(temperature, max_tokens)
337
- self.researcher = Researcher(temperature, max_tokens)
338
- self.encryption_expert = EncryptionExpert(temperature, max_tokens)
339
- self.math_expert = MathExpert(temperature, max_tokens)
340
- self.reasoner = Reasoner(temperature, max_tokens)
341
- self.image_handler = ImageHandler(temperature, max_tokens)
342
- self.video_handler = VideoHandler(temperature, max_tokens)
343
-
344
- def get_system_prompt(self) -> str:
345
- """
346
- Retrieves the system prompt.
347
-
348
- Returns:
349
- str: The system prompt string.
350
- """
351
- return self.system_prompt
352
-
353
- async def query(self, question: str) -> str:
354
- """
355
- Asynchronously queries the agent with a given question and returns the response.
356
-
357
- Args:
358
- question (str): The question to be sent to the agent.
359
-
360
- Returns:
361
- str: The response from the agent as a string.
362
- """
363
- response = await self.agent.run(question, ctx=self.ctx)
364
- response = str(response)
365
- return response
366
-
367
- def clear_context(self):
368
- """
369
- Clears the current context of the agent, resetting any conversation history.
370
- This is useful when starting a new conversation or when the context needs to be refreshed.
371
- Also clears the context of all tool agents.
372
- """
373
- self.ctx = Context(self.agent)
374
- # Clear context for all tool agents
375
- self.summarizer.clear_context()
376
- self.researcher.clear_context()
377
- self.encryption_expert.clear_context()
378
- self.math_expert.clear_context()
379
- self.reasoner.clear_context()
380
- self.image_handler.clear_context()
381
- self.video_handler.clear_context()
382
-
383
- async def call_summarizer(self, question: str) -> str:
384
- return await self.summarizer.query(question)
385
-
386
- async def call_researcher(self, question: str) -> str:
387
- return await self.researcher.query(question)
388
-
389
- async def call_encryption_expert(self, question: str) -> str:
390
- return await self.encryption_expert.query(question)
391
-
392
- async def call_math_expert(self, question: str) -> str:
393
- return await self.math_expert.query(question)
394
-
395
- async def call_reasoner(self, question: str) -> str:
396
- return await self.reasoner.query(question)
397
-
398
- async def call_image_handler(self, question: str) -> str:
399
- # ImageHandler may not have a query method yet, but following the pattern
400
- if hasattr(self.image_handler, 'query'):
401
- return await self.image_handler.query(question)
402
- return "Image handling is not implemented yet."
403
- # TODO
404
-
405
- async def call_video_handler(self, question: str) -> str:
406
- # VideoHandler may not have a query method yet, but following the pattern
407
- if hasattr(self.video_handler, 'query'):
408
- return await self.video_handler.query(question)
409
- return "Video handling is not implemented yet."
410
- # TODO
411
 
412
 
413
  # if __name__ == "__main__":
 
1
+ from typing import List
 
 
2
 
3
+ from itf_agent import IAgent
 
 
 
4
  from toolbox import Toolbox
5
  from args import Args
6
 
7
 
8
+ class Summarizer(IAgent):
9
  def __init__(self, temperature, max_tokens):
10
+ super().__init__(temperature, max_tokens, "04_summarizer.txt", Args.primary_llm_interface)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
+ def setup_tools(self) -> List:
13
  """
14
+ Abstract method to set up the tools.
15
+ This method must be overridden by subclasses to define custom tools this agent can use.
 
 
 
 
 
16
  """
17
+ return []
 
 
18
 
19
+ def setup_slaves(self) -> List:
20
  """
21
+ Abstract method to set up the slave agents.
22
+ This method must be overridden by subclasses to define custom sub-agents this agent can use.
23
  """
24
+ return []
25
 
26
 
27
+ class Researcher(IAgent):
28
  def __init__(self, temperature, max_tokens):
29
+ super().__init__(temperature, max_tokens, "05_researcher.txt", Args.primary_llm_interface)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
+ def setup_tools(self) -> List:
32
+ return [Toolbox.web_search.duck_duck_go_tools]
 
 
 
 
33
 
34
+ def setup_slaves(self) -> List:
35
+ return []
 
 
 
 
36
 
37
 
38
+ class EncryptionExpert(IAgent):
39
  def __init__(self, temperature, max_tokens):
40
+ super().__init__(temperature, max_tokens, "06_encryption_expert.txt", Args.primary_llm_interface)
41
+
42
+ def setup_tools(self) -> List:
43
+ return [
 
 
 
 
 
44
  Toolbox.encryption.base64_encode,
45
  Toolbox.encryption.base64_decode,
46
  Toolbox.encryption.caesar_cipher_encode,
47
  Toolbox.encryption.caesar_cipher_decode,
48
  Toolbox.encryption.reverse_string
49
  # TODO: Add more encryption tools
50
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
+ def setup_slaves(self) -> List:
53
+ return []
 
 
 
 
 
 
 
 
54
 
55
 
56
+ class MathExpert(IAgent):
57
  def __init__(self, temperature, max_tokens):
58
+ super().__init__(temperature, max_tokens, "07_math_expert.txt", Args.primary_llm_interface)
59
+
60
+ def setup_tools(self) -> List:
61
+ return [
 
 
 
 
 
62
  Toolbox.math.symbolic_calc,
63
  Toolbox.math.unit_converter,
64
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
+ def setup_slaves(self) -> List:
67
+ reasoner = Reasoner(self.temperature, self.max_tokens)
68
+ return [reasoner]
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
+ class Reasoner(IAgent):
 
72
  def __init__(self, temperature, max_tokens):
73
+ super().__init__(temperature, max_tokens, "08_reasoner.txt", Args.primary_llm_interface)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
+ def setup_tools(self) -> List:
76
+ return []
 
77
 
78
+ def setup_slaves(self) -> List:
79
+ return []
 
 
 
 
 
 
 
 
 
80
 
81
 
82
+ class ImageHandler(IAgent):
83
  def __init__(self, temperature, max_tokens):
84
+ super().__init__(temperature, max_tokens, "09_image_handler.txt", Args.vlm_interface)
 
 
 
 
 
 
 
 
 
85
 
86
+ def setup_tools(self) -> List:
87
+ return []
 
 
88
 
89
+ def setup_slaves(self) -> List:
90
+ return []
 
 
 
 
 
91
 
92
 
93
+ class VideoHandler(IAgent):
94
  def __init__(self, temperature, max_tokens):
95
+ super().__init__(temperature, max_tokens, "10_video_handler.txt", Args.vlm_interface)
 
 
 
 
 
 
 
 
 
 
96
 
97
+ def setup_tools(self) -> List:
98
+ return []
 
 
99
 
100
+ def setup_slaves(self) -> List:
101
+ return []
 
 
 
 
 
102
 
103
 
104
+ class Solver(IAgent):
105
  def __init__(self, temperature, max_tokens):
106
+ super().__init__(temperature, max_tokens, "03_solver.txt", Args.primary_llm_interface)
107
+
108
+ def setup_tools(self) -> List:
109
+ return []
110
+
111
+ def setup_slaves(self) -> List:
112
+ summarizer = Summarizer(self.temperature, self.max_tokens)
113
+ researcher = Researcher(self.temperature, self.max_tokens)
114
+ encryption_expert = EncryptionExpert(self.temperature, self.max_tokens)
115
+ math_expert = MathExpert(self.temperature, self.max_tokens)
116
+ reasoner = Reasoner(self.temperature, self.max_tokens)
117
+ image_handler = ImageHandler(self.temperature, self.max_tokens)
118
+ video_handler = VideoHandler(self.temperature, self.max_tokens)
119
+
120
+ return [
121
+ summarizer,
122
+ researcher,
123
+ encryption_expert,
124
+ math_expert,
125
+ reasoner,
126
+ image_handler,
127
+ video_handler
128
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
 
131
  # if __name__ == "__main__":