Przejdź do głównej zawartości

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= DEFAULT_SIMILARITY_TOP_K

max number of embeddings to return, default 2

embeddingIds: null | any[]= null

ids of embeddings in the embeddings list

similarityCutoff: null | number= null

minimum similarity score

Returns

[number[], any[]]

Source

packages/llamaindex/src/embeddings/utils.ts:81