Recommend efficiency thresholds
recommend_efficiency_thresholdsCompute corpus-percentile thresholds for recall, ranking, and pruning efficiency from accumulated history, with optional filtering by backend, metric, or k to adapt thresholds to your deployment's normal behavior.
Instructions
Compute corpus-percentile thresholds from accumulated mcpg_rag.efficiency_observations history. Phase E currently adapts three thresholds: baseline_recall_low (p10 of recall_baseline), ranking_degraded_spearman (p10 of spearman), and pruning_ineffective (p10 of pages_pruned_ratio_p50). The remaining four thresholds stay at their hardcoded defaults. Filters by days window + optional backend / metric / k so callers can ask 'what's normal for HNSW+cosine+k=10 in this deployment' vs 'what's normal globally'. Falls back to defaults (with derived_from_corpus=false) when the corpus is smaller than the minimum required. Returns an object with corpus_size, derived_from_corpus (bool), and the threshold fields (baseline_recall_low, baseline_recall_low_adapted, ranking_degraded_spearman, ranking_degraded_spearman_adapted, pruning_ineffective, pruning_ineffective_adapted, rerank_lift_flat_delta, rerank_lift_steep_low, rerank_lift_steep_high, and ranking_degraded_recall).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | ||
| days | No | ||
| metric | No | ||
| backend | No | ||
| database | No | Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| corpus_size | Yes | ||
| baseline_recall_low | Yes | ||
| derived_from_corpus | Yes | ||
| pruning_ineffective | Yes | ||
| rerank_lift_steep_low | Yes | ||
| rerank_lift_flat_delta | Yes | ||
| rerank_lift_steep_high | Yes | ||
| ranking_degraded_recall | Yes | ||
| ranking_degraded_spearman | Yes | ||
| baseline_recall_low_adapted | Yes | ||
| pruning_ineffective_adapted | Yes | ||
| ranking_degraded_spearman_adapted | Yes |