PineconeMemoryStore.GetNearestMatchAsync 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.
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.