EmbeddingAgentMemoryStore<T>

Models & Types · AiDotNet.Agentic.Memory

A semantic IAgentMemoryStore that ranks memories by meaning, not words. It embeds each memory with an IEmbeddingModel and scores a query by cosine similarity against those embeddings — reusing AiDotNet’s RAG embedding and similarity-metric stack, so a memory about “due date” is recalled for a query about “deadline”.

Implements: IAgentMemoryStore

For Beginners

Same notebook idea, but instead of matching words it matches meaning. It turns every note (and your question) into a list of numbers that capture meaning, then finds the notes whose numbers are closest to your question’s — so synonyms and paraphrases still match.

How It Works

Memories and their embedding vectors are held in memory; the vector for each memory is computed once on AddAsync. This keeps the abstraction identical to the lexical InMemoryAgentMemoryStore while delivering true semantic recall — pick whichever fits the deployment without touching agent code.

Constructors

Constructor Summary
EmbeddingAgentMemoryStore(IEmbeddingModel<T> embeddingModel, ISimilarityMetric<T> similarity) Initializes a new semantic memory store.

Methods

Method Summary
Task RemoveAsync(string id, CancellationToken cancellationToken)
Task<IReadOnlyList<AgentMemory>> GetAllAsync(CancellationToken cancellationToken)
Task<IReadOnlyList<ScoredMemory>> SearchAsync(string query, int topK, CancellationToken cancellationToken)
Task<string> AddAsync(string content, IReadOnlyDictionary<string, string> metadata, CancellationToken cancellationToken)