MentorVectorStoreRagOptions<TRecord>
The MentorVectorStoreRagOptions<TRecord> class of Novior.MentorAgent.Rag: How a MentorVectorStoreRagSource<TRecord> reads a collection of…
On this page
How a MentorVectorStoreRagSource<TRecord> reads a collection of Microsoft.Extensions.VectorData: what of a record becomes the document and its citation, which records a request may see, and the collection's distance function, which says what its scores mean.
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Rag. Package: Novior.MentorAgent.
public sealed class MentorVectorStoreRagOptions<TRecord>
dotnet add package Novior.MentorAgentConstructors
Section titled “Constructors”public MentorVectorStoreRagOptions()
Properties
Section titled “Properties”Content
Section titled “Content”public required Func<TRecord, string?> Content { get; init; }
The text of the document, the part the model reads. A record with no text is left out.
DefaultMinScore
Section titled “DefaultMinScore”public float DefaultMinScore { get; init; }
The threshold for this source's scores, used when the host does not set RagMinScore (IMentorRagSource.DefaultMinScore). Default: 0.5, a loose cosine similarity.
DistanceFunction
Section titled “DistanceFunction”public string? DistanceFunction { get; init; }
The collection's distance function, one of the DistanceFunction values. It says what a score means: with CosineDistance, the Postgres default, a lower score is nearer, and the source turns it into a similarity (1 − distance) so that RagMinScore keeps the nearest documents. null: read from the VectorStoreVectorAttribute of the record's vector property. When neither names one, registering the source fails: each store has a default of its own. CosineSimilarity, CosineDistance, DotProductSimilarity and NegativeDotProductSimilarity are accepted; a Euclidean, Manhattan or Hamming distance has no scale a threshold could be set on, and is refused.
EmbeddingGenerator
Section titled “EmbeddingGenerator”public IEmbeddingGenerator<string, Embedding<float>>? EmbeddingGenerator { get; init; }
The model that embeds the user's message, which must be the one the collection's documents were embedded with. null: MentorOptions.EmbeddingGenerator, whose vector of the message is computed once per turn and shared with routing, tool filtering and memory. When neither is set, the message's text goes to the collection, which embeds it with its own generator.
Filter
Section titled “Filter”public Func<MentorRagRequest, Expression<Func<TRecord, bool>>?>? Filter { get; init; }
The records this request may see, as the collection's filter: the tenant's own (MentorRagRequest.TenantId), those the user may read (MentorRagRequest.User). null, or a filter that returns null, searches the whole collection. With an IMentorTenantResolver and no filter, the first search with a tenant is logged as a warning: every tenant would be shown every tenant's documents.
Metadata
Section titled “Metadata”public Func<TRecord, IReadOnlyDictionary<string, string>?>? Metadata { get; init; }
Facts about the document the model should weigh with it — a date, a version, the product it applies to (MentorRagResult.Metadata).
SourceUrl
Section titled “SourceUrl”public Func<TRecord, string?>? SourceUrl { get; init; }
The link of the citation chip, if the document has one.
public Func<TRecord, string?>? Title { get; init; }
The title shown to the model above the document and on its citation chip.
VectorProperty
Section titled “VectorProperty”public Expression<Func<TRecord, object?>>? VectorProperty { get; init; }
The vector property to search, for a record with more than one; the only one otherwise.
