search

package
v0.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaximalMarginalRelevance

func MaximalMarginalRelevance(
	queryEmbedding []float32,
	embeddingList [][]float32,
	lambdaMult float32,
	k int,
) ([]int, error)

MaximalMarginalRelevance implements the Maximal Marginal Relevance algorithm. It takes a query embedding, a list of embeddings, a lambda multiplier, and a number of results to return. It returns a list of indices of the embeddings that are most relevant to the query. See https://www.cs.cmu.edu/~jgc/publication/The_Use_MMR_Diversity_Based_LTMIR_1998.pdf Implementation borrowed from LangChain https://github.com/langchain-ai/langchain/blob/4a2f0c51a116cc3141142ea55254e270afb6acde/libs/langchain/langchain/vectorstores/utils.py

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL