feat(ibm_db): support all 6 Db2 vector distance metrics - #4045
Open
GeetikaChughIBM wants to merge 3 commits into
Open
GeetikaChughIBM wants to merge 3 commits into
GeetikaChughIBM wants to merge 3 commits into
Conversation
Add two parametrized integration tests inside the existing TestDocumentStore class covering all 6 supported distance metrics (COSINE, DOT, EUCLIDEAN, EUCLIDEAN_SQUARED, HAMMING, MANHATTAN): - test_all_distance_metrics_return_ranked_results: verifies correct ranking, finite scores, and ORDER BY ASC ordering for each metric - test_all_distance_metrics_respect_filters: verifies metadata filters work correctly alongside each distance metric Each test creates an isolated table (embedding_dim=4) via the connection_config fixture, runs retrieval assertions, then drops the table. All 12 tests verified passing against a real Db2 instance.
- Move DuplicatePolicy import to correct sorted position (I001) - Remove unused noqa BLE001 directives (RUF100) - Collapse multi-line f-strings and remove alignment spaces to satisfy ruff formatter
Contributor
Coverage report (ibm_db)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
This branch has not been deployed
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
Extends the IBM Db2 document store to support all 6 distance metrics
available in Db2's
VECTOR_DISTANCEfunction, up from the previous 3.Changes
document_store.pydistance_metrictype annotation fromLiteral["EUCLIDEAN", "COSINE", "MANHATTAN"]to include all 6:COSINE,DOT,EUCLIDEAN,EUCLIDEAN_SQUARED,HAMMING,MANHATTANtest_document_store.pyTestIBMDb2DocumentStoreUnit) verifying:to_dict/from_dict_embedding_retrievalemits the correctVECTOR_DISTANCE(..., <METRIC>)SQL fragment for each metricTestDocumentStore) verifying against a real Db2 instance:test_all_distance_metrics_return_ranked_results— correct ranking and score ordering for each metrictest_all_distance_metrics_respect_filters— metadata filters work correctly alongside each metricTesting
All 12 integration tests verified passing against a real Db2 instance
Closes #4046