Okapi BM25 + Reciprocal Rank Fusion (RRF) + MMR Chunk Reranker
rerank_hybrid_rag_chunksReranks and deduplicates candidate RAG or retrieval passages against a search prompt using Okapi BM25 (k1=1.5, b=0.75), Reciprocal Rank Fusion (RRF), and Maximal Marginal Relevance (MMR) Jaccard diversity filtering. Use when selecting the top-K highest-signal, non-redundant passages from vector search or grep results; for compressing a single contiguous source file while keeping its original line order, use prune_context_skeleton instead. Read-only edge call (32 KB, 60 RPM): accepts 'search_prompt' ('documents_json' defaults to 'standard'), uses '?demo=true' or L402 (15 sats); HTTP 400 if invalid.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"search_prompt": "<search_prompt>",
"documents_json": "<documents_json>"
},
"name": "rerank_hybrid_rag_chunks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top_k | No | Maximum number of deduplicated chunks to return; defaults to 5 when omitted. | |
| ranking_mode | No | Fusion weighting between lexical BM25 and diversity penalty; defaults to 'bm25_rrf_mmr' when omitted. | |
| search_prompt | Yes | Technical search prompt or question used to score candidate chunks. | |
| documents_json | Yes | JSON string or array of candidate chunks '[{"id":"c1","text":"..."}]' to rerank. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Evaluated search query. | |
| ranked_chunks | Yes | Ordered top-K chunks with bm25_score, rrf_score, and mmr_score. | |
| returned_count | Yes | Number of deduplicated top-K chunks returned. | |
| total_candidates | Yes | Number of input candidate chunks scored. |