Partager via


PineconeMemoryStore.GetNearestMatchAsync Method

Definition

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

public System.Threading.Tasks.Task<(Microsoft.SemanticKernel.Memory.MemoryRecord, double)?> GetNearestMatchAsync (string collectionName, ReadOnlyMemory<float> embedding, double minRelevanceScore = 0, bool withEmbedding = false, System.Threading.CancellationToken cancellationToken = default);
abstract member GetNearestMatchAsync : string * ReadOnlyMemory<single> * double * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<ValueTuple<Microsoft.SemanticKernel.Memory.MemoryRecord, double>>>
override this.GetNearestMatchAsync : string * ReadOnlyMemory<single> * double * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Nullable<ValueTuple<Microsoft.SemanticKernel.Memory.MemoryRecord, double>>>
Public Function GetNearestMatchAsync (collectionName As String, embedding As ReadOnlyMemory(Of Single), Optional minRelevanceScore As Double = 0, Optional withEmbedding As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Nullable(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

minRelevanceScore
Double

The minimum relevance score to return

withEmbedding
Boolean

Whether to return the embeddings with the results

cancellationToken
CancellationToken

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

Returns

A tuple consisting of the MemoryRecord and the similarity score as a Double. Null if no nearest match found.

Implements

Applies to