Spaces:
Runtime error
Runtime error
Update app.py
Browse filesRemoved max_results parameter, which is not supported by DuckDuckGoSearch and caused error
app.py
CHANGED
|
@@ -9,19 +9,18 @@ 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 web_search(query: str
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""A tool that performs web searches using DuckDuckGo
|
| 15 |
Args:
|
| 16 |
query: The search query string
|
| 17 |
-
max_results: Maximum number of results (default = 3)
|
| 18 |
"""
|
| 19 |
try:
|
| 20 |
# Create instance of DuckDuckGoSearchTool
|
| 21 |
search_tool = DuckDuckGoSearchTool()
|
| 22 |
|
| 23 |
# Perform the search
|
| 24 |
-
results = search_tool(query
|
| 25 |
|
| 26 |
# Format the results
|
| 27 |
formatted_results = []
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def web_search(query: str) -> 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 performs web searches using DuckDuckGo
|
| 15 |
Args:
|
| 16 |
query: The search query string
|
|
|
|
| 17 |
"""
|
| 18 |
try:
|
| 19 |
# Create instance of DuckDuckGoSearchTool
|
| 20 |
search_tool = DuckDuckGoSearchTool()
|
| 21 |
|
| 22 |
# Perform the search
|
| 23 |
+
results = search_tool(query)
|
| 24 |
|
| 25 |
# Format the results
|
| 26 |
formatted_results = []
|