maximal_marginal_relevance#

langchain_chroma.vectorstores.maximal_marginal_relevance(query_embedding: ndarray, embedding_list: list, lambda_mult: float = 0.5, k: int = 4) List[int][source]#

Calculate maximal marginal relevance.

Parameters:
  • query_embedding (ndarray) – Query embedding.

  • embedding_list (list) – List of embeddings to select from.

  • lambda_mult (float) – Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults to 0.5.

  • k (int) – Number of Documents to return. Defaults to 4.

Returns:

List of indices of embeddings selected by maximal marginal relevance.

Return type:

List[int]