Spaces:
Runtime error
Runtime error
Update tools/unit_conversion.py
Browse files- tools/unit_conversion.py +3 -5
tools/unit_conversion.py
CHANGED
|
@@ -1,13 +1,12 @@
|
|
| 1 |
-
from typing import Any
|
| 2 |
from smolagents.tools import Tool
|
| 3 |
|
| 4 |
class UnitConversionTool(Tool):
|
| 5 |
name = "unit_conversion"
|
| 6 |
-
description = "Converts between units
|
| 7 |
inputs = {
|
| 8 |
-
"value": {"type": "
|
| 9 |
"from_unit": {"type": "string", "description": "The unit of the input value (e.g., 'miles', 'kilograms', 'celsius')."},
|
| 10 |
-
"to_unit": {"type": "string", "description": "The
|
| 11 |
}
|
| 12 |
output_type = "string"
|
| 13 |
|
|
@@ -31,4 +30,3 @@ class UnitConversionTool(Tool):
|
|
| 31 |
return f"Sorry, conversion from {from_unit} to {to_unit} is not supported."
|
| 32 |
|
| 33 |
return f"{value} {from_unit} is {round(result, 2)} {to_unit}."
|
| 34 |
-
|
|
|
|
|
|
|
| 1 |
from smolagents.tools import Tool
|
| 2 |
|
| 3 |
class UnitConversionTool(Tool):
|
| 4 |
name = "unit_conversion"
|
| 5 |
+
description = "Converts between different units like distance, weight, and temperature."
|
| 6 |
inputs = {
|
| 7 |
+
"value": {"type": "number", "description": "The numerical value to convert."}, # Use "number" instead of "float"
|
| 8 |
"from_unit": {"type": "string", "description": "The unit of the input value (e.g., 'miles', 'kilograms', 'celsius')."},
|
| 9 |
+
"to_unit": {"type": "string", "description": "The target unit (e.g., 'kilometers', 'pounds', 'fahrenheit')."}
|
| 10 |
}
|
| 11 |
output_type = "string"
|
| 12 |
|
|
|
|
| 30 |
return f"Sorry, conversion from {from_unit} to {to_unit} is not supported."
|
| 31 |
|
| 32 |
return f"{value} {from_unit} is {round(result, 2)} {to_unit}."
|
|
|