Spaces:
Sleeping
Sleeping
Update app.py
Browse filesUpdated error messages get_web_search_results
app.py
CHANGED
@@ -24,14 +24,13 @@ def get_web_search_results(query: str)-> str: #it's import to specify the return
|
|
24 |
"""A tool that searchs the web using a query.
|
25 |
Args:
|
26 |
query: A string representing a valid web query. IMPORTANT: Follow type str format strictly e.g. 'pictures of cats'.
|
27 |
-
Incorrect formatting (such as, query='picture of cats') will result in None being returned.
|
28 |
"""
|
29 |
try:
|
30 |
results = DuckDuckGoSearchTool.forward(query)
|
31 |
if results and results != "None":
|
32 |
return results
|
33 |
else:
|
34 |
-
return "Your query may be incorrectly formatted
|
35 |
except Exception as e:
|
36 |
return f"{query} is an invalid query"
|
37 |
|
|
|
24 |
"""A tool that searchs the web using a query.
|
25 |
Args:
|
26 |
query: A string representing a valid web query. IMPORTANT: Follow type str format strictly e.g. 'pictures of cats'.
|
|
|
27 |
"""
|
28 |
try:
|
29 |
results = DuckDuckGoSearchTool.forward(query)
|
30 |
if results and results != "None":
|
31 |
return results
|
32 |
else:
|
33 |
+
return "Your query may be incorrectly formatted or there may be an issue with search engine."
|
34 |
except Exception as e:
|
35 |
return f"{query} is an invalid query"
|
36 |
|