Facelook commited on
Commit
1362580
·
1 Parent(s): b415833

Fixed 'str' object is not callable error.

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -25,8 +25,11 @@ class BasicAgent:
25
 
26
  try:
27
  search_result = self.agent.run(question) # CodeAgent typically uses .run()
28
- # Return the search result directly - it's already a string
29
- answer = str(search_result)
 
 
 
30
  except Exception as e:
31
  answer = f"Error during search: {e}"
32
 
 
25
 
26
  try:
27
  search_result = self.agent.run(question) # CodeAgent typically uses .run()
28
+ # Make sure search_result is treated as a string, not as a callable object
29
+ if callable(search_result):
30
+ answer = f"Search result for '{question[:50]}...': {search_result()}"
31
+ else:
32
+ answer = f"Search result for '{question[:50]}...': {search_result}"
33
  except Exception as e:
34
  answer = f"Error during search: {e}"
35