Skip to content

fix(types): make RetrievalResult.score Optional[float] to match API null return - #27

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

fix(types): make RetrievalResult.score Optional[float] to match API null return#27
EricNGOntos merged 2 commits into
mainfrom
fix/wuchengke/score-nullable

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

Aligns the Python SDK's RetrievalResult model 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

# Beforescore: float# Afterscore: Optional[float] =None

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

Testing

  • All 7 existing retrieval tests pass: pytest tests/test_retrieval.py
  • Pydantic correctly parses both null and numeric values from the API response

…ull return
The agentic retrieval route now returns null for score when no real
score is available (navigation-only chunks). Previously the SDK model
declared score as float which would fail Pydantic validation on null.
score: float → Optional[float] = None
@EricNGOntosEricNGOntos self-assigned this Jun 2, 2026
@EricNGOntos
EricNGOntos merged commit 06cf60f into mainJun 2, 2026
5 checks passed
@EricNGOntos
EricNGOntos deleted the fix/wuchengke/score-nullable branch June 2, 2026 00:22
@github-actionsgithub-actionsBot mentioned this pull request Jun 2, 2026
Sign up for freeto 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

@EricNGOntos