from typing import Any, Optional from smolagents.tools import Tool class ContractorMatchingTool(Tool): name = "contractor_matcher" description = """ Recommends contractor specialties based on project requirements. Returns the types of contractors needed and hiring tips. """ inputs = {'project_type': {'type': 'string', 'description': 'The type of renovation project'}} output_type = "string" def forward(self, project_type: str): recommendations = { "kitchen": "Required specialists: General contractor, plumber, electrician, cabinet installer, countertop fabricator, tile setter\n\nTips: Check for experience with kitchen-specific ventilation and appliance installation. Request photos of at least 5 previous kitchen projects.", "bathroom": "Required specialists: General contractor, plumber, tile setter, electrician\n\nTips: Verify waterproofing experience and ask about their shower installation process. Bathroom specialists should demonstrate knowledge of moisture control.", "basement": "Required specialists: General contractor, framer, electrician, plumber, drywall installer, waterproofing expert\n\nTips: Ensure they have specific basement finishing experience and check references for water intrusion solutions.", "addition": "Required specialists: Architect, structural engineer, general contractor, roofer, framer, electrician, plumber, HVAC technician\n\nTips: Verify permit handling experience and check their knowledge of connecting new construction to existing structure." } project = project_type.lower() return recommendations.get(project, "For this project type, consult a general contractor for initial assessment. Always check licenses, insurance, and at least 3 references.") def __init__(self, *args, **kwargs): self.is_initialized = False