from langchain_community.document_loaders import PyMuPDFLoader import requests # Tool for loading and reading a PDF locally @tool def fetch_pdf_content(pdf_path: str): """ Reads a local PDF and returns the content """ loader = PyMuPDFLoader(pdf_path) data = loader.load()[0] return data.page_content # Tool for loading a webpage @tool def get_webpage_contents(url: str): """ Reads the webpage with a given URL and returns the page content """ try: response = requests.get(url) response.raise_for_status() # Check for HTTP errors return response.text except requests.exceptions.RequestException as e: return str(e)