Skip to content

Class swarmauri_core.parsers.IParser.IParser

swarmauri_core.parsers.IParser.IParser

Bases: ABC

Abstract base class for parsers. It defines a public method to parse input data (str or Message) into documents, and relies on subclasses to implement the specific parsing logic through protected and private methods.

parse abstractmethod

parse(data)

Public method to parse input data (either a str or a Message) into a list of Document instances.

This method leverages the abstract _parse_data method which must be implemented by subclasses to define specific parsing logic.

Source code in swarmauri_core/parsers/IParser.py
16
17
18
19
20
21
22
23
24
@abstractmethod
def parse(self, data: Union[str, bytes, FilePath]) -> List[IDocument]:
    """
    Public method to parse input data (either a str or a Message) into a list of Document instances.

    This method leverages the abstract _parse_data method which must be
    implemented by subclasses to define specific parsing logic.
    """
    pass