Table of Contents

Method Clear

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

Clear()

Removes all stored data from the memory.

public void Clear()

Examples

Example: Resetting agent memory

using LMKit.Agents;
using LMKit.Model;

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

// Add some data
await memory.SaveInformationAsync("test", "Test data.", "test_001");
Console.WriteLine($"Before clear: {memory.DataSources.Count} data source(s)");

// Clear all memory
memory.Clear();
Console.WriteLine($"After clear: {memory.DataSources.Count} data source(s)");
Console.WriteLine($"Is empty: {memory.IsEmpty()}");

Remarks

After calling this method, IsEmpty() returns true and DataSources is empty.