MaxMarginalRelevanceSearchOptionsOptions for configuring a maximal marginal relevance (MMR) search.
MMR search optimizes for both similarity to the query and diversity among the results, balancing the retrieval of relevant documents with variation in the content returned.
Fields:
fetchK (optional): The initial number of documents to retrieve from the
vector store before applying the MMR algorithm. This larger set provides a
pool of documents from which the algorithm can select the most diverse
results based on relevance to the query.
filter (optional): A filter of type FilterType to refine the search
results, allowing additional conditions to target specific subsets
of documents.
k: The number of documents to return in the final results. This is the
primary count of documents that are most relevant to the query.
lambda (optional): A value between 0 and 1 that determines the balance
between relevance and diversity:
lambda of 0 emphasizes diversity, maximizing content variation.lambda of 1 emphasizes similarity to the query, focusing on relevance.
Values between 0 and 1 provide a mix of relevance and diversity.Specifies the number of documents to retrieve for each search query. Defaults to 4 if not specified, providing a basic result count for similarity or MMR searches.