Documentation
Table of Contents

Class InMemorySemanticMemory

Namespace
IntentSharp.Memory
Assembly
IntentSharp.dll

Thread-safe in-process memory with an optional size cap (oldest entries evicted first). Embeds intents when an embedding-capable provider is supplied. A failed embedding is logged at Warning and the entry is kept without one, so recall falls back to word overlap for it; only the caller's cancellation propagates.

public sealed class InMemorySemanticMemory : ISemanticMemory
Inheritance
object
InMemorySemanticMemory
Implements
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Extension Methods

Constructors

InMemorySemanticMemory(int, IAIProvider?, ILogger?)

Creates an empty memory. Without an embedding provider, or with one that does not support embeddings, recall uses word overlap only.

Methods

ClearAsync(CancellationToken)

Removes every stored entry.

GetStatsAsync(CancellationToken)

Returns counts over every stored entry.

RecallAsync(string, int, CancellationToken)

Returns up to maxResults entries most similar to query, newer first among equal scores. Uses embedding similarity for entries that have an embedding when the query can be embedded, and word overlap otherwise; entries with no similarity are left out.

RecordAsync(MemoryEntry, CancellationToken)

Stores the entry, first embedding its intent when an embedding provider is set and the entry has no embedding. When the memory is full, the entry recorded first is removed.