Final_Assignment_Template / tools /fetch_web_page.py
AlbertoFor's picture
Final version of tools
6a809e4
raw
history blame
538 Bytes
from langchain_core.tools.base import BaseTool
from typing import List
import requests
class FetchWebPageTool(BaseTool):
name : str = "fetch_web_page_tool"
description: str = "Provided the urls of 1 or more web pages, this tool returns the full content of the web page. This tool needs to be called AFTER calling the web_page_tool. It's important to fetch only pages which are useful to your task!"
def _run(self, urls: List[str]) -> List[str]:
pages = [requests.get(url).text for url in urls]
return pages