Spaces:
Sleeping
Sleeping
Fix: Update agent.run() to handle both string and dictionary inputs
Browse files
src/gaia/agent/agent_enhanced.py
CHANGED
|
@@ -362,17 +362,22 @@ class GAIAAgent:
|
|
| 362 |
logger.debug(traceback.format_exc())
|
| 363 |
return None
|
| 364 |
|
| 365 |
-
def run(self, input_data: Dict[str, Any]) -> str:
|
| 366 |
"""
|
| 367 |
Run the agent on the provided input data.
|
| 368 |
|
| 369 |
Args:
|
| 370 |
-
input_data:
|
| 371 |
|
| 372 |
Returns:
|
| 373 |
str: Generated answer
|
| 374 |
"""
|
| 375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
|
| 377 |
if not question:
|
| 378 |
return "No question provided. Please provide a question to get a response."
|
|
|
|
| 362 |
logger.debug(traceback.format_exc())
|
| 363 |
return None
|
| 364 |
|
| 365 |
+
def run(self, input_data: Union[Dict[str, Any], str]) -> str:
|
| 366 |
"""
|
| 367 |
Run the agent on the provided input data.
|
| 368 |
|
| 369 |
Args:
|
| 370 |
+
input_data: Either a dictionary containing the question or the question string directly
|
| 371 |
|
| 372 |
Returns:
|
| 373 |
str: Generated answer
|
| 374 |
"""
|
| 375 |
+
# Handle both string and dictionary inputs
|
| 376 |
+
if isinstance(input_data, str):
|
| 377 |
+
question = input_data
|
| 378 |
+
else:
|
| 379 |
+
# Handle dictionary input
|
| 380 |
+
question = input_data.get("question", "")
|
| 381 |
|
| 382 |
if not question:
|
| 383 |
return "No question provided. Please provide a question to get a response."
|