orcalib.memoryset.reranker#
RerankResult
dataclass
#
Reranker
#
Bases: ABC
A reranker is a model that reranks a list of memories for a given query.
rerank
abstractmethod
#
Rerank the memories for the given query.
Parameters:
-
query
(str
) –The query with which the memories were retrieved.
-
memories
(list[str]
) –The texts of the memories to rerank.
-
top_k
(int | None
, default:None
) –The number of memories to return. If None, all memories are returned.
Returns:
-
RerankResult
–The reranked memories in the order of their scores.