langchain.document_loaders.base.BaseLoader

class langchain.document_loaders.base.BaseLoader[source]

Interface for Document Loader.

Implementations should implement the lazy-loading method using generators to avoid loading all Documents into memory at once.

The load method will remain as is for backwards compatibility, but its implementation should be just list(self.lazy_load()).

Methods

__init__()

lazy_load()

A lazy loader for Documents.

load()

Load data into Document objects.

load_and_split([text_splitter])

Load Documents and split into chunks.

__init__()
lazy_load() Iterator[Document][source]

A lazy loader for Documents.

abstract load() List[Document][source]

Load data into Document objects.

load_and_split(text_splitter: Optional[TextSplitter] = None) List[Document][source]

Load Documents and split into chunks. Chunks are returned as Documents.

Parameters

text_splitter – TextSplitter instance to use for splitting documents. Defaults to RecursiveCharacterTextSplitter.

Returns

List of Documents.

Examples using BaseLoader