Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -192,7 +192,8 @@ class ExcelReaderTool(Tool):
|
|
| 192 |
"""
|
| 193 |
inputs = {
|
| 194 |
"excel_path": {
|
| 195 |
-
"type": "string"
|
|
|
|
| 196 |
"description": "The path to the Excel file to read",
|
| 197 |
},
|
| 198 |
"sheet_name": {
|
|
@@ -291,10 +292,11 @@ class MagAgent:
|
|
| 291 |
ExcelReaderTool(),
|
| 292 |
VisitWebpageTool(),
|
| 293 |
PythonCodeReaderTool(),
|
| 294 |
-
GoogleSearchTool,
|
| 295 |
# ImageAnalysisTool,
|
| 296 |
],
|
| 297 |
-
verbosity_level=
|
|
|
|
| 298 |
add_base_tools=True,
|
| 299 |
max_steps=15
|
| 300 |
)
|
|
@@ -310,8 +312,8 @@ class MagAgent:
|
|
| 310 |
await asyncio.sleep(60 / 15) # Assuming 15 RPM
|
| 311 |
# Include task_id in the task prompt to guide the agent
|
| 312 |
task = (
|
| 313 |
-
f"Answer the following question accurately and concisely: \n"
|
| 314 |
-
f"{question}"
|
| 315 |
f"If the question references an attachment, use tool to download it with task_id: {task_id}\n"
|
| 316 |
# f"Return the answer as a string."
|
| 317 |
)
|
|
@@ -330,5 +332,4 @@ class MagAgent:
|
|
| 330 |
except Exception as e:
|
| 331 |
error_msg = f"Error processing question for task {task_id}: {str(e)}. Check API key or network connectivity."
|
| 332 |
print(error_msg)
|
| 333 |
-
return error_msg
|
| 334 |
-
|
|
|
|
| 192 |
"""
|
| 193 |
inputs = {
|
| 194 |
"excel_path": {
|
| 195 |
+
"type": "string"
|
| 196 |
+
,
|
| 197 |
"description": "The path to the Excel file to read",
|
| 198 |
},
|
| 199 |
"sheet_name": {
|
|
|
|
| 292 |
ExcelReaderTool(),
|
| 293 |
VisitWebpageTool(),
|
| 294 |
PythonCodeReaderTool(),
|
| 295 |
+
# GoogleSearchTool,
|
| 296 |
# ImageAnalysisTool,
|
| 297 |
],
|
| 298 |
+
verbosity_level=2,
|
| 299 |
+
prompt_templates=prompt_templates
|
| 300 |
add_base_tools=True,
|
| 301 |
max_steps=15
|
| 302 |
)
|
|
|
|
| 312 |
await asyncio.sleep(60 / 15) # Assuming 15 RPM
|
| 313 |
# Include task_id in the task prompt to guide the agent
|
| 314 |
task = (
|
| 315 |
+
# f"Answer the following question accurately and concisely: \n"
|
| 316 |
+
f"{question} \n"
|
| 317 |
f"If the question references an attachment, use tool to download it with task_id: {task_id}\n"
|
| 318 |
# f"Return the answer as a string."
|
| 319 |
)
|
|
|
|
| 332 |
except Exception as e:
|
| 333 |
error_msg = f"Error processing question for task {task_id}: {str(e)}. Check API key or network connectivity."
|
| 334 |
print(error_msg)
|
| 335 |
+
return error_msg
|
|
|