Partager via


IVectorStoreRecordCollection<TKey,TRecord>.UpsertBatchAsync Method

Definition

Upserts a group of records into the vector store. Does not guarantee that the collection exists. If the record already exists, it will be updated. If the record does not exist, it will be created. Upserts will be made in a single request or in a single parallel batch depending on the available store functionality.

public System.Collections.Generic.IAsyncEnumerable<TKey> UpsertBatchAsync (System.Collections.Generic.IEnumerable<TRecord> records, Microsoft.SemanticKernel.Data.UpsertRecordOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member UpsertBatchAsync : seq<'Record (requires 'Record : null)> * Microsoft.SemanticKernel.Data.UpsertRecordOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Key>
Public Function UpsertBatchAsync (records As IEnumerable(Of TRecord), Optional options As UpsertRecordOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TKey)

Parameters

records
IEnumerable<TRecord>

The records to upsert.

options
UpsertRecordOptions

Optional options for upserting the records.

cancellationToken
CancellationToken

The CancellationToken to monitor for cancellation requests. The default is None.

Returns

The unique identifiers for the records.

Exceptions

Throw when the command fails to execute for any reason.

Throw when mapping between the storage model and record data model fails.

Applies to