diff --git a/src/python_client/sensiml/datamanager/knowledgepack.py b/src/python_client/sensiml/datamanager/knowledgepack.py index 3cac49b5..506bc895 100644 --- a/src/python_client/sensiml/datamanager/knowledgepack.py +++ b/src/python_client/sensiml/datamanager/knowledgepack.py @@ -1018,12 +1018,12 @@ def initialize_from_dict(self, init_dict): self._model_index = init_dict.get("model_index", None) self._execution_time = init_dict.get("execution_time", None) - self._class_map = init_dict["class_map"] - self._pipeline_summary = init_dict["pipeline_summary"] - self._query_summary = init_dict["query_summary"] - self._feature_summary = init_dict["feature_summary"] - self._transform_summary = init_dict["transform_summary"] - self._sensor_summary = init_dict["sensor_summary"] + self._class_map = init_dict.get("class_map") + self._pipeline_summary = init_dict.get("pipeline_summary") + self._query_summary = init_dict.get("query_summary", None) + self._feature_summary = init_dict.get("feature_summary") + self._transform_summary = init_dict.get("transform_summary") + self._sensor_summary = init_dict.get("sensor_summary") self._neuron_array = ( init_dict.get("neuron_array") diff --git a/src/server/datamanager/serializers/knowledgepack.py b/src/server/datamanager/serializers/knowledgepack.py index 2b16e490..5bcc25e6 100644 --- a/src/server/datamanager/serializers/knowledgepack.py +++ b/src/server/datamanager/serializers/knowledgepack.py @@ -341,6 +341,11 @@ def get_model_configuration(self, obj): def get_query_summary(self, obj): + empty_dict = {} + + if not hasattr(obj, "query_summary") or not obj.query_summary: + return empty_dict # for backward compatibility + obj.query_summary.pop("segment_info", None) if isinstance(obj.query_summary["segmenter"], int):