Team Ai
Apppublic

Underground-Digital/Workflow-Engine

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
rerank_base.py27 linesDownload Raw Back to rerank
1from abc import ABC, abstractmethod2from typing import Optional3 4from core.rag.models.document import Document5 6 7class BaseRerankRunner(ABC):8    @abstractmethod9    def run(10        self,11        query: str,12        documents: list[Document],13        score_threshold: Optional[float] = None,14        top_n: Optional[int] = None,15        user: Optional[str] = None,16    ) -> list[Document]:17        """18        Run rerank model19        :param query: search query20        :param documents: documents for reranking21        :param score_threshold: score threshold22        :param top_n: top n23        :param user: unique user id if needed24        :return:25        """26        raise NotImplementedError27