diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 62cb58d4c..db8e63cbc 100755 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -90,9 +90,10 @@ jobs: strategy: matrix: warehouse: - - test: tests/integration/bigquery/pynative.py - site_config: BIGQUERY_SITE_CONFIG - python_version: 3.10.13 + # TODO: Revert once bigquery access issue is fixed + # - test: tests/integration/bigquery/pynative.py + # site_config: BIGQUERY_SITE_CONFIG + # python_version: 3.10.13 - test: tests/integration/snowflake/pynative.py site_config: SNOWFLAKE_SITE_CONFIG python_version: 3.10.13 diff --git a/src/predictions/profiles_mlcorelib/py_native/attribution_report.py b/src/predictions/profiles_mlcorelib/py_native/attribution_report.py index dbfb35012..5ffe8fb16 100644 --- a/src/predictions/profiles_mlcorelib/py_native/attribution_report.py +++ b/src/predictions/profiles_mlcorelib/py_native/attribution_report.py @@ -819,7 +819,7 @@ def register_dependencies(self, this: WhtMaterial): {selector_sql} {{% endwith %}} {{% endmacro %}} - {{% exec %}} {{{{warehouse.CreateReplaceTableAs(this.Name(), selector_sql())}}}} {{% endexec %}} + {{% exec %}} {{{{warehouse.CreateReplaceTableAs(this, selector_sql())}}}} {{% endexec %}} {{% endmacro %}} {{% exec %}} {{{{warehouse.BeginEndBlock(begin_block())}}}} {{% endexec %}}""" diff --git a/src/predictions/profiles_mlcorelib/py_native/id_stitcher/audit.py b/src/predictions/profiles_mlcorelib/py_native/id_stitcher/audit.py index 72e2c3cbf..9bf8ea886 100644 --- a/src/predictions/profiles_mlcorelib/py_native/id_stitcher/audit.py +++ b/src/predictions/profiles_mlcorelib/py_native/id_stitcher/audit.py @@ -76,7 +76,7 @@ def _set_id_stitcher_model(self, this: WhtMaterial): retry_count = 0 while retry_count < max_retries: selected_model_name = self.reader.get_input( - f"Multiple id_stitcher models found. Please select one {id_stitcher_models.keys()}" + f"Multiple id_stitcher models found. Please select one of {list(id_stitcher_models.keys())}" ).strip() if selected_model_name in id_stitcher_models: break @@ -135,6 +135,7 @@ def _run(self, this: WhtMaterial): self.run_completed = True n_visualisations = cluster_report.counter except Exception as e: + self.logger.warn(f"An error occurred while running the audit: {e}") n_visualisations = None duration = (datetime.now() - self.start_time).total_seconds() analytics.track( diff --git a/src/predictions/profiles_mlcorelib/py_native/id_stitcher/cluster_report.py b/src/predictions/profiles_mlcorelib/py_native/id_stitcher/cluster_report.py index f393fc1bb..a6bd5f1a3 100644 --- a/src/predictions/profiles_mlcorelib/py_native/id_stitcher/cluster_report.py +++ b/src/predictions/profiles_mlcorelib/py_native/id_stitcher/cluster_report.py @@ -5,8 +5,7 @@ from profiles_rudderstack.material import WhtMaterial from profiles_rudderstack.logger import Logger -# TODO: Uncomment the following line after adding the Reader class to the profiles_rudderstack package -# from profiles_rudderstack.reader import Reader +from profiles_rudderstack.reader import Reader import networkx as nx from pyvis.network import Network import plotly.graph_objects as go @@ -37,7 +36,7 @@ class ClusterReport: def __init__( self, - reader, + reader: Reader, this: WhtMaterial, entity: Dict, table_report: TableReport, diff --git a/src/predictions/profiles_mlcorelib/py_native/id_stitcher/consent_manager.py b/src/predictions/profiles_mlcorelib/py_native/id_stitcher/consent_manager.py index a6d4333ad..b830896b4 100644 --- a/src/predictions/profiles_mlcorelib/py_native/id_stitcher/consent_manager.py +++ b/src/predictions/profiles_mlcorelib/py_native/id_stitcher/consent_manager.py @@ -8,8 +8,7 @@ LLM_CONSENT_KEY, ) -# TODO: Uncomment the following line after adding the Reader class to the profiles_rudderstack package -# from profiles_rudderstack.reader import Reader +from profiles_rudderstack.reader import Reader class ConsentManager: @@ -62,7 +61,7 @@ def save_consent(self, consent: bool) -> None: with open(self.preferences_file, "w") as f: yaml.dump(existing_preferences, f) - def prompt_for_consent(self, reader) -> bool: + def prompt_for_consent(self, reader: Reader) -> bool: retry_count = 0 while retry_count < 3: response = reader.get_input(self.consent_message).lower().strip() diff --git a/src/predictions/profiles_mlcorelib/py_native/id_stitcher/llm_report.py b/src/predictions/profiles_mlcorelib/py_native/id_stitcher/llm_report.py index ea5df2a7e..ab92ecadc 100644 --- a/src/predictions/profiles_mlcorelib/py_native/id_stitcher/llm_report.py +++ b/src/predictions/profiles_mlcorelib/py_native/id_stitcher/llm_report.py @@ -9,8 +9,7 @@ from .consent_manager import ConsentManager from profiles_rudderstack.logger import Logger -# TODO: Uncomment the following line after adding the Reader class to the profiles_rudderstack package -# from profiles_rudderstack.reader import Reader +from profiles_rudderstack.reader import Reader from enum import Enum @@ -55,9 +54,11 @@ def run(self): ) if state == ProgramState.STOP: return - - print("\n\nGenerating id_stitcher analysis:") - self._interpret_results_with_llm() + try: + self._interpret_results_with_llm() + except Exception: + # If the Analysis of the report fails, we don't want to stop the program. + pass print("You can now ask questions about the ID Stitcher analysis results.") self.run_interactive_session() diff --git a/src/predictions/profiles_mlcorelib/py_native/llm.py b/src/predictions/profiles_mlcorelib/py_native/llm.py index 456feac6b..3f8846843 100644 --- a/src/predictions/profiles_mlcorelib/py_native/llm.py +++ b/src/predictions/profiles_mlcorelib/py_native/llm.py @@ -277,7 +277,7 @@ def query_template_creator( -- attribute values with their corresponding predicted value. LEFT JOIN predicted_attribute b ON {join_condition} {{% endmacro %}} - {{% exec %}} {{{{warehouse.CreateReplaceTableAs(this.Name(), selector_sql())}}}} {{% endexec %}} + {{% exec %}} {{{{warehouse.CreateReplaceTableAs(this, selector_sql())}}}} {{% endexec %}} {{% endmacro %}} {{% exec %}} {{{{warehouse.BeginEndBlock(begin_block())}}}} {{% endexec %}}""" return query_template diff --git a/src/predictions/profiles_mlcorelib/utils/constants.py b/src/predictions/profiles_mlcorelib/utils/constants.py index 2840e8c4e..cc32e3414 100644 --- a/src/predictions/profiles_mlcorelib/utils/constants.py +++ b/src/predictions/profiles_mlcorelib/utils/constants.py @@ -8,8 +8,8 @@ TELEMETRY_CONSENT_SHOWN_KEY = "telemetry_consent_shown" LLM_CONSENT_KEY = "llm_consent" # TODO: Modify them to a prod settings. These are currently from a testing env -WRITE_KEY = "2ohOAcLQ7PQaN2s7jNEPFc1elNW" -DATA_PLANE_URL = "https://rudderstacjpoy.dataplane.rudderstack.com" +WRITE_KEY = "2oqUj9oDjSSp5dGpiCr5Q5IGZk6" +DATA_PLANE_URL = "https://rudderstack-dataplane.rudderstack.com" # Propensity model related constants diff --git a/src/predictions/setup.py b/src/predictions/setup.py index 60246024d..e8f91017b 100644 --- a/src/predictions/setup.py +++ b/src/predictions/setup.py @@ -2,7 +2,7 @@ from version import version install_requires = [ - "profiles_rudderstack>=0.17.0", + "profiles_rudderstack>=0.19.0", "cachetools>=5.3.2", "hyperopt>=0.2.7", "joblib>=1.3.2",