docling-studio/document-parser/domain/ports.py
2026-03-31 16:35:48 +02:00

24 lines
701 B
Python

"""Domain ports — abstract interfaces that infrastructure must implement.
These protocols define what the domain NEEDS, not how it's done.
Infrastructure adapters (local Docling, Docling Serve, etc.) implement these.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Protocol
if TYPE_CHECKING:
from domain.value_objects import ConversionOptions, ConversionResult
class DocumentConverter(Protocol):
"""Port for document conversion.
Any implementation (local Docling lib, remote Docling Serve, mock, etc.)
must satisfy this contract.
"""
async def convert(
self, file_path: str, options: ConversionOptions,
) -> ConversionResult: ...