jm-vis commited on
Commit
2893d08
·
1 Parent(s): 7b53e15

Fix: Update agent.run() to handle both string and dictionary inputs

Browse files
Files changed (1) hide show
  1. src/gaia/agent/agent_enhanced.py +8 -3
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: Input data containing the question
371
 
372
  Returns:
373
  str: Generated answer
374
  """
375
- question = input_data.get("question", "")
 
 
 
 
 
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."