Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.
MentorMemoryService class
The MentorMemoryService class of Novior.MentorAgent.Memory: Scoped service that orchestrates contextual memory. UserId resolved in this order: 1. Signed-in…
On this page
Scoped service that orchestrates contextual memory. UserId resolved in this order: 1. Signed-in user → its NameIdentifier as it is, else sub, oid or the name with the claim in the key ("sub:...", "name:...") — see MentorUserKey 2. Otherwise → an anonymous key, per session or shared (MentorOptions.AnonymousIdentity)
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Memory. Package: Novior.MentorAgent.
public sealed class MentorMemoryService : IDisposable
dotnet add package Novior.MentorAgentConstructors
Section titled “Constructors”public MentorMemoryService(IMentorMemoryStore store, IOptions<MentorOptions> options, ILogger<MentorMemoryService> logger, AuthenticationStateProvider? auth = null)
Methods
Section titled “Methods”Dispose
Section titled “Dispose”public void Dispose()
ForgetAllAsync
Section titled “ForgetAllAsync”public Task ForgetAllAsync(CancellationToken ct = default)
GetMemoryContextAsync
Section titled “GetMemoryContextAsync”public Task<string> GetMemoryContextAsync(int count = 10, CancellationToken ct = default)
GetUserIdAsync
Section titled “GetUserIdAsync”public Task<string> GetUserIdAsync(CancellationToken ct = default)
RecallAsync
Section titled “RecallAsync”public Task<string?> RecallAsync(string key, CancellationToken ct = default)
RememberAsync
Section titled “RememberAsync”public Task RememberAsync(string key, string value, CancellationToken ct = default)
RememberObjectAsync
Section titled “RememberObjectAsync”public Task RememberObjectAsync(string key, object value, CancellationToken ct = default)
SetCurrentQuery
Section titled “SetCurrentQuery”public void SetCurrentQuery(string? query)
Sets the current user message so MentorMemoryService.GetMemoryContextAsync can rank memories by relevance when MentorOptions.MemoryRelevanceFiltering is enabled. Called by the orchestrator before each message (scoped instance, same as RAG's PrepareAsync).
