Update tools.py
Browse files
tools.py
CHANGED
|
@@ -51,4 +51,22 @@ class image_interpreter(Tool):
|
|
| 51 |
],
|
| 52 |
)
|
| 53 |
return output
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
],
|
| 52 |
)
|
| 53 |
return output
|
| 54 |
+
|
| 55 |
+
class Wikipedia_reader(Tool):
|
| 56 |
+
name="wikipedia_tool"
|
| 57 |
+
description = "To be used whenever you need to read a Wikipedia page. Will return all the text of the Wikipedia page, to easily read it and find information"
|
| 58 |
+
inputs = {
|
| 59 |
+
"url": {
|
| 60 |
+
"type": "string",
|
| 61 |
+
"description": "The wikippedia url page"
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
output_type = "string"
|
| 65 |
+
|
| 66 |
+
def forward(self, url: str):
|
| 67 |
+
try:
|
| 68 |
+
page = requests.get(url)
|
| 69 |
+
except Exception as e:
|
| 70 |
+
print('Error downloading page: ',e)
|
| 71 |
+
soup = BeautifulSoup(page.text, 'html.parser')
|
| 72 |
+
return soup.text
|