Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,22 +19,23 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
19 |
return "What magic will you build ?"
|
20 |
|
21 |
@tool
|
22 |
-
def my_wiki_tool(arg1:str)-> str:
|
23 |
-
|
24 |
-
"""A tool that fetches the relevent information for wikipedia only
|
25 |
Args:
|
26 |
-
arg1: A string provides the details what needs to be searched
|
27 |
"""
|
|
|
28 |
duckduckgo_tool = DuckDuckGoSearchTool()
|
29 |
|
30 |
-
#
|
31 |
-
search_results = duckduckgo_tool.search(arg1)
|
32 |
-
|
|
|
33 |
|
34 |
for result in search_results:
|
35 |
-
# Add each 'Text' value from the result to
|
36 |
result_str += result.get('Text', '') + '\n' # Adding a newline for each result
|
37 |
-
|
38 |
return result_str
|
39 |
|
40 |
@tool
|
|
|
19 |
return "What magic will you build ?"
|
20 |
|
21 |
@tool
|
22 |
+
def my_wiki_tool(arg1: str) -> str: # It's important to specify the return type
|
23 |
+
"""A tool that fetches the relevant information for Wikipedia only
|
|
|
24 |
Args:
|
25 |
+
arg1: A string that provides the details of what needs to be searched on Wikipedia.
|
26 |
"""
|
27 |
+
# Initialize DuckDuckGo search tool
|
28 |
duckduckgo_tool = DuckDuckGoSearchTool()
|
29 |
|
30 |
+
# Use DuckDuckGo search tool to search for the query
|
31 |
+
search_results = duckduckgo_tool.search(arg1)
|
32 |
+
|
33 |
+
result_str = "" # Initialize an empty string to accumulate the results
|
34 |
|
35 |
for result in search_results:
|
36 |
+
# Add each 'Text' value from the result to result_str
|
37 |
result_str += result.get('Text', '') + '\n' # Adding a newline for each result
|
38 |
+
|
39 |
return result_str
|
40 |
|
41 |
@tool
|