UpsertAsync(IEnumerable<TRecord>, CancellationToken)

This method updates or inserts a batch of records into the vector store. It does not guarantee the existence of the collection. If the record already exists, it is updated; if it does not exist, it is created.

Declaration

// C#
public async Task UpsertAsync(IEnumerable<TRecord> records, CancellationToken cancellationToken = default);

Parameters

  • records

    The records to update or insert.

  • cancellationToken

    The cancellation token.

Return Value

Task representing the asynchronous operation when the records are updated or inserted.

Implements

Microsoft.Extensions.VectorData.VectorStoreCollection

Exceptions

VectorStoreException: The command fails to execute for any reason other than the absence of a record.

Remarks

All records are upserted when succeed or none when fails.