From eef4da2a301e9c33ff4e7afd9cd5a199221d6b55 Mon Sep 17 00:00:00 2001 From: 3rdSon Date: Wed, 23 Oct 2024 08:45:10 +0100 Subject: [PATCH] fixed pydantic warning --- .../swarmauri/tools/concrete/Parameter.py | 7 ++++++- .../tools/concrete/TemperatureConverterTool.py | 14 -------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/pkgs/swarmauri/swarmauri/tools/concrete/Parameter.py b/pkgs/swarmauri/swarmauri/tools/concrete/Parameter.py index 2c47a85ee..f73276ccd 100644 --- a/pkgs/swarmauri/swarmauri/tools/concrete/Parameter.py +++ b/pkgs/swarmauri/swarmauri/tools/concrete/Parameter.py @@ -1,5 +1,10 @@ +from typing import Optional, List, Any, Literal +from pydantic import Field from swarmauri.tools.base.ParameterBase import ParameterBase class Parameter(ParameterBase): - pass + type: Literal["string", "number", "boolean", "array", "object"] + + class Config: + use_enum_values = True diff --git a/pkgs/swarmauri/swarmauri/tools/concrete/TemperatureConverterTool.py b/pkgs/swarmauri/swarmauri/tools/concrete/TemperatureConverterTool.py index c2df20ed6..1af606c32 100644 --- a/pkgs/swarmauri/swarmauri/tools/concrete/TemperatureConverterTool.py +++ b/pkgs/swarmauri/swarmauri/tools/concrete/TemperatureConverterTool.py @@ -68,17 +68,3 @@ def __call__(self, from_unit: str, to_unit: str, value: float) -> Dict[str, str] return {f"temperature_in_{to_unit}": str(result)} except Exception as e: raise f"An error occurred: {str(e)}" - - -# Example usage: -tool = TemperatureConverterTool() -print(tool("celsius", "fahrenheit", 25)) # Should output: 77.0 -print(tool("kelvin", "celsius", 0)) # Should output: -273.15 -print(tool("fahrenheit", "kelvin", 32)) # Should output: 273.15 - - -SubclassUnion.update( - baseclass=ToolBase, - type_name="TemperatureConverterTool", - obj=TemperatureConverterTool, -)