Spaces:
Sleeping
Sleeping
Update tools.py
Browse files
tools.py
CHANGED
|
@@ -6,12 +6,24 @@ search = DuckDuckGoSearchRun()
|
|
| 6 |
|
| 7 |
@tool
|
| 8 |
def web_search(query: str) -> str:
|
| 9 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
return search.run(query)
|
| 11 |
|
| 12 |
@tool
|
| 13 |
def wiki_search(query: str) -> str:
|
| 14 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
try:
|
| 16 |
page = wikipedia.page(query)
|
| 17 |
print(f"query: {query}, summary: {page.summary}")
|
|
|
|
| 6 |
|
| 7 |
@tool
|
| 8 |
def web_search(query: str) -> str:
|
| 9 |
+
"""
|
| 10 |
+
web_search: Performs a web search using DuckDuckGo and returns relevant results.
|
| 11 |
+
Args:
|
| 12 |
+
query (str): The search query.
|
| 13 |
+
Returns:
|
| 14 |
+
str: A relevant result or summary of results from the web.
|
| 15 |
+
"""
|
| 16 |
return search.run(query)
|
| 17 |
|
| 18 |
@tool
|
| 19 |
def wiki_search(query: str) -> str:
|
| 20 |
+
"""
|
| 21 |
+
wiki_search: Looks up a topic on English Wikipedia and returns a summary.
|
| 22 |
+
Args:
|
| 23 |
+
query (str): The search query.
|
| 24 |
+
Returns:
|
| 25 |
+
str: A concise summary of the topic from English Wikipedia.
|
| 26 |
+
"""
|
| 27 |
try:
|
| 28 |
page = wikipedia.page(query)
|
| 29 |
print(f"query: {query}, summary: {page.summary}")
|