Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents.
max_marginal_relevance_search_by_vector(
self,
embedding: list[float],
k: int = DEFAULT_K,
fetch_k: int = 20,
lambda_mult: float = 0.5,
filter: dict[str, str] | None = None,
where_document: dict[str, str] | None = None,
**kwargs: Any = {}
) -> list[Document]| Name | Type | Description |
|---|---|---|
embedding* | list[float] | Embedding to look up documents similar to. |
k | int | Default: DEFAULT_KNumber of |
fetch_k | int | Default: 20Number of |
lambda_mult | float | Default: 0.5Number between 0 and 1 that determines the degree
of diversity among the results with |
filter | dict[str, str] | None | Default: NoneFilter by metadata. |
where_document | dict[str, str] | None | Default: Nonedict used to filter by the document contents.
e.g. |
kwargs | Any | Default: {}Additional keyword arguments to pass to Chroma collection query. |