sirine1712 commited on
Commit
30f81f6
·
verified ·
1 Parent(s): 368cf79

Update multiagents.py

Browse files
Files changed (1) hide show
  1. multiagents.py +16 -12
multiagents.py CHANGED
@@ -99,27 +99,30 @@ manager_agent = CodeAgent(
99
 
100
  class MultiAgent:
101
  def __init__(self):
102
- print("BasicAgent initialized.")
103
 
104
  def __call__(self, question: str) -> str:
 
 
105
  try:
106
  if not isinstance(question, str):
107
  question = str(question)
108
 
109
- prompt = f"""
110
- You are the top agent of a multi-agent system that answers questions by coordinating web and audiovisual agents.
111
- You will receive a question and decide which agent to use.
112
- Use the web_agent for online info or fetching webpages.
113
- Use audiovideo_agent for YouTube videos or images/audio files.
114
- Return answers in the exact format required.
115
 
116
- QUESTION:
117
- {question.strip()}
118
 
119
- {myprompts.output_format.strip()}
120
- """
121
 
122
- return manager_agent.run(prompt.strip()) # Must be a string
 
123
 
124
  except Exception as e:
125
  error = f"An error occurred while processing the question: {e}"
@@ -127,6 +130,7 @@ class MultiAgent:
127
  return error
128
 
129
 
 
130
  if __name__ == "__main__":
131
  # Example usage
132
 
 
99
 
100
  class MultiAgent:
101
  def __init__(self):
102
+ print("MultiAgent initialized.")
103
 
104
  def __call__(self, question: str) -> str:
105
+ mylog(self.__class__.__name__, question)
106
+
107
  try:
108
  if not isinstance(question, str):
109
  question = str(question)
110
 
111
+ full_prompt = f"""
112
+ You are the top agent of a multi-agent system that answers questions by coordinating web and audiovisual agents.
113
+ You will receive a question and decide which agent to use.
114
+ Use the web_agent for online info or fetching webpages.
115
+ Use audiovideo_agent for YouTube videos or images/audio files.
116
+ Return answers in the exact format required.
117
 
118
+ QUESTION:
119
+ {question.strip()}
120
 
121
+ {myprompts.output_format.strip()}
122
+ """
123
 
124
+ # Ensure this is a string — not a list of messages
125
+ return manager_agent.run(full_prompt.strip())
126
 
127
  except Exception as e:
128
  error = f"An error occurred while processing the question: {e}"
 
130
  return error
131
 
132
 
133
+
134
  if __name__ == "__main__":
135
  # Example usage
136