from smolagents import Tool import random class WeatherInfoTool(Tool): name = "weather_info" description = "Gets weather information for a location." inputs = { "location": { "type": "string", "description": "The city or location to check weather for." } } output_type = "string" def forward(self, location: str): conditions = ["Sunny, 22°C", "Rainy, 15°C", "Clear, 25°C", "Cloudy, 18°C"] return f"Weather in {location}: {random.choice(conditions)}" class HubStatsTool(Tool): name = "hub_stats" description = "Gets information about popular HuggingFace models." inputs = { "author": { "type": "string", "description": "The HuggingFace author/organization name." } } output_type = "string" def forward(self, author: str): return f"Most popular model by {author}: Llama-2 (millions of downloads)" class SearchTool(Tool): name = "search" description = "Searches for information online." inputs = { "query": { "type": "string", "description": "The search query to look up." } } output_type = "string" def forward(self, query: str): return f"Search results for '{query}': Found relevant information." # Create tool instances weather_tool = WeatherInfoTool() hub_tool = HubStatsTool() search_tool = SearchTool() # Export as list all_tools = [weather_tool, hub_tool, search_tool] print(f"✅ tools.py loaded with {len(all_tools)} tools")