Update tooling.py
Browse files- tooling.py +18 -0
tooling.py
CHANGED
|
@@ -42,6 +42,24 @@ class ModelMathTool(Tool):
|
|
| 42 |
|
| 43 |
return result
|
| 44 |
|
|
|
|
|
|
|
|
|
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
|
|
|
|
| 42 |
|
| 43 |
return result
|
| 44 |
|
| 45 |
+
class WikipediaTool(Tool):
|
| 46 |
+
name = "wikip_tool"
|
| 47 |
+
description = "Searches Wikipedia and provides summary about the queried topic."
|
| 48 |
|
| 49 |
+
inputs = {
|
| 50 |
+
"query": {
|
| 51 |
+
"type": "string",
|
| 52 |
+
"description": "Topic of wikipedia search",
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
output_type = "string"
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def __init__(self):
|
| 60 |
+
import wikipedia
|
| 61 |
+
|
| 62 |
+
def forward(self, query: str) -> str:
|
| 63 |
+
return wikipedia.summary(query, sentences=3)
|
| 64 |
|
| 65 |
|