File size: 376 Bytes
7cc8bc0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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