Tesvia commited on
Commit
14f5cc8
·
verified ·
1 Parent(s): 4a751ef

Upload agent.py

Browse files
Files changed (1) hide show
  1. agent.py +6 -2
agent.py CHANGED
@@ -78,12 +78,16 @@ class GAIAAgent(CodeAgent):
78
  # Convenience so the object itself can be *called* directly
79
  def __call__(self, question: str, **kwargs: Any) -> str:
80
  steps = self.run(question, **kwargs)
 
 
 
 
81
  last_step = None
82
  for step in steps:
83
  last_step = step
84
- # If last_step is a FinalAnswerStep with .answer, return it
85
  answer = getattr(last_step, "answer", None)
86
- # Always return as a string, with stripping for safety
87
  if answer is not None:
88
  return str(answer).strip()
89
  return str(last_step).strip()
 
78
  # Convenience so the object itself can be *called* directly
79
  def __call__(self, question: str, **kwargs: Any) -> str:
80
  steps = self.run(question, **kwargs)
81
+ if isinstance(steps, str):
82
+ print("DEBUG: steps is a string:", repr(steps))
83
+ return steps.strip()
84
+ print("DEBUG: steps is a", type(steps))
85
  last_step = None
86
  for step in steps:
87
  last_step = step
88
+ print("DEBUG: last_step =", repr(last_step))
89
  answer = getattr(last_step, "answer", None)
90
+ print("DEBUG: answer =", repr(answer))
91
  if answer is not None:
92
  return str(answer).strip()
93
  return str(last_step).strip()