mahadewa commited on
Commit
e28c7c0
·
verified ·
1 Parent(s): 89d1ea1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -19,10 +19,11 @@ class MultiAgents:
19
  print("Initializing MultiAgents.")
20
  model = os.getenv("DEFAULT_LLM_MODEL")
21
 
22
- print("Router Agent")
23
  self.orchestrator = RouterAgent()
24
- print("Research Agent")
25
  self.research_agent = ResearchAgent(model)
 
26
 
27
  print("Finished initializing agents. Now registering them.")
28
 
@@ -33,6 +34,12 @@ class MultiAgents:
33
  "Handles general factual questions requiring web search or knowledge retrieval. Good for questions about people, events, organizations, or facts that require research."
34
  )
35
 
 
 
 
 
 
 
36
  print("MultiAgent successfully initialized")
37
 
38
  def __call__(self, question: str) -> str:
@@ -107,7 +114,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
107
  print(f"Skipping item with missing task_id or question: {item}")
108
  continue
109
  try:
110
- if file_name:
111
  fetch_url = f"{api_url}/files/{task_id}"
112
  print(f"Fetching file from {fetch_url} ")
113
  try:
@@ -123,7 +130,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
123
  print(f"Error fetching file: {e}")
124
  continue
125
 
126
- submitted_answer = agent(question_text)
127
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
128
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
129
  except Exception as e:
 
19
  print("Initializing MultiAgents.")
20
  model = os.getenv("DEFAULT_LLM_MODEL")
21
 
22
+ # print("Router Agent")
23
  self.orchestrator = RouterAgent()
24
+ # print("Research Agent")
25
  self.research_agent = ResearchAgent(model)
26
+ self.audio_agent = AudioAgent(model)
27
 
28
  print("Finished initializing agents. Now registering them.")
29
 
 
34
  "Handles general factual questions requiring web search or knowledge retrieval. Good for questions about people, events, organizations, or facts that require research."
35
  )
36
 
37
+ self.orchestrator.register_agent(
38
+ "audio_transcript",
39
+ self.audio_agent,
40
+ "Handles transcription of an audio file, for example an mp3 file and subsequently finding answer from the audio file."
41
+ )
42
+
43
  print("MultiAgent successfully initialized")
44
 
45
  def __call__(self, question: str) -> str:
 
114
  print(f"Skipping item with missing task_id or question: {item}")
115
  continue
116
  try:
117
+ if not file_name:
118
  fetch_url = f"{api_url}/files/{task_id}"
119
  print(f"Fetching file from {fetch_url} ")
120
  try:
 
130
  print(f"Error fetching file: {e}")
131
  continue
132
 
133
+ submitted_answer = agent(question_text, file_name)
134
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
135
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
136
  except Exception as e: