Table of Contents

Property ExtractionMode

Namespace
LMKit.Agents
Assembly
LM-Kit.NET.dll

ExtractionMode

Gets or sets the automatic memory extraction mode.

public MemoryExtractionMode ExtractionMode { get; set; }

Property Value

MemoryExtractionMode

The strategy used for extracting facts from conversations. Default is None (manual storage only).

Examples

Example: Enabling automatic memory extraction

using LMKit.Agents;
using LMKit.Agents.Memory;
using LMKit.Model;

using var chatModel = new LM("path/to/chat-model.gguf"); using var embeddingModel = new LM("path/to/embedding-model.gguf");

var memory = new AgentMemory(embeddingModel); memory.ExtractionMode = MemoryExtractionMode.LlmBased;

var agent = Agent.CreateBuilder(chatModel) .WithMemory(memory) .Build();

// Now the agent automatically remembers facts from conversations await agent.RunAsync("Hi! My name is David and I work on .NET projects."); // Memory auto-stores: "The user's name is David", "The user works on .NET projects"

Remarks

When set to LlmBased, the memory system automatically analyzes each conversation turn (user message + assistant response) and stores relevant facts, preferences, and contextual information. Extracted memories are deduplicated against existing content before storage.

By default, extraction runs asynchronously in the background. Set RunExtractionSynchronously to true to block until extraction completes.

Share