Base loader
Defines an abstract base class to load document and get the required value from document.
Reviewers
Timotius Nugroho Chandra (timotius.n.chandra@gdplabs.id)
BaseLoader
Bases: ABC
An abstract base class for document loaders.
This class defines the structure for loading and processing documents to retrieve required values. Subclasses are expected to implement the 'load' method to handle document loading from a given source.
Methods:
Name | Description |
---|---|
load |
Abstract method to load a document. |
load(source, loaded_elements=None, **kwargs)
abstractmethod
Load and process a document.
This method is abstract and must be implemented in subclasses. It defines the process of loading a document using its source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
str
|
Might be file path, URL, the content itself. |
required |
loaded_elements |
Any
|
The loaded elements from previous loaders. ideally formatted as List[Dict]. |
None
|
**kwargs |
Any
|
Additional keyword arguments for customization. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
The loaded document, ideally formatted as List[Dict]. Each dictionary within the list are recommended to follows the structure of model 'Element', to ensure consistency and ease of use across Document Processing Orchestrator. |