maxwellmogambi commited on
Commit
c27b5bf
·
verified ·
1 Parent(s): 160ab6c

Update tools/unit_conversion.py

Browse files
Files changed (1) hide show
  1. 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 such as distance, weight, and temperature."
7
  inputs = {
8
- "value": {"type": "float", "description": "The numerical value to convert."},
9
  "from_unit": {"type": "string", "description": "The unit of the input value (e.g., 'miles', 'kilograms', 'celsius')."},
10
- "to_unit": {"type": "string", "description": "The desired unit (e.g., 'kilometers', 'pounds', 'fahrenheit')."}
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}."