feat: interface for WebLoader
This commit is contained in:
parent
62157a114d
commit
9395539868
1 changed files with 61 additions and 0 deletions
61
cognee/infrastructure/loaders/external/WebLoader.py
vendored
Normal file
61
cognee/infrastructure/loaders/external/WebLoader.py
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
from cognee.infrastructure.loaders import LoaderInterface
|
||||
from typing import List
|
||||
|
||||
|
||||
class WebLoader(LoaderInterface):
|
||||
@property
|
||||
def supported_extensions(self) -> List[str]:
|
||||
"""
|
||||
List of file extensions this loader supports.
|
||||
|
||||
Returns:
|
||||
List of extensions including the dot (e.g., ['.txt', '.md'])
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def supported_mime_types(self) -> List[str]:
|
||||
"""
|
||||
List of MIME types this loader supports.
|
||||
|
||||
Returns:
|
||||
List of MIME type strings (e.g., ['text/plain', 'application/pdf'])
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def loader_name(self) -> str:
|
||||
"""
|
||||
Unique name identifier for this loader.
|
||||
|
||||
Returns:
|
||||
String identifier used for registration and configuration
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def can_handle(self, extension: str, mime_type: str) -> bool:
|
||||
"""
|
||||
Check if this loader can handle the given file.
|
||||
|
||||
Args:
|
||||
extension: File extension
|
||||
mime_type: MIME type of the file
|
||||
|
||||
Returns:
|
||||
True if this loader can process the file, False otherwise
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
async def load(self, file_path: str, **kwargs):
|
||||
"""
|
||||
Load and process the file, returning standardized result.
|
||||
|
||||
Args:
|
||||
file_path: Path to the file to be processed
|
||||
file_stream: If file stream is provided it will be used to process file instead
|
||||
**kwargs: Additional loader-specific configuration
|
||||
|
||||
Raises:
|
||||
Exception: If file cannot be processed
|
||||
"""
|
||||
raise NotImplementedError
|
||||
Loading…
Add table
Reference in a new issue