Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,19 +31,15 @@ class BasicAgent:
|
|
| 31 |
[wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
|
| 32 |
llm=self.llm,
|
| 33 |
)
|
| 34 |
-
def __call__(self, question: str) -> str:
|
| 35 |
-
try:
|
| 36 |
-
loop = asyncio.get_running_loop()
|
| 37 |
-
except RuntimeError:
|
| 38 |
-
loop = asyncio.new_event_loop()
|
| 39 |
-
asyncio.set_event_loop(loop)
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
return
|
| 46 |
|
|
|
|
|
|
|
| 47 |
#print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 48 |
#fixed_answer = "This is a default answer."
|
| 49 |
#fixed_answer = self.llamaindex_agent.run(question)
|
|
|
|
| 31 |
[wikipedia_search_tool, youtube_transcript_tool, youtube_transcript_snippet_tool, round_to_two_decimals_tool, text_inverter_tool, google_web_search_tool],
|
| 32 |
llm=self.llm,
|
| 33 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
async def run(self, question: str) -> str:
|
| 36 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 37 |
+
answer = await self.llamaindex_agent.run(question)
|
| 38 |
+
print(f"Agent returning answer: {answer}")
|
| 39 |
+
return answer
|
| 40 |
|
| 41 |
+
def __call__(self, question: str) -> str:
|
| 42 |
+
return run(question)
|
| 43 |
#print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 44 |
#fixed_answer = "This is a default answer."
|
| 45 |
#fixed_answer = self.llamaindex_agent.run(question)
|