Skip to main content

Module diversifier

Module diversifier 

Source
Expand description

Maximal Marginal Relevance (MMR) diversification for semantic search results.

This module implements the MMR algorithm which selects top-k results that balance relevance to the query with diversity among the selected items. The trade-off is controlled by a lambda parameter: 1.0 = pure relevance, 0.0 = pure diversity.

Structs§

DiversificationCandidate
A single candidate for diversified selection.
DiversifiedResult
A single result from the diversified selection process.
DiversifierConfig
Configuration for the MMR diversification algorithm.
DiversifierStats
Aggregate statistics across all select calls made on a SemanticDiversifier instance.
SemanticDiversifier
Diversifies a ranked list of candidates using Maximal Marginal Relevance.

Functions§

cosine_similarity
Cosine similarity between two vectors.