diff --git a/nuget-package.props b/nuget-package.props index fc0c4c883..4c182da8d 100644 --- a/nuget-package.props +++ b/nuget-package.props @@ -1,7 +1,7 @@  - 0.38.0 + 0.39.0 false diff --git a/service/Abstractions/MemoryStorage/IMemoryDb.cs b/service/Abstractions/MemoryStorage/IMemoryDb.cs index 7945038e4..990d14cac 100644 --- a/service/Abstractions/MemoryStorage/IMemoryDb.cs +++ b/service/Abstractions/MemoryStorage/IMemoryDb.cs @@ -39,7 +39,7 @@ Task DeleteIndexAsync( CancellationToken cancellationToken = default); /// - /// Insert/Update a vector + payload, creates the given index if it does not exist. + /// Insert/Update a vector + payload. /// /// Index/Collection name /// Vector + payload to save diff --git a/service/Abstractions/MemoryStorage/IMemoryDbBatchUpsert.cs b/service/Abstractions/MemoryStorage/IMemoryDbBatchUpsert.cs new file mode 100644 index 000000000..78c127fc5 --- /dev/null +++ b/service/Abstractions/MemoryStorage/IMemoryDbBatchUpsert.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All rights reserved. + +using System.Collections.Generic; +using System.Threading; + +namespace Microsoft.KernelMemory.MemoryStorage; + +/// +/// Interface for memory DB adapters supporting batch upsert. +/// The interface is not mandatory and not implemented by all connectors. +/// Handlers/Clients should check if the interface is available and leverage it to optimize throughput. +/// +public interface IMemoryDbBatchUpsert +{ + /// + /// Insert/Update a list of vectors + payload. + /// + /// Index/Collection name + /// Vectors + payload to save + /// Task cancellation token + /// Record IDs + /// Error returned if the index where to write doesn't exist + IAsyncEnumerable BatchUpsertAsync( + string index, + IEnumerable records, + CancellationToken cancellationToken = default); +}