Class InMemorySemanticMemory
- Namespace
- IntentSharp.Memory
- Assembly
- IntentSharp.dll
Thread-safe in-process memory with an optional size cap; the oldest entries go first. With an embedding provider,
recall uses embeddings when available and word overlap otherwise. A failed embedding is logged at Warning and
the entry is kept without one.
public sealed class InMemorySemanticMemory : ISemanticMemory
- Inheritance
-
objectInMemorySemanticMemory
- 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, IEmbeddingProvider?, ILogger?)
Creates an empty memory.
Methods
- ClearAsync(CancellationToken)
Removes every stored entry.
- GetStatsAsync(CancellationToken)
Returns counts over every stored entry.
- RecallAsync(string, int, CancellationToken)
Returns up to
maxResultsentries most similar toquery, most similar first; entries with no similarity are left out. The query is sent to the embedding provider when stored entries have embeddings.
- RecordAsync(MemoryEntry, CancellationToken)
Stores the entry; with an embedding provider, its intent text is sent to that provider for an embedding unless the entry has one. When the memory is full, the oldest entry is removed.