from smolagents import Tool import requests class WebSearchTool(Tool): name = "web_search" description = "Performs a web search for a given query and returns top results." inputs = { "input_text": { "type": "string", "description": "The query to search for." } } output_type = "string" def forward(self, input_text: str) -> str: response = requests.post( "https://ankitaofficialdutta02--modal-web-search-fastapi-app.modal.run/search", json={"query": input_text} ) return response.json().get("result", "No results found.")