mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 00:48:45 +00:00
add mode arg to OBSFileLoader.load() method (#29246)
- **Description:** add mode arg to OBSFileLoader.load() method - **Issue:** #29245 - **Dependencies:** no dependencies required for this change --------- Co-authored-by: Junon_Gz <junon_gz@qq.com>
This commit is contained in:
parent
c6388d736b
commit
667d2a57fd
@ -92,7 +92,7 @@ class OBSFileLoader(BaseLoader):
|
|||||||
self.bucket = bucket
|
self.bucket = bucket
|
||||||
self.key = key
|
self.key = key
|
||||||
|
|
||||||
def load(self) -> List[Document]:
|
def load(self, mode: str = "single") -> List[Document]:
|
||||||
"""Load documents."""
|
"""Load documents."""
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
file_path = f"{temp_dir}/{self.bucket}/{self.key}"
|
file_path = f"{temp_dir}/{self.bucket}/{self.key}"
|
||||||
@ -101,5 +101,5 @@ class OBSFileLoader(BaseLoader):
|
|||||||
self.client.downloadFile(
|
self.client.downloadFile(
|
||||||
bucketName=self.bucket, objectKey=self.key, downloadFile=file_path
|
bucketName=self.bucket, objectKey=self.key, downloadFile=file_path
|
||||||
)
|
)
|
||||||
loader = UnstructuredFileLoader(file_path)
|
loader = UnstructuredFileLoader(file_path, mode=mode)
|
||||||
return loader.load()
|
return loader.load()
|
||||||
|
Loading…
Reference in New Issue
Block a user