Commit 514f07e
committed
Stop sending a null threshold, and show what the engine actually said
Live testing: mem0 store and list succeeded, recall answered 400. The
cause is that `RecallOpts::min_score` is an `Option<f64>` and the search
body interpolated it directly, so an unset minimum serialised as
`"threshold": null`. The hosted platform types that field as a number in
0..=1 and rejects an explicit null. `search_body` now omits the field
when no minimum was asked for, and clamps `top_k` into the documented
1..=1000 for the same reason -- a limit outside the range is a
validation error, not a smaller result set.
The 400 was harder to diagnose than it should have been, because the
error carried a status and nothing else. Hosted engines explain
themselves in the response body -- mem0 answers `{"detail": "..."}`,
cognee likewise -- and `status_error` was discarding it, turning "this
one field is invalid" into "something, somewhere, was wrong". It now
includes the body, truncated to 300 characters: an error body is not a
payload budget, and only error bodies reach this path.
Both flavours share the builder, so the self-hosted arm stops sending a
null threshold too -- its server tolerated it, which is why this went
unnoticed there.
cargo test -p tinymemory-remote --lib: 27 passed (3 new, pinning the
omitted threshold, the sent one, and the clamp)1 parent d146bf2 commit 514f07e
2 files changed
Lines changed: 91 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
201 | 217 | | |
202 | 218 | | |
203 | 219 | | |
| |||
209 | 225 | | |
210 | 226 | | |
211 | 227 | | |
212 | | - | |
| 228 | + | |
213 | 229 | | |
214 | 230 | | |
215 | | - | |
| 231 | + | |
216 | 232 | | |
217 | 233 | | |
218 | 234 | | |
| |||
232 | 248 | | |
233 | 249 | | |
234 | 250 | | |
235 | | - | |
| 251 | + | |
| 252 | + | |
236 | 253 | | |
237 | 254 | | |
238 | 255 | | |
| |||
248 | 265 | | |
249 | 266 | | |
250 | 267 | | |
251 | | - | |
| 268 | + | |
| 269 | + | |
252 | 270 | | |
253 | 271 | | |
254 | 272 | | |
| |||
271 | 289 | | |
272 | 290 | | |
273 | 291 | | |
274 | | - | |
| 292 | + | |
| 293 | + | |
275 | 294 | | |
276 | 295 | | |
277 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
289 | 309 | | |
290 | 310 | | |
291 | 311 | | |
| |||
421 | 441 | | |
422 | 442 | | |
423 | 443 | | |
424 | | - | |
425 | | - | |
426 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
427 | 450 | | |
428 | 451 | | |
429 | 452 | | |
| |||
442 | 465 | | |
443 | 466 | | |
444 | 467 | | |
445 | | - | |
446 | | - | |
447 | | - | |
| 468 | + | |
448 | 469 | | |
449 | 470 | | |
450 | 471 | | |
| |||
483 | 504 | | |
484 | 505 | | |
485 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
0 commit comments