Cheangys commited on
Commit
5658739
·
verified ·
1 Parent(s): d1cfa6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -100,22 +100,23 @@ def duckweb_search(query: str) -> str:
100
 
101
  # Perform the search
102
  search_results = search_tool(query)
 
103
 
104
  # Debugging: Print results to see what is returned
105
  print(f"DEBUG: search results -> {search_results}")
106
 
107
- # Handle different result types
108
- if isinstance(search_results, list) and len(search_results) > 0:
109
- # Try to extract the stock price from the first result
110
- first_result = search_results[0]
111
 
112
- # Attempt to find a pattern like "123.45 USD" in the text
113
- return f"the answer is {first_result}"
114
- else:
115
- return f"No search results found for {query}."
116
 
117
- except Exception as e:
118
- return f"Error fetching price for stock '{query}': {str(e)}"
119
 
120
  final_answer = FinalAnswerTool()
121
 
 
100
 
101
  # Perform the search
102
  search_results = search_tool(query)
103
+ return f"the answer is {search_results}"
104
 
105
  # Debugging: Print results to see what is returned
106
  print(f"DEBUG: search results -> {search_results}")
107
 
108
+ # # Handle different result types
109
+ # if isinstance(search_results, list) and len(search_results) > 0:
110
+ # # Try to extract the stock price from the first result
111
+ # first_result = search_results[0]
112
 
113
+ # # Attempt to find a pattern like "123.45 USD" in the text
114
+ # return f"the answer is {first_result}"
115
+ # else:
116
+ # return f"No search results found for {query}."
117
 
118
+ # except Exception as e:
119
+ # return f"Error fetching price for stock '{query}': {str(e)}"
120
 
121
  final_answer = FinalAnswerTool()
122