Return docs selected using the maximal marginal relevance.
Maximal marginal relevance optimizes for similarity to query AND diversity among selected documents.
amax_marginal_relevance_search_by_vector(
self,
embedding: list[float],
k: int = 4,
fetch_k: int = 20,
lambda_mult: float = 0.5,
filter: MetadataFilter | None = None,
search_params: models.SearchParams | None = None,
score_threshold: float | None = None,
consistency: models.ReadConsistency | None = None,
**kwargs: Any = {}
) -> list[Document]| Name | Type | Description |
|---|---|---|
embedding* | list[float] | Embedding vector to look up documents similar to. |
k | int | Default: 4Number of |
fetch_k | int | Default: 20Number of |
lambda_mult | float | Default: 0.5Number between |
filter | MetadataFilter | None | Default: NoneFilter by metadata. |
search_params | models.SearchParams | None | Default: NoneAdditional search params |
score_threshold | float | None | Default: NoneDefine a minimal score threshold for the result. If defined, less similar results will not be returned. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned. |
consistency | models.ReadConsistency | None | Default: NoneRead consistency of the search. Defines how many replicas should be queried before returning the result. Values:
|
**kwargs | Any | Default: {}Any other named arguments to pass through to
|