MentorAgent Docs
Menu

Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.

ReferencePackage: Novior.MentorAgent

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)

Namespace: Novior.MentorAgent.Memory. Package: Novior.MentorAgent.

public sealed class MentorMemoryService : IDisposable

Terminal
dotnet add package Novior.MentorAgent

public MentorMemoryService(IMentorMemoryStore store, IOptions<MentorOptions> options, ILogger<MentorMemoryService> logger, AuthenticationStateProvider? auth = null)

public void Dispose()

public Task ForgetAllAsync(CancellationToken ct = default)

public Task<string> GetMemoryContextAsync(int count = 10, CancellationToken ct = default)

public Task<string> GetUserIdAsync(CancellationToken ct = default)

public Task<string?> RecallAsync(string key, CancellationToken ct = default)

public Task RememberAsync(string key, string value, CancellationToken ct = default)

public Task RememberObjectAsync(string key, object value, CancellationToken ct = default)

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).