Partager via


IVectorStoreRecordCollection<TKey,TRecord>.GetBatchAsync Method

Definition

Gets a batch of records from the vector store. Does not guarantee that the collection exists. Gets will be made in a single request or in a single parallel batch depending on the available store functionality. Only found records will be returned, so the resultset may be smaller than the requested keys. Throws for any issues other than records not being found.

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

Parameters

keys
IEnumerable<TKey>

The unique ids associated with the record to get.

options
GetRecordOptions

Optional options for retrieving the records.

cancellationToken
CancellationToken

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

Returns

IAsyncEnumerable<TRecord>

The records associated with the unique keys provided.

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