Skip to content

Commit

Permalink
Merge branch 'main' into feature/prml-1011-pynative-model-feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
joker2411 committed Nov 15, 2024
2 parents 3ce9a3c + baa9e99 commit 9cf3670
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}}"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,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
Expand Down Expand Up @@ -153,6 +153,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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,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
Expand Down Expand Up @@ -39,7 +38,7 @@
class ClusterReport:
def __init__(
self,
reader,
reader: Reader,
this: WhtMaterial,
entity: Dict,
table_report: TableReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +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
from colorama import init, Fore, Style

Expand Down Expand Up @@ -66,9 +64,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()

Expand Down
2 changes: 1 addition & 1 deletion src/predictions/profiles_mlcorelib/py_native/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/predictions/profiles_mlcorelib/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/predictions/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/predictions/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "v0.5.9"
version = "v0.6.0"

0 comments on commit 9cf3670

Please sign in to comment.