Partager via


PineconeMemoryStore.GetNearestMatchesAsync Method

Definition

Gets the nearest matches to an embedding of type Single. Does not guarantee that the collection exists.

public System.Collections.Generic.IAsyncEnumerable<(Microsoft.SemanticKernel.Memory.MemoryRecord, double)> GetNearestMatchesAsync (string collectionName, ReadOnlyMemory<float> embedding, int limit, double minRelevanceScore = 0, bool withEmbeddings = false, System.Threading.CancellationToken cancellationToken = default);
abstract member GetNearestMatchesAsync : string * ReadOnlyMemory<single> * int * double * bool * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<ValueTuple<Microsoft.SemanticKernel.Memory.MemoryRecord, double>>
override this.GetNearestMatchesAsync : string * ReadOnlyMemory<single> * int * double * bool * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<ValueTuple<Microsoft.SemanticKernel.Memory.MemoryRecord, double>>
Public Function GetNearestMatchesAsync (collectionName As String, embedding As ReadOnlyMemory(Of Single), limit As Integer, Optional minRelevanceScore As Double = 0, Optional withEmbeddings As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of ValueTuple(Of MemoryRecord, Double))

Parameters

collectionName
String

in the case of Pinecone, collectionName is synonymous with indexName

embedding
ReadOnlyMemory<Single>

The embedding to search for

limit
Int32

The maximum number of results to return

minRelevanceScore
Double

The minimum relevance score to return

withEmbeddings
Boolean

Whether to return the embeddings with the results

cancellationToken
CancellationToken

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

Returns

A group of tuples where item1 is a MemoryRecord and item2 is its similarity score as a Double.

Implements

Applies to