Table of Contents

Method IsEmpty

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

IsEmpty()

Determines whether the memory contains any stored data.

public bool IsEmpty()

Returns

bool

true if no information is stored; otherwise, false.

Examples

Example: Conditional memory initialization

using LMKit.Agents;
using LMKit.Model;

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

if (memory.IsEmpty())
{
    Console.WriteLine("Memory is empty. Loading initial knowledge...");
    await memory.SaveInformationAsync("init", "Initial system knowledge.", "startup");
}
else
{
    Console.WriteLine($"Memory contains {memory.DataSources.Count} data source(s).");
}

Remarks

Use this method to check if memory needs to be initialized or loaded before using an agent.