update for 1. 优化 2.中英切换
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
"""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]
|
||||
Reference in New Issue
Block a user