22 lines
769 B
Python
22 lines
769 B
Python
|
|
"""No-op reranker stub.
|
||
|
|
|
||
|
|
Returns the original candidate list sliced to top_k.
|
||
|
|
Replace with CrossEncoderReranker when a local cross-encoder model is available.
|
||
|
|
"""
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from app.domain.retrieval.models import RetrievedChunk
|
||
|
|
from app.domain.retrieval.ports import Reranker
|
||
|
|
|
||
|
|
|
||
|
|
class PassThroughReranker(Reranker):
|
||
|
|
"""Pass-through reranker that preserves original retrieval order.
|
||
|
|
|
||
|
|
Acts as a placeholder for future cross-encoder reranking (e.g. ms-marco-MiniLM).
|
||
|
|
Wire via bootstrap.get_compliance_reranker() when ready to swap.
|
||
|
|
"""
|
||
|
|
|
||
|
|
def rerank(self, query: str, chunks: list[RetrievedChunk], top_k: int) -> list[RetrievedChunk]:
|
||
|
|
"""Return the first top_k chunks without reordering."""
|
||
|
|
return chunks[:top_k]
|