Spaces:
Sleeping
Sleeping
EtienneB
commited on
Commit
·
a718e51
1
Parent(s):
1c5b21d
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,8 @@ class BasicAgent:
|
|
| 43 |
exponential, web_search, roman_calculator_converter,
|
| 44 |
get_current_time_in_timezone
|
| 45 |
]
|
| 46 |
-
|
|
|
|
| 47 |
print(f"Total tools available: {len(self.tools)}")
|
| 48 |
|
| 49 |
async def answer(self, question: str) -> str:
|
|
@@ -53,16 +54,11 @@ class BasicAgent:
|
|
| 53 |
return response['messages'][-1].content[14:]
|
| 54 |
|
| 55 |
async def run_agent_async(agent, questions_data):
|
| 56 |
-
results_log, answers_payload = [], []
|
| 57 |
tasks = []
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
question = item.get("question")
|
| 62 |
-
if not task_id or question is None:
|
| 63 |
-
print(f"Skipping item with missing task_id or question: {item}")
|
| 64 |
-
continue
|
| 65 |
-
tasks.append((task_id, question))
|
| 66 |
|
| 67 |
async def process(task_id, question):
|
| 68 |
try:
|
|
|
|
| 43 |
exponential, web_search, roman_calculator_converter,
|
| 44 |
get_current_time_in_timezone
|
| 45 |
]
|
| 46 |
+
|
| 47 |
+
self.chat_with_tools = self.chat.with_tools(self.tools)
|
| 48 |
print(f"Total tools available: {len(self.tools)}")
|
| 49 |
|
| 50 |
async def answer(self, question: str) -> str:
|
|
|
|
| 54 |
return response['messages'][-1].content[14:]
|
| 55 |
|
| 56 |
async def run_agent_async(agent, questions_data):
|
| 57 |
+
# results_log, answers_payload = [], []
|
| 58 |
tasks = []
|
| 59 |
|
| 60 |
+
print(f"Running agent on {len(questions_data)} questions...")
|
| 61 |
+
results_log, answers_payload = asyncio.run(run_agent_async(agent, questions_data))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
async def process(task_id, question):
|
| 64 |
try:
|