register_loader

Function

Registers a document loading function. A maximum of 1,000 loaders can be registered.

Prototype

def register_loader(loader_class, file_types, loader_params)

Parameters

Parameter

Data Type

Required/Optional

Description

loader_class

BaseLoader

Required

Document loading function, which can only be a subclass inherited from langchain_core.document_loaders.base.BaseLoader.

file_types

List[str]

Required

File name extension list. The value ranges for both the document type and name extension length are [1, 32]. For example, the value can be [".txt", ".docx"].

loader_params

Dict[str, Any]

Optional

Parameters to be passed to the document loading function. The default value is None. The length of the parameter string cannot exceed 1024 characters. The dictionary length cannot exceed 1024 characters. The number of nested dictionary layers cannot exceed 1.