from abc import ABC, abstractmethod from typing import List, Dict class BaseRetriever(ABC): """检索策略的基类""" @abstractmethod def retrieve(self, query: str, context: List[Dict]) -> List[Dict]: """执行检索""" pass @abstractmethod def init_retriever(self, config: Dict): """初始化检索器""" pass