VectorStoreCollection<TKey,TRecord>.GetAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetAsync(IEnumerable<TKey>, RecordRetrievalOptions, CancellationToken) |
Gets a batch of records from the vector store. Does not guarantee that the collection exists. |
GetAsync(TKey, RecordRetrievalOptions, CancellationToken) |
Gets a record from the vector store. Does not guarantee that the collection exists. Returns null if the record is not found. |
GetAsync(Expression<Func<TRecord,Boolean>>, Int32, FilteredRecordRetrievalOptions<TRecord>, CancellationToken) |
Gets matching records from the vector store. Does not guarantee that the collection exists. |
GetAsync(IEnumerable<TKey>, RecordRetrievalOptions, CancellationToken)
Gets a batch of records from the vector store. Does not guarantee that the collection exists.
public virtual System.Collections.Generic.IAsyncEnumerable<TRecord> GetAsync(System.Collections.Generic.IEnumerable<TKey> keys, Microsoft.Extensions.VectorData.RecordRetrievalOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAsync : seq<'Key> * Microsoft.Extensions.VectorData.RecordRetrievalOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Record (requires 'Record : null)>
override this.GetAsync : seq<'Key> * Microsoft.Extensions.VectorData.RecordRetrievalOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Record (requires 'Record : null)>
Public Overridable Function GetAsync (keys As IEnumerable(Of TKey), Optional options As RecordRetrievalOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TRecord)
Parameters
- keys
- IEnumerable<TKey>
The unique IDs associated with the record to get.
- options
- RecordRetrievalOptions
Optional options for retrieving the records.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The records associated with the specified unique keys.
Exceptions
The command fails to execute for any reason.
Remarks
The exact method of retrieval is implementation-specific and can vary based on database support. The default implementation of this method retrieves the records one after the other, but implementations which supporting batching can override to provide a more efficient implementation.
Only found records are returned, so the result set might be smaller than the requested keys.
This method throws for any issues other than records not being found.
Applies to
GetAsync(TKey, RecordRetrievalOptions, CancellationToken)
Gets a record from the vector store. Does not guarantee that the collection exists. Returns null if the record is not found.
public abstract System.Threading.Tasks.Task<TRecord?> GetAsync(TKey key, Microsoft.Extensions.VectorData.RecordRetrievalOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAsync : 'Key * Microsoft.Extensions.VectorData.RecordRetrievalOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Record (requires 'Record : null)>
Public MustOverride Function GetAsync (key As TKey, Optional options As RecordRetrievalOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TRecord)
Parameters
- key
- TKey
The unique ID associated with the record to get.
- options
- RecordRetrievalOptions
Optional options for retrieving the record.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The record if found, otherwise null.
Exceptions
The command fails to execute for any reason.
Applies to
GetAsync(Expression<Func<TRecord,Boolean>>, Int32, FilteredRecordRetrievalOptions<TRecord>, CancellationToken)
Gets matching records from the vector store. Does not guarantee that the collection exists.
public abstract System.Collections.Generic.IAsyncEnumerable<TRecord> GetAsync(System.Linq.Expressions.Expression<Func<TRecord,bool>> filter, int top, Microsoft.Extensions.VectorData.FilteredRecordRetrievalOptions<TRecord>? options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAsync : System.Linq.Expressions.Expression<Func<'Record, bool>> * int * Microsoft.Extensions.VectorData.FilteredRecordRetrievalOptions<'Record (requires 'Record : null)> * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Record (requires 'Record : null)>
Public MustOverride Function GetAsync (filter As Expression(Of Func(Of TRecord, Boolean)), top As Integer, Optional options As FilteredRecordRetrievalOptions(Of TRecord) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TRecord)
Parameters
- filter
- Expression<Func<TRecord,Boolean>>
The predicate to filter the records.
- top
- Int32
The maximum number of results to return.
Options for retrieving the records.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests. The default is None.
Returns
The records that match the given predicate.
Exceptions
The command fails to execute for any reason.