Skip to content

Commit

Permalink
Cognition column limit (#1338)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
GMayank0310 authored Jul 12, 2024
1 parent 53481e9 commit f293d60
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kairon/shared/cognition/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion tests/integration_test/services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 2 additions & 1 deletion tests/unit_test/data_processor/data_processor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f293d60

Please sign in to comment.