Spaces:
Running
Running
Support `load_tool` (#1)
Browse files- Support load_tool (43ae560f06ddbc4ef7354621d864eab452f4dbc0)
- Support load_tool (86203da121fe3d71d703d19691ed810ada6cc0d1)
Co-authored-by: Lysandre <lysandre@users.noreply.huggingface.co>
- requirements.txt +2 -0
- tool_config.json +5 -0
- wolfram-alpha-tool → wolfram_alpha_tool.py +3 -1
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
requests
|
tool_config.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"description": "This is a tool that uses WolframAlpha to compute any mathematical question. It takes one input query, and returns a verbose result in xml format, which includes the solution.",
|
| 3 |
+
"name": "wolfram_alpha",
|
| 4 |
+
"tool_class": "wolfram_alpha_tool.WolframAlpha"
|
| 5 |
+
}
|
wolfram-alpha-tool → wolfram_alpha_tool.py
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
class WolframAlpha(Tool):
|
| 2 |
name = "wolfram_alpha"
|
| 3 |
description = ("This is a tool that uses WolframAlpha to compute any mathematical question. It takes one input query, and returns a verbose result in xml format, which includes the solution.")
|
|
@@ -32,4 +34,4 @@ class WolframAlpha(Tool):
|
|
| 32 |
# Remove unnecessary empty spaces
|
| 33 |
return str(response.json())
|
| 34 |
else:
|
| 35 |
-
return f"There was an error with the request, with response: {response}"
|
|
|
|
| 1 |
+
from transformers import Tool
|
| 2 |
+
|
| 3 |
class WolframAlpha(Tool):
|
| 4 |
name = "wolfram_alpha"
|
| 5 |
description = ("This is a tool that uses WolframAlpha to compute any mathematical question. It takes one input query, and returns a verbose result in xml format, which includes the solution.")
|
|
|
|
| 34 |
# Remove unnecessary empty spaces
|
| 35 |
return str(response.json())
|
| 36 |
else:
|
| 37 |
+
return f"There was an error with the request, with response: {response}"
|