Skip to content

Commit dd83bff

Browse files
authored
docs(recall): align min_scores score field names (#2432)
* docs(recall): align min_scores score field names * test: apply generated formatting
1 parent 911d27f commit dd83bff

6 files changed

Lines changed: 23 additions & 19 deletions

File tree

hindsight-api-slim/hindsight_api/engine/response_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def parse_metadata(cls, v: Any) -> dict[str, str] | None:
274274
)
275275
scores: RecallScores | None = Field(
276276
None,
277-
description="Recall scores from each pipeline stage (final/reranker/semantic/text). Not returned for source facts.",
277+
description="Recall scores from each pipeline stage (final/reranker/semantic/keyword). Not returned for source facts.",
278278
)
279279

280280

hindsight-api-slim/tests/test_chunking.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,4 +455,3 @@ def test_merged_json_array_routes_to_conversation_chunking():
455455
assert isinstance(parsed, list), f"Chunk must be a JSON array: {chunk[:60]}"
456456
assert all(isinstance(e, dict) for e in parsed), f"Every element must be a dict: {chunk[:60]}"
457457
assert all("role" in e for e in parsed), f"Every element must have a role key: {chunk[:60]}"
458-

hindsight-api-slim/tests/test_recall_min_score.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
33
Inserts memory_units with known content + real embeddings directly via SQL, then
44
verifies that recall_async:
5-
- returns a `scores` object (final/reranker/semantic/text) on every result,
5+
- returns a `scores` object (final/reranker/semantic/keyword) on every result,
66
- applies the post-query floors (`reranker`, `final`) to the scored results,
7-
- applies the retrieval-level floors (`semantic`, `text`) inside the SQL arms,
7+
- applies the retrieval-level floors (`semantic`, `keyword`) inside the SQL arms,
88
- is unchanged by the default (`min_scores=None`).
99
1010
Filtering is deterministic post/pre-processing, so these assertions are direct —

hindsight-api-slim/tests/test_retain_append_mode.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,12 @@ async def test_append_mode_conversation_arrays_produce_valid_json(memory, reques
254254

255255
try:
256256
# First retain - JSON conversation array
257-
turn1 = json.dumps([
258-
{"role": "user", "content": "Hello"},
259-
{"role": "assistant", "content": "Hi there"},
260-
])
257+
turn1 = json.dumps(
258+
[
259+
{"role": "user", "content": "Hello"},
260+
{"role": "assistant", "content": "Hi there"},
261+
]
262+
)
261263
await memory.retain_batch_async(
262264
bank_id=bank_id,
263265
contents=[
@@ -271,10 +273,12 @@ async def test_append_mode_conversation_arrays_produce_valid_json(memory, reques
271273
)
272274

273275
# Second retain - append more turns
274-
turn2 = json.dumps([
275-
{"role": "user", "content": "How are you"},
276-
{"role": "assistant", "content": "Doing well"},
277-
])
276+
turn2 = json.dumps(
277+
[
278+
{"role": "user", "content": "How are you"},
279+
{"role": "assistant", "content": "Doing well"},
280+
]
281+
)
278282
await memory.retain_batch_async(
279283
bank_id=bank_id,
280284
contents=[
@@ -300,10 +304,12 @@ async def test_append_mode_conversation_arrays_produce_valid_json(memory, reques
300304
assert len(parsed) == 4, "Should contain all 4 messages from both retains"
301305

302306
# Third retain - append again, verify no degradation
303-
turn3 = json.dumps([
304-
{"role": "user", "content": "What is new"},
305-
{"role": "assistant", "content": "Not much"},
306-
])
307+
turn3 = json.dumps(
308+
[
309+
{"role": "user", "content": "What is new"},
310+
{"role": "assistant", "content": "Not much"},
311+
]
312+
)
307313
await memory.retain_batch_async(
308314
bank_id=bank_id,
309315
contents=[
@@ -329,4 +335,3 @@ async def test_append_mode_conversation_arrays_produce_valid_json(memory, reques
329335

330336
finally:
331337
await memory.delete_bank(bank_id, request_context=request_context)
332-

hindsight-docs/docs/developer/api/recall.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ The retrieval-level floors (`semantic`/`keyword`) change *which candidates are c
377377

378378
**Use floors with care.** The reranker's scores are reliable for *ordering* but not as *absolute* values — a clearly-relevant memory can score `~0.001` on one query and `~1.0` on another, so a fixed cutoff risks silently dropping good results. Calibrate any threshold against the scores you actually observe (recall with no `min_scores` first and inspect the [`scores`](#scores) object).
379379

380-
The threshold is compared against the same `score` value the response reports. See the note under [`score`](#score) on why the scale is relative, not absolute, before relying on a fixed threshold.
380+
Each threshold is compared against the matching field in the response [`scores`](#scores) object. See the note under [`scores`](#scores) on why the scale is relative, not absolute, before relying on a fixed threshold.
381381

382382
---
383383

skills/hindsight-docs/references/developer/api/recall.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ The retrieval-level floors (`semantic`/`keyword`) change *which candidates are c
622622

623623
**Use floors with care.** The reranker's scores are reliable for *ordering* but not as *absolute* values — a clearly-relevant memory can score `~0.001` on one query and `~1.0` on another, so a fixed cutoff risks silently dropping good results. Calibrate any threshold against the scores you actually observe (recall with no `min_scores` first and inspect the [`scores`](#scores) object).
624624

625-
The threshold is compared against the same `score` value the response reports. See the note under [`score`](#score) on why the scale is relative, not absolute, before relying on a fixed threshold.
625+
Each threshold is compared against the matching field in the response [`scores`](#scores) object. See the note under [`scores`](#scores) on why the scale is relative, not absolute, before relying on a fixed threshold.
626626

627627
---
628628

0 commit comments

Comments
 (0)