Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,13 +9,23 @@ from Gradio_UI import GradioUI
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""A tool that does nothing yet
|
| 15 |
Args:
|
| 16 |
arg1: the first argument
|
| 17 |
arg2: the second argument
|
| 18 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
return "What magic will you build ?"
|
| 20 |
|
| 21 |
@tool
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def DuckDuckGoSearchTool(query_string:str,max_results:int) -> str: #it's import to specify the return type
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""A tool that does nothing yet
|
| 15 |
Args:
|
| 16 |
arg1: the first argument
|
| 17 |
arg2: the second argument
|
| 18 |
"""
|
| 19 |
+
try:
|
| 20 |
+
results = DuckDuckGoSearchTool().text(
|
| 21 |
+
keywords=query_string,
|
| 22 |
+
region='wt-wt', # Defaults to worldwide
|
| 23 |
+
safesearch='moderate',
|
| 24 |
+
timelimit=None,
|
| 25 |
+
max_results=max_results
|
| 26 |
+
)
|
| 27 |
+
return results
|
| 28 |
+
|
| 29 |
return "What magic will you build ?"
|
| 30 |
|
| 31 |
@tool
|