[docs]deflazy_load(self)->Iterator[Document]:"""Load documents."""try:frombaidubce.services.bos.bos_clientimportBosClientexceptImportError:raiseImportError("Please using `pip install bce-python-sdk`"+" before import bos related package.")# Initialize BOS Clientclient=BosClient(self.conf)withtempfile.TemporaryDirectory()astemp_dir:file_path=f"{temp_dir}/{self.bucket}/{self.key}"os.makedirs(os.path.dirname(file_path),exist_ok=True)# Download the file to a destinationlogger.debug(f"get object key {self.key} to file {file_path}")client.get_object_to_file(self.bucket,self.key,file_path)try:loader=UnstructuredFileLoader(file_path)documents=loader.load()returniter(documents)exceptExceptionasex:logger.error(f"load document error = {ex}")returniter([Document(page_content="")])