base_parser.py 294 B

12345678910111213
  1. """Abstract base class for parsers."""
  2. from abc import ABC, abstractmethod
  3. from typing import AsyncGenerator, Generic, TypeVar
  4. T = TypeVar("T")
  5. class AsyncParser(ABC, Generic[T]):
  6. @abstractmethod
  7. async def ingest(self, data: T, **kwargs) -> AsyncGenerator[str, None]:
  8. pass