fix: reject batch_size < 1 and handle empty-query benchmarks - #26
Merged
royalpinto007 merged 1 commit intoSep 22, 2026
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Validate ingest batch size and return empty-mode results for a zero-query benchmark instead of crashing.
Fixes #22 and #23.
Motivation
ingest_documents(..., batch_size=0)forwarded a zero step intorange(), which raisedValueError: range() arg 3 must not be zero.run_benchmarkdivided bylen(r5)even when the dataset had no queries, which raisedZeroDivisionError.Both were labeled good first issue / help wanted, were unassigned, and had no open PR.
Implementation
ingest_documentsraisesValueError("batch_size must be >= 1")before batching.batched()uses the same guard so other callers cannot hit the rawrange()error.run_benchmarktreats an empty query list as recall 0.0 / qps 0.0 and still returns aModeResultper requested mode (n_queries=0).Testing
Installed
pytest,qdrant-client, andprometheus-clientin an isolated environment (fullpip install -e .[dev]failed on a hatchling index 502).Result: 6 passed.
Not run: full suite (
test_search.py/test_benchmark_produces_numbers) because those need the project's FastEmbed optional stack and a longer install that was blocked here.Notes
No public API shape change besides the new validation error message requested in #22.