From af8454811ccf5e168c46e6ade0734249a319fd25 Mon Sep 17 00:00:00 2001 From: Arthur Howard <151464127+ArthurHoward1@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:15:57 +0100 Subject: [PATCH] Fixed issue 1520 - the collect_metrics options for the app is now taken into account for all actions (#1680) --- embedchain/embedchain/embedchain.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/embedchain/embedchain/embedchain.py b/embedchain/embedchain/embedchain.py index bc02ef05..661b3c8a 100644 --- a/embedchain/embedchain/embedchain.py +++ b/embedchain/embedchain/embedchain.py @@ -535,7 +535,8 @@ class EmbedChain(JSONSerializable): ) # Send anonymous telemetry - self.telemetry.capture(event_name="query", properties=self._telemetry_props) + if self.config.collect_metrics: + self.telemetry.capture(event_name="query", properties=self._telemetry_props) if citations: if self.llm.config.token_usage: @@ -647,7 +648,8 @@ class EmbedChain(JSONSerializable): self.llm.add_history(self.config.id, input_query, answer, session_id=session_id) # Send anonymous telemetry - self.telemetry.capture(event_name="chat", properties=self._telemetry_props) + if self.config.collect_metrics: + self.telemetry.capture(event_name="chat", properties=self._telemetry_props) if citations: if self.llm.config.token_usage: @@ -679,7 +681,8 @@ class EmbedChain(JSONSerializable): list[dict]: A list of dictionaries, each containing the 'context' and 'metadata' of a document. """ # Send anonymous telemetry - self.telemetry.capture(event_name="search", properties=self._telemetry_props) + if self.config.collect_metrics: + self.telemetry.capture(event_name="search", properties=self._telemetry_props) if raw_filter and where: raise ValueError("You can't use both `raw_filter` and `where` together.") @@ -729,7 +732,8 @@ class EmbedChain(JSONSerializable): self.db.reset() self.delete_all_chat_history(app_id=self.config.id) # Send anonymous telemetry - self.telemetry.capture(event_name="reset", properties=self._telemetry_props) + if self.config.collect_metrics: + self.telemetry.capture(event_name="reset", properties=self._telemetry_props) def get_history( self,