from abc import ABC, abstractmethod from typing import Iterator class AbstractModelService(ABC): """LLM 백엔드 Strategy 인터페이스.""" @abstractmethod def load(self) -> None: """모델을 메모리에 로드한다.""" @abstractmethod def stream(self, prompt: str, max_tokens: int) -> Iterator[str]: """프롬프트를 받아 토큰을 스트리밍한다.""" @abstractmethod def build_prompt(self, history: list[dict]) -> str: """대화 히스토리를 모델 입력 형식으로 변환한다."""