mmr_search
Find diverse nearest neighbors by balancing relevance and diversity, reducing redundant results. Ideal for RAG pipelines needing broad coverage.
Instructions
Find diverse nearest neighbors using Maximal Marginal Relevance (MMR).
MMR balances relevance to the query with diversity among results, avoiding redundant near-duplicate results. This is ideal for RAG pipelines where you want broad coverage rather than 10 variations of the same paragraph.
Use this tool when: you need diverse vector search results for RAG or when vector_search returns too many near-duplicates. Use vector_search when: you want the absolute closest matches regardless of diversity.
Args: label: Node label to search within (e.g. "Document"). property: Property that holds the embedding vector (e.g. "embedding"). query_vector: The query embedding as a list of floats. k: Number of diverse results to return (default 10). fetch_k: Initial candidates from HNSW before MMR re-ranking (default: 4*k). Higher values give MMR more to choose from. lambda_mult: Balance between relevance and diversity. 0.0 = maximize diversity, 1.0 = maximize relevance. Default: 0.5 (balanced). For RAG, try 0.3-0.7. ef: HNSW search beam width. Leave as None for index default.
Returns: JSON array of {node_id, distance, labels, properties} ordered by MMR selection (not pure distance).
Example call: mmr_search("Document", "embedding", [0.12, -0.34, ...], k=5, lambda_mult=0.3)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | Yes | ||
| property | Yes | ||
| query_vector | Yes | ||
| k | No | ||
| fetch_k | No | ||
| lambda_mult | No | ||
| ef | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |