From c73feebf257442325d193e47645901271d436a2f Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 16 Jul 2023 02:16:58 -0700 Subject: [PATCH] Test index embeddings are stable on incremental update & no norm Ensure order of new embedding insertion on incremental update does not affect the order and value of existing embeddings when normalization is turned off --- tests/test_text_search.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/test_text_search.py b/tests/test_text_search.py index 6496a80d..830b0da5 100644 --- a/tests/test_text_search.py +++ b/tests/test_text_search.py @@ -196,7 +196,7 @@ def test_update_index_with_duplicate_entries_in_stable_order( def test_update_index_with_new_entry(content_config: ContentConfig, search_models: SearchModels, new_org_file: Path): # Arrange initial_notes_model = text_search.setup( - OrgToJsonl, content_config.org, search_models.text_search.bi_encoder, regenerate=True + OrgToJsonl, content_config.org, search_models.text_search.bi_encoder, regenerate=True, normalize=False ) # append org-mode entry to first org input file in config @@ -208,7 +208,7 @@ def test_update_index_with_new_entry(content_config: ContentConfig, search_model # update embeddings, entries with the newly added note content_config.org.input_files = [f"{new_org_file}"] final_notes_model = text_search.setup( - OrgToJsonl, content_config.org, search_models.text_search.bi_encoder, regenerate=False + OrgToJsonl, content_config.org, search_models.text_search.bi_encoder, regenerate=False, normalize=False ) # Assert @@ -218,7 +218,6 @@ def test_update_index_with_new_entry(content_config: ContentConfig, search_model # verify new entry appended to index, without disrupting order or content of existing entries error_details = compare_index(initial_notes_model, final_notes_model) if error_details: - # fails at embeddings index 4, 7. These are not swapped with the new entry embedding or each other pytest.fail(error_details, False) # Cleanup