Migrated all interfaces to get and return strings. Added tests and evals for all functions (except the random generation) Math functions are now organized into different math categories --------- Co-authored-by: Nate Barbettini <nate@arcade-ai.com>
27 lines
676 B
Python
27 lines
676 B
Python
import math
|
|
from decimal import Decimal
|
|
from typing import Annotated
|
|
|
|
from arcade.sdk import tool
|
|
|
|
|
|
@tool
|
|
def deg_to_rad(
|
|
degrees: Annotated[str, "Angle in degrees as a string"],
|
|
) -> Annotated[str, "Angle in radians as a string"]:
|
|
"""
|
|
Convert an angle from degrees to radians.
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
return str(math.radians(Decimal(degrees)))
|
|
|
|
|
|
@tool
|
|
def rad_to_deg(
|
|
radians: Annotated[str, "Angle in radians as a string"],
|
|
) -> Annotated[str, "Angle in degrees as a string"]:
|
|
"""
|
|
Convert an angle from radians to degrees.
|
|
"""
|
|
# Use Decimal for arbitrary precision
|
|
return str(math.degrees(Decimal(radians)))
|