Update app.py
Browse filesTry to make agent more robust based on the lessons learned with difference between expectation of search wiki and reality (just strings not page names)
app.py
CHANGED
|
@@ -9,9 +9,11 @@ import wikipedia
|
|
| 9 |
|
| 10 |
@tool
|
| 11 |
def search_wikipedia_pages(search_string: str) -> List[str]:
|
| 12 |
-
"""This tool helps to search for the names of wikipedia pages that relate to a search string.
|
| 13 |
-
This
|
| 14 |
-
This tool
|
|
|
|
|
|
|
| 15 |
Args:
|
| 16 |
search_string: the search string
|
| 17 |
"""
|
|
@@ -27,6 +29,7 @@ def search_wikipedia_pages(search_string: str) -> List[str]:
|
|
| 27 |
@tool
|
| 28 |
def get_wikipedia_page_content(page_name: str) -> str:
|
| 29 |
"""This tool helps to get the content of wikipedia pages by their name.
|
|
|
|
| 30 |
The output is a string with the actual content of the wikipedia page.
|
| 31 |
Args:
|
| 32 |
page_name: the name of the page in wikipedia
|
|
|
|
| 9 |
|
| 10 |
@tool
|
| 11 |
def search_wikipedia_pages(search_string: str) -> List[str]:
|
| 12 |
+
"""This tool helps to search for the names of potential names of wikipedia pages that relate to a search string.
|
| 13 |
+
This doesn't guarantee that every returned string is a perfect, exact page title that wikipedia.page() will accept without any issue.
|
| 14 |
+
This tool sends a query to the Wikipedia API's search endpoint. This endpoint performs a full-text search across Wikipedia's article titles and content.
|
| 15 |
+
This will not retrieve the actual pages, but gives oversight of the different keywords on wikipedia to find more information.
|
| 16 |
+
This tool will output the first 10 strings related to the search string as a list of strings.
|
| 17 |
Args:
|
| 18 |
search_string: the search string
|
| 19 |
"""
|
|
|
|
| 29 |
@tool
|
| 30 |
def get_wikipedia_page_content(page_name: str) -> str:
|
| 31 |
"""This tool helps to get the content of wikipedia pages by their name.
|
| 32 |
+
If you use this tool based on the output of search_wikipedia_pages remember to try a next string that was the output of search_wikipedia_pages if you get a error: Page id
|
| 33 |
The output is a string with the actual content of the wikipedia page.
|
| 34 |
Args:
|
| 35 |
page_name: the name of the page in wikipedia
|