From f293d608db02f1ff7f02ff6a918106d6c915da5e Mon Sep 17 00:00:00 2001 From: GMayank0310 <166708007+GMayank0310@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:26:44 +0530 Subject: [PATCH] Cognition column limit (#1338) * made changes for the coginition colum limit and fixed test cases for the same * made changes for the coginition colum limit and fixed test cases for the same --- kairon/shared/cognition/processor.py | 2 +- tests/integration_test/services_test.py | 3 ++- tests/unit_test/data_processor/data_processor_test.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kairon/shared/cognition/processor.py b/kairon/shared/cognition/processor.py index 86ff98045..5a6e14c85 100644 --- a/kairon/shared/cognition/processor.py +++ b/kairon/shared/cognition/processor.py @@ -49,7 +49,7 @@ def is_column_collection_limit_exceeded(bot, user, metadata): """ bot_settings = MongoProcessor.get_bot_settings(bot, user) bot_settings = bot_settings.to_mongo().to_dict() - return len(metadata) >= bot_settings["cognition_columns_per_collection_limit"] + return len(metadata) > bot_settings["cognition_columns_per_collection_limit"] @staticmethod def is_same_column_in_metadata(metadata): diff --git a/tests/integration_test/services_test.py b/tests/integration_test/services_test.py index e0ca7c79d..03c91de8e 100644 --- a/tests/integration_test/services_test.py +++ b/tests/integration_test/services_test.py @@ -2256,7 +2256,8 @@ def test_metadata_upload_api_column_limit_exceeded(): {"column_name": "age", "data_type": "int", "enable_search": True, "create_embeddings": False}, {"column_name": "color", "data_type": "str", "enable_search": True, "create_embeddings": True}, {"column_name": "name", "data_type": "str", "enable_search": True, "create_embeddings": True}, - {"column_name": "gender", "data_type": "str", "enable_search": True, "create_embeddings": True} + {"column_name": "gender", "data_type": "str", "enable_search": True, "create_embeddings": True}, + {"column_name": "experience", "data_type": "str", "enable_search": True, "create_embeddings": True} ], "collection_name": "test_metadata_upload_api_column_limit_exceeded" }, diff --git a/tests/unit_test/data_processor/data_processor_test.py b/tests/unit_test/data_processor/data_processor_test.py index 560581ef3..32271ba1c 100644 --- a/tests/unit_test/data_processor/data_processor_test.py +++ b/tests/unit_test/data_processor/data_processor_test.py @@ -14876,7 +14876,8 @@ def test_save_payload_metadata_column_limit_exceeded(self): {"column_name": "age", "data_type": "int", "enable_search": True, "create_embeddings": False}, {"column_name": "color", "data_type": "str", "enable_search": True, "create_embeddings": True}, {"column_name": "name", "data_type": "str", "enable_search": True, "create_embeddings": True}, - {"column_name": "gender", "data_type": "str", "enable_search": True, "create_embeddings": True} + {"column_name": "gender", "data_type": "str", "enable_search": True, "create_embeddings": True}, + {"column_name": "experience", "data_type": "str", "enable_search": True, "create_embeddings": True} ], "collection_name": "test_save_payload_metadata_column_limit_exceeded", "bot": bot,