Method to perform a similarity search in the memory vector store. It
calculates the similarity between the query vector and each vector in
the store, sorts the results by similarity, and returns the top k
results along with their scores.
similaritySearchVectorWithScore(
query: number[],
k: number,
filter: (doc: Document) => boolean
): Promise<[Document<Record<string, any>>, number][]>| Name | Type | Description |
|---|---|---|
query* | number[] | Query vector to compare against the vectors in the store. |
k* | number | Number of top results to return. |
filter | (doc: Document) => boolean | Optional filter function to apply to the vectors before performing the search. |