File tree 3 files changed +6
-1
lines changed
langchain_core/document_loaders
tests/unit_tests/document_loaders
3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ def lazy_load(self) -> Iterator[Document]:
251
251
metadata = _build_metadata (soup , path )
252
252
yield Document (page_content = text , metadata = metadata )
253
253
254
- def aload (self ) -> List [Document ]:
254
+ def aload (self ) -> List [Document ]: # type: ignore
255
255
"""Load text from the urls in web_path async into Documents."""
256
256
257
257
results = self .scrape_all (self .web_paths )
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ def load(self) -> List[Document]:
28
28
"""Load data into Document objects."""
29
29
return list (self .lazy_load ())
30
30
31
+ async def aload (self ) -> List [Document ]:
32
+ """Load data into Document objects."""
33
+ return [document async for document in self .alazy_load ()]
34
+
31
35
def load_and_split (
32
36
self , text_splitter : Optional [TextSplitter ] = None
33
37
) -> List [Document ]:
Original file line number Diff line number Diff line change @@ -64,3 +64,4 @@ def lazy_load(self) -> Iterator[Document]:
64
64
docs = loader .load ()
65
65
assert docs == [Document (page_content = "foo" ), Document (page_content = "bar" )]
66
66
assert docs == [doc async for doc in loader .alazy_load ()]
67
+ assert docs == await loader .aload ()
You can’t perform that action at this time.
0 commit comments