Returns documents selected using maximal marginal relevance to balance relevance and diversity.
Available in Embedded and JS/TS SDK. The Python SDK does not currently support MMR search.
Parameters
Returns
List[Document]: List of diverse, relevant Document objectsExample Usage
By Vector Variant
The Embedded library also provides max_marginal_relevance_search_by_vector for searching with a pre-computed embedding vector:Parameters:Example:Parameters
Returns
Promise<Document[]>: Array of diverse, relevant Document objectsThe JS/TS SDK does not have a separate by-vector variant. Use maxMarginalRelevanceSearch with a text query.
Example Usage
Async
The Embedded library provides an async version of this method prefixed with a:
JS/TS methods are natively async — all signatures above already return Promise<...>. No separate async variant is needed.