mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-03 12:07:36 +00:00
core[minor]: Add aload to document loader (#19936)
Add aload to document loader
This commit is contained in:
@@ -28,6 +28,10 @@ class BaseLoader(ABC):
|
||||
"""Load data into Document objects."""
|
||||
return list(self.lazy_load())
|
||||
|
||||
async def aload(self) -> List[Document]:
|
||||
"""Load data into Document objects."""
|
||||
return [document async for document in self.alazy_load()]
|
||||
|
||||
def load_and_split(
|
||||
self, text_splitter: Optional[TextSplitter] = None
|
||||
) -> List[Document]:
|
||||
|
@@ -64,3 +64,4 @@ async def test_default_aload() -> None:
|
||||
docs = loader.load()
|
||||
assert docs == [Document(page_content="foo"), Document(page_content="bar")]
|
||||
assert docs == [doc async for doc in loader.alazy_load()]
|
||||
assert docs == await loader.aload()
|
||||
|
Reference in New Issue
Block a user