staedi commited on
Commit
70cc94b
·
verified ·
1 Parent(s): e0d521f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -18,9 +18,20 @@ class BasicAgent:
18
 
19
  def __call__(self, question: str) -> str:
20
  print(f"Agent received question (first 50 chars): {question[:50]}...")
 
 
 
 
 
 
 
 
 
 
 
21
  # answer = agent.await_result(self.agent,question)
22
- answer = self.agent.run(question)
23
- return answer.response.blocks[0].text
24
  # fixed_answer = "This is a default answer."
25
  # print(f"Agent returning fixed answer: {fixed_answer}")
26
  # return fixed_answer
 
18
 
19
  def __call__(self, question: str) -> str:
20
  print(f"Agent received question (first 50 chars): {question[:50]}...")
21
+
22
+ try:
23
+ answer = agent.run_async_task(agent.await_result,question)
24
+ # return answer
25
+ except:
26
+ pass
27
+ answer = "This is a default answer."
28
+
29
+ print(f"Agent returning fixed answer: {answer}")
30
+ return answer
31
+
32
  # answer = agent.await_result(self.agent,question)
33
+ # answer = self.agent.run(question)
34
+ # return answer.response.blocks[0].text
35
  # fixed_answer = "This is a default answer."
36
  # print(f"Agent returning fixed answer: {fixed_answer}")
37
  # return fixed_answer