Share via


VectorStoreCollection<TKey,TRecord>.SearchAsync<TInput> Method

Definition

Searches the vector store for records that are similar to the given value.

public abstract System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.VectorData.VectorSearchResult<TRecord>> SearchAsync<TInput>(TInput searchValue, int top, Microsoft.Extensions.VectorData.VectorSearchOptions<TRecord>? options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member SearchAsync : 'Input * int * Microsoft.Extensions.VectorData.VectorSearchOptions<'Record (requires 'Record : null)> * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<Microsoft.Extensions.VectorData.VectorSearchResult<'Record>>
Public MustOverride Function SearchAsync(Of TInput) (searchValue As TInput, top As Integer, Optional options As VectorSearchOptions(Of TRecord) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of VectorSearchResult(Of TRecord))

Type Parameters

TInput

The type of the input value on which to perform the similarity search.

Parameters

searchValue
TInput

The value on which to perform the similarity search. See the remarks section for more details.

top
Int32

The maximum number of results to return.

options
VectorSearchOptions<TRecord>

The options that control the behavior of the search.

cancellationToken
CancellationToken

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

Returns

The records found by the vector search, including their result scores.

Implements

Applies to