def _load_file_from_path(self, file_path: str) -> Optional[Document]:
        """Load a file from a Dropbox path."""
        dbx = self._create_dropbox_client()
        try:
            from dropbox import exceptions
        except ImportError:
            raise ImportError("You must run " "`pip install dropbox")
        try:
            file_metadata = dbx.files_get_metadata(file_path)
            if file_metadata.is_downloadable:
                _, response = dbx.files_download(file_path)
            # Some types such as Paper, need to be exported.
            elif file_metadata.export_info:
                _, response = dbx.files_export(file_path, "markdown")
        except exceptions.ApiError as ex:
            raise ValueError(
                f"Could not load file: {file_path}. Please verify the file path"
                "and try again."
            ) from ex
        try:
            text = response.content.decode("utf-8")
        except UnicodeDecodeError:
            print(f"File {file_path} could not be decoded as text. Skipping.")
            file_extension = os.path.splitext(file_path)[1].lower()
            if file_extension == ".pdf":
                from langchain.document_loaders import UnstructuredPDFLoader
                # Download it to a temporary file.
                temp_dir = tempfile.TemporaryDirectory()
                temp_pdf = Path(temp_dir.name) / "tmp.pdf"
                with open(temp_pdf, mode="wb") as f:
                    f.write(response.content)
                try:
                    loader = UnstructuredPDFLoader(str(temp_pdf))
                    docs = loader.load()
                    if docs:
                        return docs[0]
                except Exception as pdf_ex:
                    print(f"Error while trying to parse PDF {file_path}: {pdf_ex}")
                    return None
            return None