Table of Contents

Method SaveInformationAsync

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

SaveInformationAsync(string, string, string, MetadataCollection, CancellationToken)

Saves text information into a user-scoped data source using semantic memory type.

public Task<DataSource> SaveInformationAsync(string dataSourceIdentifier, string text, string sectionIdentifier, MetadataCollection additionalMetadata = null, CancellationToken cancellationToken = default)

Parameters

dataSourceIdentifier string

The data source identifier (without the user prefix). The user's namespace prefix is added automatically.

text string

The text content to store.

sectionIdentifier string

A unique identifier for this piece of information within the data source.

additionalMetadata MetadataCollection

Optional metadata to associate with the stored information.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<DataSource>

The DataSource containing the stored information.

Examples

Example: Storing user preferences

var userMemory = new UserScopedMemory(sharedMemory, "alice");
await userMemory.SaveInformationAsync("preferences", "Prefers dark mode.", "theme");
// Stored under data source: "alice::preferences"

SaveInformationAsync(string, string, string, MemoryType, MetadataCollection, CancellationToken)

Saves text information into a user-scoped data source with a specified memory type.

public Task<DataSource> SaveInformationAsync(string dataSourceIdentifier, string text, string sectionIdentifier, MemoryType memoryType, MetadataCollection additionalMetadata = null, CancellationToken cancellationToken = default)

Parameters

dataSourceIdentifier string

The data source identifier (without the user prefix).

text string

The text content to store.

sectionIdentifier string

A unique identifier for this piece of information.

memoryType MemoryType

The type of memory classification.

additionalMetadata MetadataCollection

Optional metadata to associate with the information.

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task<DataSource>

The DataSource containing the stored information.