new: queryless score 1#1088
Conversation
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThis PR makes three sets of changes:
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Rationale: small, homogeneous constant edits in production code combined with broader, heterogeneous test-suite changes (new helpers, fixture scope changes, propagation of options across many test sites, and test removal) require moderate review to verify test behavior, cleanup, and that caching/local_files_only logic is correctly applied. Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
* tests: remove redundant test * new: improve caching, reduce number of hf requests * fix: fix possible cache_dir key error
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/embed_tests/test_local_inference.py (1)
49-78: Consider refactoring to avoid star-arg unpacking after keyword arguments.The static analysis tool flags the pattern where
*argsappears after modifying**kwargs(lines 54, 62, 70, 78). While functional, this pattern is discouraged because it can lead to confusion about argument precedence.Consider refactoring to pass positional args before setting kwargs, or avoid mixing
*argswith modified**kwargs:@lru_cache def _cached_text_embedding(model_name, *args, **kwargs): cache_dir = kwargs.get("cache_dir") or _get_cache_dir_name(model_name) kwargs["cache_dir"] = cache_dir kwargs["local_files_only"] = kwargs.get("local_files_only", Path(cache_dir).exists()) - return TextEmbedding(model_name=model_name, *args, **kwargs) + return TextEmbedding(model_name=model_name, **kwargs)Apply similar changes to the other cached embedding functions if
*argsis not actually used.Based on static analysis hints.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
tests/embed_tests/test_local_inference.py(23 hunks)tests/test_fastembed.py(0 hunks)
💤 Files with no reviewable changes (1)
- tests/test_fastembed.py
🧰 Additional context used
🧬 Code graph analysis (1)
tests/embed_tests/test_local_inference.py (2)
qdrant_client/http/models/models.py (3)
Document(697-708)Image(1068-1079)PointStruct(1884-1887)qdrant_client/qdrant_client.py (1)
QdrantClient(27-3173)
🪛 Ruff (0.14.1)
tests/embed_tests/test_local_inference.py
54-54: Star-arg unpacking after a keyword argument is strongly discouraged
(B026)
62-62: Star-arg unpacking after a keyword argument is strongly discouraged
(B026)
70-70: Star-arg unpacking after a keyword argument is strongly discouraged
(B026)
78-78: Star-arg unpacking after a keyword argument is strongly discouraged
(B026)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Redirect rules - poetic-froyo-8baba7
- GitHub Check: Header rules - poetic-froyo-8baba7
- GitHub Check: Pages changed - poetic-froyo-8baba7
- GitHub Check: Python 3.12.x on ubuntu-latest test
- GitHub Check: Python 3.10.x on ubuntu-latest test
- GitHub Check: Python 3.13.x on ubuntu-latest test
- GitHub Check: Python 3.9.x on ubuntu-latest test
- GitHub Check: Python 3.11.x on ubuntu-latest test
🔇 Additional comments (6)
tests/embed_tests/test_local_inference.py (6)
6-8: LGTM: Clean temporary directory scaffolding.The temporary directory setup and cleanup fixture are properly implemented. The module-scoped cleanup ensures the temp directory is removed after all tests in the module complete.
Also applies to: 36-47
81-81: Fixture scope change aligns with new caching strategy.The scope change from
sessiontomoduleis appropriate given the introduction of module-levelSESSION_TMP_DIRand per-model cache directories. This ensures proper isolation between test modules.
352-360: Verify the necessity of mutating document options after creation.The code mutates the
optionsdictionary of previously created documents (lines 352-360), settinglocal_files_onlybased on cache existence. While this may ensure the cache is available for subsequent operations, mutating shared document state can be fragile and make tests order-dependent.Consider whether these mutations are necessary, or if the documents should be recreated with the correct options for each test phase. If the mutation is intentional to reflect that models are now cached after the first upload, consider adding a comment explaining this behavior.
# After first upload, models are cached locally for text_doc in (dense_doc_1, dense_doc_2, dense_doc_3): text_doc.options["local_files_only"] = Path(text_doc.options["cache_dir"]).exists()
426-444: LGTM: Consistent cache options propagation.The cache directory and options handling in these test functions follows the same correct pattern: compute cache directory, prepare options dict with conditional
local_files_only, then create documents with those options.Also applies to: 609-622, 685-703, 799-817
1520-1520: Verify the reason for skipping these tests.Three tests are marked with
@pytest.mark.skipbut don't include explanations for why they're disabled:
test_upsert_batch_with_different_options(line 1520)test_batch_size_propagation(line 1584)test_embed_multimodal(line 1675)These tests were modified to incorporate the new caching infrastructure but then skipped. This suggests they may be temporarily disabled during the transition.
Please clarify:
- Why are these tests skipped?
- Is there a plan to re-enable them?
- Should the skip markers include a reason string?
Consider using
@pytest.mark.skip(reason="...")to document why tests are disabled, or create tracking issues for re-enabling them.Also applies to: 1584-1584, 1675-1675
874-881: LGTM: Comprehensive cache options integration across test suite.The remaining test functions have been systematically updated to use the new caching infrastructure. The pattern is consistent and correct throughout:
- Compute cache directory using
_get_cache_dir_name- Create options dict with
cache_dirand conditionallocal_files_only- Pass options when creating
DocumentandImageobjectsThe repeated
local_files_onlychecks (e.g., lines 1312-1313, 1449-1450) appropriately handle progressive cache population during test execution.Also applies to: 995-1014, 1270-1398, 1414-1517
* new: queryless score 1 * Reduce hf requests (#1092) * tests: remove redundant test * new: improve caching, reduce number of hf requests * fix: fix possible cache_dir key error
qdrant/qdrant#7347