Table of Contents

Method GetMemoryType

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

GetMemoryType(DataSource)

Retrieves the memory type associated with the specified data source.

public static MemoryType GetMemoryType(DataSource dataSource)

Parameters

dataSource DataSource

The data source to inspect.

Returns

MemoryType

The MemoryType stored in the data source's metadata. Returns Semantic if no memory type is specified.

Examples

Example: Inspecting memory types

using LMKit.Agents;
using LMKit.Model;

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

// Store different types
await memory.SaveInformationAsync("facts", "Water boils at 100C.", "physics", MemoryType.Semantic);
await memory.SaveInformationAsync("events", "Meeting at 3pm.", "calendar", MemoryType.Episodic);

// Check memory types
foreach (var ds in memory.DataSources)
{
    var memType = AgentMemory.GetMemoryType(ds);
    Console.WriteLine($"Data source '{ds.Identifier}' is of type: {memType}");
}

Remarks

This method reads the memory type from the data source's metadata. If the metadata does not contain a memory type key, Semantic is returned as the default.