Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

Commit 16b5394

Browse files
Add customizable metadata field to MemoryRecord and memory retrieval with embeddings is optional (#425)
### Motivation and Context This PR addresses 3 issues. 1. MemoryRecord now has a ValueString field - this is to support customizable metadata from the user. It is up to the user to serialize and deserialize this information. Closes microsoft/semantic-kernel#202 2. Retrieving the embedding from an IMemoryStore is optional and defaults to false. In the vast majority of cases, it is unnecessary and wasteful to pass the vector around the application, especially over a network. It is primarily used for similarity comparison which performed server-side for vector optimized data stores (ex: Qdrant). Closes microsoft/semantic-kernel#202 3. Refactored SqliteMemoryStore so that connections are disposed better. There were multiple cases of residual connections causing intermittent, unexpected unit test behavior. Closes microsoft/semantic-kernel#379, Closes microsoft/semantic-kernel#430 ### Description - `IMemoryStore` `Get` and `GetNearest` calls have a new boolean parameter called `withEmbedding`. This indicates whether or not the response should include the vector associated with the memory. For all existing memory connectors, this defaults to false. This boolean is propagated to `ISemanticTextMemory` `Get` and `Search` calls as well. - `MemoryRecord` has an optional field called `valueString` to allow the user to supply a custom metadata string. This is field is added to `ISemanticTextMemory` record creation as well. - Connectors.Sqlite.Memory `Database` is no longer a static class. The connection is supplied by the `SqliteMemoryStore` which also ensures its proper disposal. - Fixed a string interpolation bug in `SqliteMemoryStore` called out in multiple issues referenced above. - Added a few missing XML docs where necessary. - Added tests for `valueString` and `withEmbeddings`. - Some files not included in this PR got picked up with `dotnet format` and `codecleanup`
1 parent 99be0dc commit 16b5394

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎samples/apps/copilot-chat-app/webapi/Skills/ChatSkill.cs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Globalization;
1+
// Copyright (c) Microsoft. All rights reserved.
2+
3+
using System.Globalization;
24
using Microsoft.SemanticKernel;
35
using Microsoft.SemanticKernel.AI;
46
using Microsoft.SemanticKernel.AI.TextCompletion;

0 commit comments

Comments
 (0)