Spaces:
Sleeping
Sleeping
Update calculator_tool.py
Browse files- calculator_tool.py +4 -7
calculator_tool.py
CHANGED
|
@@ -10,21 +10,18 @@ class CalculatorTool(Tool):
|
|
| 10 |
|
| 11 |
inputs = {
|
| 12 |
"expression": {
|
| 13 |
-
"type": "
|
| 14 |
"description": "The expression to be evaluated.The variables used CANNOT be placeholders like 'x' or 'mike's age', they must be numbers",
|
| 15 |
-
},
|
| 16 |
-
"useless_expression": {
|
| 17 |
-
"type": "text",
|
| 18 |
-
"description": "The expression to not be evaluated.The variables used CANNOT be placeholders like 'x' or 'mike's age', they must be numbers",
|
| 19 |
}
|
|
|
|
| 20 |
}
|
| 21 |
output_type = "text"
|
| 22 |
|
| 23 |
def __init__(self, *args, **kwargs):
|
| 24 |
super().__init__(*args, **kwargs)
|
| 25 |
|
| 26 |
-
def __call__(self, expression
|
| 27 |
-
if isinstance(expression,
|
| 28 |
expression = expression["expression"]
|
| 29 |
local_dict = {"pi": math.pi, "e": math.e}
|
| 30 |
output = str(
|
|
|
|
| 10 |
|
| 11 |
inputs = {
|
| 12 |
"expression": {
|
| 13 |
+
"type": "string",
|
| 14 |
"description": "The expression to be evaluated.The variables used CANNOT be placeholders like 'x' or 'mike's age', they must be numbers",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
}
|
| 16 |
+
|
| 17 |
}
|
| 18 |
output_type = "text"
|
| 19 |
|
| 20 |
def __init__(self, *args, **kwargs):
|
| 21 |
super().__init__(*args, **kwargs)
|
| 22 |
|
| 23 |
+
def __call__(self, expression):
|
| 24 |
+
if isinstance(expression, dict):
|
| 25 |
expression = expression["expression"]
|
| 26 |
local_dict = {"pi": math.pi, "e": math.e}
|
| 27 |
output = str(
|