From d344ee226ceeb4f9e9e275351fc4f54b617a21e2 Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Mon, 18 Sep 2023 10:29:14 +0530 Subject: [PATCH] Set telemetry flag as a top level attribute (#462) --- embedchain/embedchain.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/embedchain/embedchain.py b/embedchain/embedchain.py index d60a8bd2..3c72d02a 100644 --- a/embedchain/embedchain.py +++ b/embedchain/embedchain.py @@ -98,6 +98,16 @@ class EmbedChain(JSONSerializable): thread_telemetry = threading.Thread(target=self._send_telemetry_event, args=("init",)) thread_telemetry.start() + @property + def collect_metrics(self): + return self.config.collect_metrics + + @collect_metrics.setter + def collect_metrics(self, value): + if not isinstance(value, bool): + raise ValueError(f"Boolean value expected but got {type(value)}.") + self.config.collect_metrics = value + def _load_or_generate_user_id(self) -> str: """ Loads the user id from the config file if it exists, otherwise generates a new