redis-vl-dotnet
Reranker Abstractions
RedisVL.Rerankers.Abstractions defines the provider-neutral reranking surface for search result post-processing.
Core interfaces and records
-
ITextRerankerexposesRerankAsync(RerankRequest request, CancellationToken cancellationToken = default). -
RerankRequestcarries the user query, the ordered candidate list, and an optionaltopNcap. -
RerankDocumentcarries the text sent to the provider plus optionalidandmetadatathat come back with each result. -
RerankResultreturns the provider score, the original candidate index, and the matchedRerankDocument.
Contract details
The abstraction keeps Redis-specific search logic separate from provider ranking logic:
-
Use Redis search APIs to collect an initial candidate window.
-
Convert those candidates into
RerankDocumentinstances. -
Submit the
RerankRequestto the provider-backed implementation. -
Use the returned
Indexfield to map back to the original candidate ordering when needed.
RerankRequest rejects an empty query and rejects topN ⇐ 0. Provider implementations are expected to return an empty collection when the request contains no documents.
Current provider package
-
Cohere reranker is the current provider-backed implementation.
Examples and tests
-
/examples/CohereRerankerExampleshows the canonical pattern of Redis search first, provider reranking second. -
tests/RedisVL.Tests/Rerankers/TextRerankerExtensionsTests.csandtests/RedisVL.Tests/Rerankers/CohereTextRerankerTests.cscapture the shape and validation expectations for the current abstraction.