# maximal_marginal_relevance

> **Function** in `langchain_chroma`

📖 [View in docs](https://reference.langchain.com/python/langchain-chroma/vectorstores/maximal_marginal_relevance)

Calculate maximal marginal relevance.

## Signature

```python
maximal_marginal_relevance(
    query_embedding: np.ndarray,
    embedding_list: list,
    lambda_mult: float = 0.5,
    k: int = 4,
) -> list[int]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `query_embedding` | `np.ndarray` | Yes | Query embedding. |
| `embedding_list` | `list` | Yes | List of embeddings to select from. |
| `lambda_mult` | `float` | No | 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. (default: `0.5`) |
| `k` | `int` | No | Number of Documents to return. (default: `4`) |

## Returns

`list[int]`

List of indices of embeddings selected by maximal marginal relevance.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/311675a517f51ec6c77454124293c58df517e952/libs/partners/chroma/langchain_chroma/vectorstores.py#L109)