Skip to content

Commit c0aed31

Browse files
authored
fix(clients): thread recall min_scores through the maintained TypeScript SDK wrapper (#2467)
1 parent 2c53629 commit c0aed31

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

hindsight-clients/typescript/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import type {
5151
TagGroupAndInput,
5252
TagGroupOrInput,
5353
TagGroupNotInput,
54+
MinScores,
5455
AsyncOperationSubmitResponse,
5556
CreateMentalModelResponse,
5657
DirectiveListResponse,
@@ -337,6 +338,8 @@ export class HindsightClient {
337338
tagsMatch?: "any" | "all" | "any_strict" | "all_strict" | "exact";
338339
/** Compound tag filter using boolean groups. Groups are AND-ed. Each group is a leaf {tags, match} or compound {and: [...]}, {or: [...]}, {not: ...}. Mutually exclusive with tags/tagsMatch. */
339340
tagGroups?: Array<TagGroupLeaf | TagGroupAndInput | TagGroupOrInput | TagGroupNotInput>;
341+
/** Optional per-stage score floors, e.g. {semantic: 0.2, final: 0.5}. 'semantic' and 'keyword' are retrieval-level cutoffs; 'reranker' and 'final' are applied to the scored results after reranking. Any omitted stage imposes no floor. */
342+
minScores?: MinScores;
340343
signal?: AbortSignal;
341344
}
342345
): Promise<RecallResponse> {
@@ -368,6 +371,7 @@ export class HindsightClient {
368371
tags: options?.tags,
369372
tags_match: options?.tagsMatch,
370373
tag_groups: options?.tagGroups,
374+
min_scores: options?.minScores,
371375
},
372376
signal: options?.signal,
373377
});
@@ -1105,6 +1109,7 @@ export type {
11051109
TagGroupAndInput,
11061110
TagGroupOrInput,
11071111
TagGroupNotInput,
1112+
MinScores,
11081113
AsyncOperationSubmitResponse,
11091114
CreateMentalModelResponse,
11101115
DirectiveListResponse,

hindsight-clients/typescript/tests/main_operations.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,40 @@ const canSpyOnModules = typeof (globalThis as any).Deno === "undefined";
520520
spy.mockRestore();
521521
});
522522

523+
test("recall threads minScores into request body", async () => {
524+
const bankId = randomBankId();
525+
const spy = jest.spyOn(sdk, "recallMemories").mockResolvedValue({
526+
data: { results: [] },
527+
} as any);
528+
529+
await client.recall(bankId, "test", {
530+
minScores: { semantic: 0.2, final: 0.5 },
531+
});
532+
533+
expect(spy).toHaveBeenCalledWith(
534+
expect.objectContaining({
535+
body: expect.objectContaining({ min_scores: { semantic: 0.2, final: 0.5 } }),
536+
})
537+
);
538+
spy.mockRestore();
539+
});
540+
541+
test("recall omits min_scores when not provided", async () => {
542+
const bankId = randomBankId();
543+
const spy = jest.spyOn(sdk, "recallMemories").mockResolvedValue({
544+
data: { results: [] },
545+
} as any);
546+
547+
await client.recall(bankId, "test");
548+
549+
expect(spy).toHaveBeenCalledWith(
550+
expect.objectContaining({
551+
body: expect.objectContaining({ min_scores: undefined }),
552+
})
553+
);
554+
spy.mockRestore();
555+
});
556+
523557
test("getBankProfile passes abort signal to SDK", async () => {
524558
const bankId = randomBankId();
525559
const controller = new AbortController();

0 commit comments

Comments
 (0)