# MmrHelper

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/graph_vectorstores/mmr_helper/MmrHelper)

Helper for executing an MMR traversal query.

## Signature

```python
MmrHelper(
    self,
    k: int,
    query_embedding: list[float],
    lambda_mult: float = 0.5,
    score_threshold: float = NEG_INF,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `query_embedding` | `list[float]` | Yes | The embedding of the query to use for scoring. |
| `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. Defaults to 0.5. (default: `0.5`) |
| `score_threshold` | `float` | No | Only documents with a score greater than or equal this threshold will be chosen. Defaults to -infinity. (default: `NEG_INF`) |

## Constructors

```python
__init__(
    self,
    k: int,
    query_embedding: list[float],
    lambda_mult: float = 0.5,
    score_threshold: float = NEG_INF,
) -> None
```

| Name | Type |
|------|------|
| `k` | `int` |
| `query_embedding` | `list[float]` |
| `lambda_mult` | `float` |
| `score_threshold` | `float` |


## Properties

- `dimensions`
- `query_embedding`
- `lambda_mult`
- `lambda_mult_complement`
- `score_threshold`
- `selected_ids`
- `selected_mmr_scores`
- `selected_similarity_scores`
- `selected_embeddings`
- `candidate_id_to_index`
- `candidates`
- `candidate_embeddings`
- `best_score`
- `best_id`

## Methods

- [`candidate_ids()`](https://reference.langchain.com/python/langchain-community/graph_vectorstores/mmr_helper/MmrHelper/candidate_ids)
- [`pop_best()`](https://reference.langchain.com/python/langchain-community/graph_vectorstores/mmr_helper/MmrHelper/pop_best)
- [`add_candidates()`](https://reference.langchain.com/python/langchain-community/graph_vectorstores/mmr_helper/MmrHelper/add_candidates)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/graph_vectorstores/mmr_helper.py#L43)