Skip to main content

Function: getTopKEmbeddings()

getTopKEmbeddings(queryEmbedding, embeddings, similarityTopK?, embeddingIds?, similarityCutoff?): [number[], any[]]

Get the top K embeddings from a list of embeddings ordered by similarity to the query.

Parameters

queryEmbedding: number[]

embeddings: number[][]

list of embeddings to consider

similarityTopK?: number

max number of embeddings to return, default 2

embeddingIds?: null | any[]

ids of embeddings in the embeddings list

similarityCutoff?: null | number

minimum similarity score

Returns

[number[], any[]]

Defined in

packages/core/embeddings/dist/index.d.ts:32