Files
youlbot/services/model/base.py
T
shinalok cd41e9e33e - **Bootstrap IoC-based architecture with modular services.**
- **Implement `MlxModelService` for local LLM backend.**
- **Introduce `DatabaseService` for MySQL integration.**
- **Add `HistoryService` to manage conversation context.**
- **Set up CLI interface via `CliUiService`.**
- **Establish EventBus for token streaming.**
- **Include conversation repository for data persistence.**
- **Add environment-based configuration management.**
- **Draft IoC architectural plan.**
2026-04-25 01:14:37 +09:00

19 lines
561 B
Python

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:
"""대화 히스토리를 모델 입력 형식으로 변환한다."""