""" document_loader.py Module for loading documents from PDF files using PyMuPDFLoader. """ from langchain_community.document_loaders import PyMuPDFLoader def load_document(file_path): """Loads a document from a PDF file. Args: file_path (str): Path to the PDF file. Returns: list: A list of documents if loaded successfully, else an empty list. """ loader = PyMuPDFLoader(file_path) try: documents = loader.load() except Exception as e: print(f"Error loading document: {e}") documents = [] return documents