Table of Contents

Property RetrievalStrategy

Namespace
LMKit.Retrieval
Assembly
LM-Kit.NET.dll

RetrievalStrategy

Gets or sets the retrieval strategy that controls how candidate partitions are scored during the initial retrieval phase.

public IRetrievalStrategy RetrievalStrategy { get; set; }

Property Value

IRetrievalStrategy

An IRetrievalStrategy instance. Default is VectorRetrievalStrategy.

Examples

LM embeddingModel = LM.LoadFromModelID("embeddinggemma-300m");
RagEngine ragEngine = new RagEngine(embeddingModel);

// Switch to hybrid retrieval (vector + BM25 with Reciprocal Rank Fusion)
ragEngine.RetrievalStrategy = new HybridRetrievalStrategy();

// Use pure vector similarity (the default)
ragEngine.RetrievalStrategy = new VectorRetrievalStrategy();

Remarks

The retrieval strategy determines the scoring method used to select initial candidates. Post-retrieval processing (reranking via Reranker and MMR via MmrLambda) is applied regardless of the chosen strategy.

Built-in strategies include VectorRetrievalStrategy (semantic similarity), Bm25RetrievalStrategy (keyword matching), and HybridRetrievalStrategy (combined with Reciprocal Rank Fusion).

Exceptions

ArgumentNullException

Thrown if set to null.

See Also
Share