Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

Fixed issue 1520 - the collect_metrics options for the app is now taken into account for all actions (#1680)

Arthur Howardaf8454811ccf
diff --git a/embedchain/embedchain/embedchain.py b/embedchain/embedchain/embedchain.py
index bc02ef059..661b3c8ab 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,