UpsertAsync(TRecord, CancellationToken)

This method updates or inserts a record 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(TRecord record, CancellationToken cancellationToken = default);

Parameters

  • record

    The record 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.