""" Knowledge Universe — Base Format Adapter Abstract contract all adapters must satisfy. """ from abc import ABC, abstractmethod from typing import Any from src.api.models import Source class BaseFormatAdapter(ABC): """ Abstract base class for all output format adapters. The adapter pattern means the core pipeline never changes — only the output representation does. """ @abstractmethod def transform(self, source: Source) -> Any: """Transform source model to target output format.""" pass def transform_many(self, sources: list) -> list: """Transform multiple sources. Override for batch optimization.""" return [self.transform(s) for s in sources]