Arnold_trainer / tools /calculate_hydration.py
Firoj112's picture
Upload agent
954a8ef verified
raw
history blame contribute delete
772 Bytes
from smolagents import Tool
from typing import Any, Optional
class SimpleTool(Tool):
name = "calculate_hydration"
description = "Calculates daily water intake based on body weight."
inputs = {"weight_kg":{"type":"number","description":"Body weight in kilograms"}}
output_type = "string"
def forward(self, weight_kg: float) -> str:
"""
Calculates daily water intake based on body weight.
Args:
weight_kg: Body weight in kilograms
"""
if weight_kg <= 0:
return "Please provide a valid weight"
water_ml = weight_kg * 33
water_oz = water_ml / 29.5735
return f"Daily water intake:\n{water_ml:.0f} ml\n{water_oz:.1f} oz\nApprox {water_ml/250:.1f} glasses (250ml each)"