aboutsummaryrefslogtreecommitdiff
path: root/R2R/r2r/base/parsers
diff options
context:
space:
mode:
Diffstat (limited to 'R2R/r2r/base/parsers')
-rwxr-xr-xR2R/r2r/base/parsers/__init__.py5
-rwxr-xr-xR2R/r2r/base/parsers/base_parser.py14
2 files changed, 19 insertions, 0 deletions
diff --git a/R2R/r2r/base/parsers/__init__.py b/R2R/r2r/base/parsers/__init__.py
new file mode 100755
index 00000000..d7696202
--- /dev/null
+++ b/R2R/r2r/base/parsers/__init__.py
@@ -0,0 +1,5 @@
+from .base_parser import AsyncParser
+
+__all__ = [
+ "AsyncParser",
+]
diff --git a/R2R/r2r/base/parsers/base_parser.py b/R2R/r2r/base/parsers/base_parser.py
new file mode 100755
index 00000000..f1bb49d7
--- /dev/null
+++ b/R2R/r2r/base/parsers/base_parser.py
@@ -0,0 +1,14 @@
+"""Abstract base class for parsers."""
+
+from abc import ABC, abstractmethod
+from typing import AsyncGenerator, Generic, TypeVar
+
+from ..abstractions.document import DataType
+
+T = TypeVar("T")
+
+
+class AsyncParser(ABC, Generic[T]):
+ @abstractmethod
+ async def ingest(self, data: T) -> AsyncGenerator[DataType, None]:
+ pass