Commit 758f346
authored
feat(recall): structured per-stage scores and two-level min_scores filtering (#2422)
Replace the recall result's single `score` with a `scores` object exposing the
scores from each pipeline stage, and replace the `min_score` request param with
`min_scores`, a per-stage filter that operates at two levels.
Response — each result carries `scores`:
- final : the value results are ranked by
- reranker : cross-encoder normalized relevance (null for passthrough rerankers)
- semantic : raw vector cosine similarity (null if not surfaced semantically)
- text : raw keyword/BM25 score (null if not surfaced by keyword search)
Per-arm semantic/text scores are aggregated across retrieval arms during RRF /
interleave fusion (ArmScores on MergedCandidate), since fusion otherwise keeps
only the first-seen arm's score per doc.
Request — `min_scores` floors (inclusive, AND-ed, opt-in; default no filtering):
- semantic / text : retrieval-level cutoffs pushed into the SQL arms, overriding
the global similarity / BM25 minimums for the request (prune before fusion)
- reranker / final: post-query filters on the scored results
There is deliberately no default threshold: the cross-encoder's absolute scores
are reliable for ordering but not calibrated across queries (a clearly-relevant
match can score ~0.001 on one query and ~1.0 on another), so a fixed cutoff would
silently drop good results.
Also surfaces proof_norm in the search trace and reworks the control-plane trace
view to render scores at full precision (no rounding) and show the per-stage
`scores` breakdown; relabels the trace's "CE" column to "reranker score".
Threaded through engine, HTTP, MCP (both recall tools), and the control-plane
proxy; OpenAPI spec, Python/TS/Go/Rust clients, and the docs-skill mirror
regenerated; docs updated.1 parent 78d32cd commit 758f346
36 files changed
Lines changed: 1820 additions & 32 deletions
File tree
- hindsight-api-slim
- hindsight_api
- api
- engine
- search
- tests
- hindsight-clients
- go
- api
- python
- .openapi-generator
- hindsight_client_api
- models
- rust/src
- typescript/generated
- hindsight-cli
- src/commands
- hindsight-control-plane/src
- app/api/recall
- components
- lib
- hindsight-docs
- docs/developer
- api
- static
- skills/hindsight-docs/references
- developer
- api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
| |||
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
315 | 326 | | |
316 | 327 | | |
317 | 328 | | |
| |||
367 | 378 | | |
368 | 379 | | |
369 | 380 | | |
| 381 | + | |
370 | 382 | | |
371 | 383 | | |
372 | 384 | | |
| |||
3897 | 3909 | | |
3898 | 3910 | | |
3899 | 3911 | | |
| 3912 | + | |
3900 | 3913 | | |
3901 | 3914 | | |
3902 | 3915 | | |
| |||
3918 | 3931 | | |
3919 | 3932 | | |
3920 | 3933 | | |
| 3934 | + | |
3921 | 3935 | | |
3922 | 3936 | | |
3923 | 3937 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
363 | 365 | | |
364 | 366 | | |
365 | 367 | | |
| |||
3955 | 3957 | | |
3956 | 3958 | | |
3957 | 3959 | | |
| 3960 | + | |
3958 | 3961 | | |
3959 | 3962 | | |
3960 | 3963 | | |
| |||
4120 | 4123 | | |
4121 | 4124 | | |
4122 | 4125 | | |
| 4126 | + | |
4123 | 4127 | | |
4124 | 4128 | | |
4125 | 4129 | | |
| |||
4257 | 4261 | | |
4258 | 4262 | | |
4259 | 4263 | | |
| 4264 | + | |
4260 | 4265 | | |
4261 | 4266 | | |
4262 | 4267 | | |
| |||
4393 | 4398 | | |
4394 | 4399 | | |
4395 | 4400 | | |
| 4401 | + | |
| 4402 | + | |
4396 | 4403 | | |
4397 | 4404 | | |
4398 | 4405 | | |
| |||
4759 | 4766 | | |
4760 | 4767 | | |
4761 | 4768 | | |
| 4769 | + | |
| 4770 | + | |
| 4771 | + | |
| 4772 | + | |
| 4773 | + | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
| 4778 | + | |
| 4779 | + | |
| 4780 | + | |
| 4781 | + | |
| 4782 | + | |
| 4783 | + | |
| 4784 | + | |
| 4785 | + | |
| 4786 | + | |
| 4787 | + | |
| 4788 | + | |
| 4789 | + | |
| 4790 | + | |
| 4791 | + | |
| 4792 | + | |
4762 | 4793 | | |
4763 | 4794 | | |
4764 | 4795 | | |
| |||
5170 | 5201 | | |
5171 | 5202 | | |
5172 | 5203 | | |
| 5204 | + | |
| 5205 | + | |
| 5206 | + | |
| 5207 | + | |
| 5208 | + | |
| 5209 | + | |
| 5210 | + | |
| 5211 | + | |
| 5212 | + | |
| 5213 | + | |
| 5214 | + | |
| 5215 | + | |
| 5216 | + | |
| 5217 | + | |
| 5218 | + | |
| 5219 | + | |
| 5220 | + | |
| 5221 | + | |
| 5222 | + | |
5173 | 5223 | | |
5174 | 5224 | | |
5175 | 5225 | | |
| |||
5193 | 5243 | | |
5194 | 5244 | | |
5195 | 5245 | | |
| 5246 | + | |
5196 | 5247 | | |
5197 | 5248 | | |
5198 | 5249 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
175 | 216 | | |
176 | 217 | | |
177 | 218 | | |
| |||
231 | 272 | | |
232 | 273 | | |
233 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
234 | 279 | | |
235 | 280 | | |
236 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
86 | 95 | | |
87 | 96 | | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
91 | 100 | | |
92 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
93 | 106 | | |
94 | 107 | | |
95 | 108 | | |
| |||
118 | 131 | | |
119 | 132 | | |
120 | 133 | | |
| 134 | + | |
121 | 135 | | |
122 | 136 | | |
123 | 137 | | |
| |||
129 | 143 | | |
130 | 144 | | |
131 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
132 | 151 | | |
133 | 152 | | |
134 | 153 | | |
| |||
151 | 170 | | |
152 | 171 | | |
153 | 172 | | |
| 173 | + | |
154 | 174 | | |
155 | 175 | | |
156 | 176 | | |
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
| |||
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
107 | 109 | | |
108 | 110 | | |
109 | 111 | | |
| |||
143 | 145 | | |
144 | 146 | | |
145 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
146 | 154 | | |
147 | 155 | | |
148 | 156 | | |
| |||
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
206 | | - | |
| 214 | + | |
207 | 215 | | |
208 | 216 | | |
209 | 217 | | |
| |||
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
232 | | - | |
| 240 | + | |
233 | 241 | | |
234 | 242 | | |
235 | 243 | | |
| |||
277 | 285 | | |
278 | 286 | | |
279 | 287 | | |
280 | | - | |
| 288 | + | |
281 | 289 | | |
282 | 290 | | |
283 | 291 | | |
| |||
706 | 714 | | |
707 | 715 | | |
708 | 716 | | |
| 717 | + | |
| 718 | + | |
709 | 719 | | |
710 | 720 | | |
711 | 721 | | |
| |||
766 | 776 | | |
767 | 777 | | |
768 | 778 | | |
| 779 | + | |
| 780 | + | |
769 | 781 | | |
770 | 782 | | |
771 | 783 | | |
| |||
781 | 793 | | |
782 | 794 | | |
783 | 795 | | |
784 | | - | |
| 796 | + | |
785 | 797 | | |
786 | 798 | | |
787 | 799 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| 404 | + | |
404 | 405 | | |
405 | 406 | | |
406 | 407 | | |
| |||
0 commit comments