diff --git a/packages/markitdown/src/markitdown/__init__.py b/packages/markitdown/src/markitdown/__init__.py index 59d9750..53a4e5e 100644 --- a/packages/markitdown/src/markitdown/__init__.py +++ b/packages/markitdown/src/markitdown/__init__.py @@ -10,6 +10,7 @@ from ._exceptions import ( FileConversionException, UnsupportedFormatException, ) +from ._input import ConverterInput from .converters import DocumentConverter, DocumentConverterResult __all__ = [ @@ -21,4 +22,5 @@ __all__ = [ "ConverterPrerequisiteException", "FileConversionException", "UnsupportedFormatException", + "ConverterInput", ] diff --git a/packages/markitdown/src/markitdown/_input.py b/packages/markitdown/src/markitdown/_input.py new file mode 100644 index 0000000..858f3b1 --- /dev/null +++ b/packages/markitdown/src/markitdown/_input.py @@ -0,0 +1,18 @@ +from typing import Any, Union + +class ConverterInput: + """ + Wrapper for inputs to converter functions. + """ + def __init__( + self, + input_type: str = "filepath", + filepath: Union[str, None] = None, + file_object: Union[Any, None] = None, + ): + if input_type not in ["filepath", "object"]: + raise ValueError(f"Invalid converter input type: {input_type}") + + self.input_type = input_type + self.filepath = filepath + self.file_object = file_object \ No newline at end of file