Spaces:
Runtime error
Runtime error
Update app.py
Browse filesRefactoring and simplifying of the web_search tool to get rid of errors caused by unnecessary formatting
app.py
CHANGED
|
@@ -22,14 +22,12 @@ def web_search(query: str) -> str: #it's import to specify the return type
|
|
| 22 |
# Perform the search
|
| 23 |
results = search_tool(query)
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
return "\n".join(formatted_results) if formatted_results else "No results found."
|
| 33 |
|
| 34 |
except Exception as e:
|
| 35 |
return f"Error performing search: {str(e)}"
|
|
|
|
| 22 |
# Perform the search
|
| 23 |
results = search_tool(query)
|
| 24 |
|
| 25 |
+
# Print results for debugging
|
| 26 |
+
if not results:
|
| 27 |
+
return "No results found."
|
| 28 |
+
|
| 29 |
+
# Format results as a simple string
|
| 30 |
+
return str(results)
|
|
|
|
|
|
|
| 31 |
|
| 32 |
except Exception as e:
|
| 33 |
return f"Error performing search: {str(e)}"
|