morphik-core/core/parser/base_parser.py
Adityavardhan Agrawal df8d7fcdd0
refactor some stuff (#2)
* refactor some stuff, remove bare try catches
2024-12-15 14:31:25 -05:00

18 lines
478 B
Python

from abc import ABC, abstractmethod
from typing import List, Union
from fastapi import UploadFile
class BaseParser(ABC):
"""Base class for document parsing"""
@abstractmethod
async def split_text(self, text: str) -> List[str]:
"""Split plain text into chunks"""
pass
@abstractmethod
async def parse_file(self, file: Union[UploadFile, bytes], content_type: str) -> List[str]:
"""Parse file content into text chunks"""
pass