from smolagents import Tool from typing import Any, Optional class SimpleTool(Tool): name = "material_calculator" description = "Calculates required material quantities for renovation projects." inputs = {"material_type":{"type":"string","description":"Type of material (paint, flooring, tile, drywall)"},"square_footage":{"type":"number","description":"Area to be covered in square feet"}} output_type = "string" def forward(self, material_type: str, square_footage: float) -> str: """ Calculates required material quantities for renovation projects. Args: material_type: Type of material (paint, flooring, tile, drywall) square_footage: Area to be covered in square feet """ calculations = { "paint": f"{(square_footage / 400):.2f} gallons (assuming 2 coats)", "flooring": f"{(square_footage * 1.1):.2f} sq ft (includes 10% waste)", "tile": f"{(square_footage * 1.15):.2f} sq ft (includes 15% for cuts and waste)", "drywall": f"{(square_footage / 32):.1f} sheets of 4'x8' drywall" } return calculations.get(material_type.lower(), "Material type not recognized")