This repository was archived by the owner on Aug 20, 2026. It is now read-only.
Repository navigation
Commit 16b5394
authored
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
0 commit comments