Constructor VectorStoreRetriever
VectorStoreRetriever(VectorStoreCollection<TKey, TRecord>, Func<TRecord, RagSource>, Action<VectorStoreRetrieverOptions<TRecord>>?)
Creates a retriever over one MEVD collection.
[RequiresDynamicCode("MEVD reflects over TRecord to build a collection model.")]
[RequiresUnreferencedCode("MEVD reflects over TRecord to build a collection model.")]
public VectorStoreRetriever(VectorStoreCollection<TKey, TRecord> collection, Func<TRecord, RagSource> project, Action<VectorStoreRetrieverOptions<TRecord>>? configure = null)
Parameters
collectionVectorStoreCollection<TKey, TRecord>The collection to search.
projectFunc<TRecord, RagSource>Maps a record to its content: Id, Text, and optionally Title, Uri and Record. It takes the record alone, and it is the same one-argument signature
AddVectorStoreRetrievertakes - there is exactly one projector shape in this package.The retriever, not the projector, supplies the scoring fields. After calling
projectthe retriever re-stamps the result withsource with { Score = result.Score ?? 0d, ScoreKind = kind, Ordinal = 0 }, wherekindis Relevance on the hybrid lane and Distance on the vector lane. Anything the projector set on those threeinitproperties is overwritten. That is deliberate: the polarity is a property of the search lane the retriever chose at runtime, not of the record, and a projector cannot know which lane ran. A projector that guesses is the exact bug RetrievalScoreKind exists to prevent.Ordinal stays 0 here and is assigned by
RagPrompts.Formatafter ranking and clamping, because it is a position in the assembled block rather than a property of the source.configureAction<VectorStoreRetrieverOptions<TRecord>>Configures the retriever options.