Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swarm - fixed pydantic warning and unnecessary temperature log #709

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkgs/swarmauri/swarmauri/tools/concrete/Parameter.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)