Skip to content

fix(types): make RetrievalResult.score number | null to match API null return#87

Merged
EricNGOntos merged 1 commit into
mainfrom
fix/wuchengke/score-nullable
Jun 2, 2026
Merged

fix(types): make RetrievalResult.score number | null to match API null return#87
EricNGOntos merged 1 commit into
mainfrom
fix/wuchengke/score-nullable

Conversation

@EricNGOntos
Copy link
Copy Markdown
Contributor

Summary

Aligns the Node.js SDK's RetrievalResult interface with the updated API contract.

Background

The API's agentic retrieval route (/v1/retrieval/query) now returns null for score on chunks that were found only through KG navigation (no BM25 discovery score available). Previously the API hardcoded 1.0 as a placeholder, which was misleading.

Change

// Before
score: number;

// After
score: number | null;

null means 'no score available'. Consumers should treat it as unranked rather than assuming high relevance.

Testing

  • All 240 existing tests pass: vitest run
  • TypeScript compilation succeeds: tsc --noEmit
  • Test fixtures using numeric scores (e.g. score: 1) remain valid since number is still accepted

…l return

The agentic retrieval route now returns null for score when no real
score is available (navigation-only chunks). Previously the TypeScript
interface declared score as number which broke strict type-checking.

score: number → score: number | null
@EricNGOntos EricNGOntos added the sdk label Jun 2, 2026
@EricNGOntos EricNGOntos self-assigned this Jun 2, 2026
@EricNGOntos EricNGOntos merged commit e005630 into main Jun 2, 2026
0 of 4 checks passed
@EricNGOntos EricNGOntos deleted the fix/wuchengke/score-nullable branch June 2, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant