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

This commit is contained in:
Arthur Howard
2024-09-03 19:15:57 +01:00
committed by GitHub
parent 8dbfe28bbb
commit af8454811c

View File

@@ -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,