mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-01 02:50:47 +00:00
community: Use default load() implementation in doc loaders (#18385)
Following https://github.com/langchain-ai/langchain/pull/18289
This commit is contained in:
committed by
GitHub
parent
42341bc787
commit
177f51c7bd
@@ -1,6 +1,6 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
from typing import Iterator, List, Union
|
||||
from typing import Iterator, Union
|
||||
|
||||
from langchain_core.documents import Document
|
||||
|
||||
@@ -18,10 +18,6 @@ class TomlLoader(BaseLoader):
|
||||
"""Initialize the TomlLoader with a source file or directory."""
|
||||
self.source = Path(source)
|
||||
|
||||
def load(self) -> List[Document]:
|
||||
"""Load and return all documents."""
|
||||
return list(self.lazy_load())
|
||||
|
||||
def lazy_load(self) -> Iterator[Document]:
|
||||
"""Lazily load the TOML documents from the source file or directory."""
|
||||
import tomli
|
||||
|
Reference in New Issue
Block a user