From 6c1049a35371150b7136e285bb49f20cebb2e579 Mon Sep 17 00:00:00 2001 From: miro Date: Thu, 5 Jun 2025 14:53:59 +0100 Subject: [PATCH 1/2] fix: send pipeline in intent metrics --- ovos_core/intent_services/__init__.py | 38 +++++++++++++++------------ 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/ovos_core/intent_services/__init__.py b/ovos_core/intent_services/__init__.py index 4c46650fcfb..800b56a7bd4 100644 --- a/ovos_core/intent_services/__init__.py +++ b/ovos_core/intent_services/__init__.py @@ -14,32 +14,32 @@ # import json -import warnings import time +import warnings from collections import defaultdict from typing import Tuple, Callable, Union, List import requests -from ovos_bus_client.message import Message -from ovos_bus_client.session import SessionManager -from ovos_bus_client.util import get_message_lang -from ovos_plugin_manager.templates.pipeline import PipelineMatch, IntentHandlerMatch -from ovos_utils.lang import standardize_lang_tag -from ovos_utils.log import LOG, log_deprecation, deprecated -from ovos_utils.metrics import Stopwatch -from ovos_utils.thread_utils import create_daemon -from padacioso.opm import PadaciosoPipeline as PadaciosoService +from ovos_config.config import Configuration +from ovos_config.locale import get_valid_languages from ocp_pipeline.opm import OCPPipelineMatcher from ovos_adapt.opm import AdaptPipeline +from ovos_bus_client.message import Message +from ovos_bus_client.session import SessionManager +from ovos_bus_client.util import get_message_lang from ovos_commonqa.opm import CommonQAService -from ovos_config.config import Configuration -from ovos_config.locale import get_valid_languages from ovos_core.intent_services.converse_service import ConverseService from ovos_core.intent_services.fallback_service import FallbackService from ovos_core.intent_services.stop_service import StopService from ovos_core.transformers import MetadataTransformersService, UtteranceTransformersService, IntentTransformersService from ovos_persona import PersonaService +from ovos_plugin_manager.templates.pipeline import PipelineMatch, IntentHandlerMatch +from ovos_utils.lang import standardize_lang_tag +from ovos_utils.log import LOG, log_deprecation, deprecated +from ovos_utils.metrics import Stopwatch +from ovos_utils.thread_utils import create_daemon +from padacioso.opm import PadaciosoPipeline as PadaciosoService # TODO - to be dropped once pluginified # just a placeholder during alphas until https://github.com/OpenVoiceOS/ovos-core/pull/570 @@ -386,7 +386,8 @@ def _emit_match_message(self, match: Union[IntentHandlerMatch, PipelineMatch], m create_daemon(self._upload_match_data, (match.utterance, match.skill_id, lang, - match.match_data)) + match.match_data, + sess.pipeline)) # Launch skill if not handled by the match function elif isinstance(match, IntentHandlerMatch) and match.match_type: @@ -399,7 +400,8 @@ def _emit_match_message(self, match: Union[IntentHandlerMatch, PipelineMatch], m create_daemon(self._upload_match_data, (match.utterance, match.match_type, lang, - match.match_data)) + match.match_data, + sess.pipeline)) if reply is not None: reply.data["utterance"] = match.utterance @@ -429,10 +431,11 @@ def _emit_match_message(self, match: Union[IntentHandlerMatch, PipelineMatch], m create_daemon(self._upload_match_data, (match.utterance, "complete_intent_failure", lang, - match.match_data)) + match.match_data, + sess.pipeline)) @staticmethod - def _upload_match_data(utterance: str, intent: str, lang: str, match_data: dict): + def _upload_match_data(utterance: str, intent: str, lang: str, match_data: dict, pipeline: List[str]): """if enabled upload the intent match data to a server, allowing users and developers to collect metrics/datasets to improve the pipeline plugins and skills. @@ -452,7 +455,8 @@ def _upload_match_data(utterance: str, intent: str, lang: str, match_data: dict) "utterance": utterance, "intent": intent, "lang": lang, - "match_data": json.dumps(match_data, ensure_ascii=False) + "match_data": json.dumps(match_data, ensure_ascii=False), + "pipeline": "|".join(pipeline) } for url in endpoints: try: From a35abc417008d7c6b167a751b24c70acdc0a7538 Mon Sep 17 00:00:00 2001 From: miro Date: Thu, 5 Jun 2025 15:02:39 +0100 Subject: [PATCH 2/2] include version string --- ovos_core/intent_services/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ovos_core/intent_services/__init__.py b/ovos_core/intent_services/__init__.py index 800b56a7bd4..b5405f2c950 100644 --- a/ovos_core/intent_services/__init__.py +++ b/ovos_core/intent_services/__init__.py @@ -40,6 +40,8 @@ from ovos_utils.metrics import Stopwatch from ovos_utils.thread_utils import create_daemon from padacioso.opm import PadaciosoPipeline as PadaciosoService +from ovos_core.version import OVOS_VERSION_STR + # TODO - to be dropped once pluginified # just a placeholder during alphas until https://github.com/OpenVoiceOS/ovos-core/pull/570 @@ -456,7 +458,8 @@ def _upload_match_data(utterance: str, intent: str, lang: str, match_data: dict, "intent": intent, "lang": lang, "match_data": json.dumps(match_data, ensure_ascii=False), - "pipeline": "|".join(pipeline) + "pipeline": "|".join(pipeline), + "core_version": OVOS_VERSION_STR } for url in endpoints: try: