You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BM25 currently accepts avg_len=0, negative values and NaN. Embedding a nonempty document can then raise ZeroDivisionError or produce negative/NaN sparse weights.
Validate that avg_len is finite and positive during initialization. Add offline regressions through both Bm25 and SparseTextEmbedding, including signed zero, validation before downloads, valid fractional/default lengths, empty documents, and real parallel processing with a non-default average length.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: cdfdc92f-8a92-4ab1-847f-7dfe4029257b
📥 Commits
Reviewing files that changed from the base of the PR and between a460268 and 7e9daba.
📒 Files selected for processing: 2
fastembed/sparse/bm25.py
tests/test_bm25_parameters.py
🚧 Files skipped from review as they are similar to previous changes: 2
fastembed/sparse/bm25.py
tests/test_bm25_parameters.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Bm25 now raises ValueError when avg_len is non-finite or less than or equal to zero. The constructor documentation describes this constraint. Tests cover invalid values for both model classes, positive values, empty input, and matching serial and parallel embedding results.
No actionable issue has been established that would prevent merging after normal checks.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: validating BM25 average document length.
Description check
The description directly explains the BM25 validation change, affected invalid values, added regression coverage, and reported validation results.
Docstring Coverage
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BM25 currently accepts
avg_len=0, negative values and NaN. Embedding a nonempty document can then raiseZeroDivisionErroror produce negative/NaN sparse weights.Validate that
avg_lenis finite and positive during initialization. Add offline regressions through bothBm25andSparseTextEmbedding, including signed zero, validation before downloads, valid fractional/default lengths, empty documents, and real parallel processing with a non-default average length.Validation:
python -m pytest tests/test_bm25_parameters.py tests/test_common.py tests/test_parallel_processor.py -q— 27 passed.pre-commit run --files fastembed/sparse/bm25.py tests/test_bm25_parameters.py— passed.git diff --check— passed.All Submissions: