Class MemoryExtractionEventArgs
Provides data for the BeforeMemoryStored event.
public sealed class MemoryExtractionEventArgs : EventArgs
- Inheritance
-
MemoryExtractionEventArgs
- Inherited Members
Examples
Example: Filtering extracted memories
using LMKit.Agents.Memory;
memory.BeforeMemoryStored += (sender, args) =>
{
Console.WriteLine($"Extracted {args.Memories.Count} memories from conversation turn.");
Console.WriteLine($"User said: {args.UserMessage}");
foreach (var mem in args.Memories)
{
// Only keep high-importance memories
if (mem.Importance != MemoryImportance.High)
{
mem.Cancel = true;
}
}
};
Remarks
This event is raised after AgentMemory has analyzed a conversation turn, identified facts worth remembering, and filtered out duplicates. The Memories list contains only new, non-duplicate memories that are about to be stored.
Subscribers can inspect the extracted memories, modify their cancel state, or cancel all
of them by setting CancelAll to true.
Properties
- AssistantResponse
Gets the assistant response from the conversation turn that was analyzed.
- CancelAll
Gets or sets a value indicating whether all extracted memories should be cancelled.
- Memories
Gets the list of memories extracted from the conversation turn.
- UserMessage
Gets the user message from the conversation turn that was analyzed.