Skip to content

Conversation

abdokaseb
Copy link
Contributor

Related Issues

Proposed Changes:

The SentenceTransformersSimilarityRanker CrossEncoder model was returning score as a numpy.float32 without casting to float, which can cause JSON serialization issues in downstream integrations.

Explicitly cast the score to a standard Python float before assigning it to Document.score.

How did you test it?

Added a unit test to verify that Document.score is always a Python float.
Ran all existing unit tests with hatch run test:unit to ensure no regressions.

Notes for the reviewer

The change is minimal but important for serialization compatibility.

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@abdokaseb abdokaseb requested a review from a team as a code owner July 31, 2025 00:36
@abdokaseb abdokaseb requested review from Amnah199 and removed request for a team July 31, 2025 00:36
@CLAassistant
Copy link

CLAassistant commented Jul 31, 2025

CLA assistant check
All committers have signed the CLA.

@anakin87 anakin87 self-requested a review July 31, 2025 06:59
@coveralls
Copy link
Collaborator

coveralls commented Jul 31, 2025

Pull Request Test Coverage Report for Build 16703692448

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 91.885%

Files with Coverage Reduction New Missed Lines %
core/pipeline/async_pipeline.py 3 66.88%
Totals Coverage Status
Change from base Build 16654540600: -0.02%
Covered Lines: 12794
Relevant Lines: 13924

💛 - Coveralls

Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!

Overall, it's good.
I left some minor comments to address...

@github-actions github-actions bot added the type:documentation Improvements on the docs label Aug 1, 2025
@abdokaseb abdokaseb requested a review from anakin87 August 4, 2025 05:24
Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Thanks again!

@anakin87 anakin87 merged commit d0de78e into deepset-ai:main Aug 4, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SentenceTransformersSimilarityRanker returns Documents with numpy score
4 participants