Share via


VectorStoreCollection<TKey,TRecord>.DeleteAsync Method

Definition

Overloads

DeleteAsync(IEnumerable<TKey>, CancellationToken)

Deletes a batch of records from the vector store. Does not guarantee that the collection exists.

DeleteAsync(TKey, CancellationToken)

Deletes a record from the vector store. Does not guarantee that the collection exists.

DeleteAsync(IEnumerable<TKey>, CancellationToken)

Deletes a batch of records from the vector store. Does not guarantee that the collection exists.

public virtual System.Threading.Tasks.Task DeleteAsync(System.Collections.Generic.IEnumerable<TKey> keys, System.Threading.CancellationToken cancellationToken = default);
abstract member DeleteAsync : seq<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.DeleteAsync : seq<'Key> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function DeleteAsync (keys As IEnumerable(Of TKey), Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

keys
IEnumerable<TKey>

The unique IDs associated with the records to remove.

cancellationToken
CancellationToken

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

Returns

A Task that completes when the records have been deleted.

Exceptions

The command fails to execute for any reason other than that a record does not exist.

Remarks

The exact method of deleting is implementation-specific and can vary based on database support. The default implementation of this method deletes the records one after the other, but implementations which supporting batching can override to provide a more efficient implementation.

If a record isn't found, it is ignored and the batch succeeds. If any record can't be deleted for any other reason, the operation throws. Some records might have already been deleted while others might not have, so the entire operation should be retried.

Applies to

DeleteAsync(TKey, CancellationToken)

Deletes a record from the vector store. Does not guarantee that the collection exists.

public abstract System.Threading.Tasks.Task DeleteAsync(TKey key, System.Threading.CancellationToken cancellationToken = default);
abstract member DeleteAsync : 'Key * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public MustOverride Function DeleteAsync (key As TKey, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

key
TKey

The unique ID associated with the record to remove.

cancellationToken
CancellationToken

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

Returns

The unique identifier for the record.

Exceptions

The command fails to execute for any reason other than that the record does not exist.

Applies to