Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
|
| 117 |
-
except Exception as e:
|
| 118 |
-
|
| 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 |
|