import requests from bs4 import BeautifulSoup from transformers.tools.base import Tool TEXT_DOWNLOAD_DESCRIPTION = ( "This is a tool that downloads a file from a `url` and returns the text contained in the tile." ) class TextDownloadTool(Tool): name = "text_downloader" inputs= {"url": {"type": str, "description": "url to download file from"}} output_type= str description = TEXT_DOWNLOAD_DESCRIPTION def __call__(self, url): return BeautifulSoup(requests.get(url).text, features="html.parser").get_text()