Class ExtractedMemory
Represents a single fact or piece of information extracted from a conversation turn by the LMKit.Agents.Memory.MemoryExtractor.
public sealed class ExtractedMemory
- Inheritance
-
ExtractedMemory
- Inherited Members
Examples
Example: Inspecting extracted memories via the event
using LMKit.Agents;
using LMKit.Agents.Memory;
var extractor = new MemoryExtractor();
extractor.BeforeMemoryStored += (sender, args) =>
{
foreach (var mem in args.Memories)
{
Console.WriteLine($"[{mem.Importance}] [{mem.MemoryType}] {mem.Text}");
// Cancel low-importance memories
if (mem.Importance == MemoryImportance.Low)
{
mem.Cancel = true;
}
}
};
Remarks
Each ExtractedMemory contains a concise textual statement, a memory type classification, an importance level, and a category label. These properties are determined by the LLM during the extraction process.
Extracted memories are surfaced through the MemoryExtractionEventArgs event before being stored, allowing the application to inspect, modify, or cancel individual memories.
Properties
- Cancel
Gets or sets a value indicating whether this memory should be skipped and not stored.
- Category
Gets the category label assigned by the extractor.
- Importance
Gets the importance level assigned by the extractor.
- MemoryType
Gets the memory type classification assigned by the extractor.
- Text
Gets the concise textual statement representing the extracted fact.