haiku.rag/haiku_rag_slim/haiku/rag/reranking/base.py
2025-11-25 12:28:43 +02:00

13 lines
456 B
Python

from haiku.rag.config import Config
from haiku.rag.store.models.chunk import Chunk
class RerankerBase:
_model: str | None = Config.reranking.model.name if Config.reranking.model else None
async def rerank(
self, query: str, chunks: list[Chunk], top_n: int = 10
) -> list[tuple[Chunk, float]]:
raise NotImplementedError(
"Reranker is an abstract class. Please implement the rerank method in a subclass."
)