File size: 1,203 Bytes
d80b863
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from smolagents import Tool
from typing import Any, Optional

class SimpleTool(Tool):
    name = "estimate_renovation_cost"
    description = "Estimates renovation costs based on square footage and room type."
    inputs = {"square_footage":{"type":"number","description":"The size of the room in square feet"},"room_type":{"type":"string","description":"The type of room (kitchen, bathroom, bedroom, living_room)"}}
    output_type = "string"

    def forward(self, square_footage: float, room_type: str) -> str:
        """
        Estimates renovation costs based on square footage and room type.
        Args:
            square_footage: The size of the room in square feet
            room_type: The type of room (kitchen, bathroom, bedroom, living_room)
        """
        cost_per_sqft = {
            "kitchen": 150,
            "bathroom": 250,
            "bedroom": 70,
            "living_room": 90
        }

        base_cost = cost_per_sqft.get(room_type.lower(), 100) * square_footage

        # Add contingency budget
        total_cost = base_cost * 1.2

        return f"Estimated cost for {room_type} renovation ({square_footage} sq ft): ${total_cost:.2f} including 20% contingency"