From 92b9f30b3231a8b5ca7c3a9e9da6e5b4db40c568 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 11:10:29 -0400 Subject: [PATCH] feat: filter is used to filter conversations used for issue model training feat: update_time is used to indicate when the phrase matcher was updated (#48) --- .../types/resources.py | 16 ++++++- samples/snippets/noxfile.py | 44 ++++++++----------- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/google/cloud/contact_center_insights_v1/types/resources.py b/google/cloud/contact_center_insights_v1/types/resources.py index 1f1f4df..e2df252 100644 --- a/google/cloud/contact_center_insights_v1/types/resources.py +++ b/google/cloud/contact_center_insights_v1/types/resources.py @@ -737,15 +737,21 @@ class InputDataConfig(proto.Message): r"""Configs for the input data used to create the issue model. Attributes: medium (google.cloud.contact_center_insights_v1.types.Conversation.Medium): - Required. Medium of conversations used in - training data. + Medium of conversations used in training data. This field is + being deprecated. To specify the medium to be used in + training a new issue model, set the ``medium`` field on + ``filter``. training_conversations_count (int): Output only. Number of conversations used in training. Output only. + filter (str): + A filter to reduce the conversations used for + training the model to a specific subset. """ medium = proto.Field(proto.ENUM, number=1, enum="Conversation.Medium",) training_conversations_count = proto.Field(proto.INT64, number=2,) + filter = proto.Field(proto.STRING, number=3,) name = proto.Field(proto.STRING, number=1,) display_name = proto.Field(proto.STRING, number=2,) @@ -857,6 +863,9 @@ class PhraseMatcher(proto.Message): The role whose utterances the phrase matcher should be matched against. If the role is ROLE_UNSPECIFIED it will be matched against any utterances in the transcript. + update_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. The most recent time at which + the phrase matcher was updated. """ class PhraseMatcherType(proto.Enum): @@ -885,6 +894,9 @@ class PhraseMatcherType(proto.Enum): role_match = proto.Field( proto.ENUM, number=10, enum="ConversationParticipant.Role", ) + update_time = proto.Field( + proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, + ) class PhraseMatchRuleGroup(proto.Message): diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index b008613..e73436a 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -39,15 +39,17 @@ TEST_CONFIG = { # You can opt out from the test for specific Python versions. - "ignored_versions": [], + 'ignored_versions': [], + # Old samples are opted out of enforcing Python type hints # All new samples should feature them - "enforce_type_hints": False, + 'enforce_type_hints': False, + # An envvar key for determining the project id to use. Change it # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a # build specific Cloud project. You can also use your own string # to use your own Cloud project. - "gcloud_project_env": "GOOGLE_CLOUD_PROJECT", + 'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT', # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT', # If you need to use a specific version of pip, # change pip_version_override to the string representation @@ -55,13 +57,13 @@ "pip_version_override": None, # A dictionary you want to inject into your test. Don't put any # secrets here. These values will override predefined values. - "envs": {}, + 'envs': {}, } try: # Ensure we can import noxfile_config in the project's directory. - sys.path.append(".") + sys.path.append('.') from noxfile_config import TEST_CONFIG_OVERRIDE except ImportError as e: print("No user noxfile_config found: detail: {}".format(e)) @@ -76,12 +78,12 @@ def get_pytest_env_vars() -> Dict[str, str]: ret = {} # Override the GCLOUD_PROJECT and the alias. - env_key = TEST_CONFIG["gcloud_project_env"] + env_key = TEST_CONFIG['gcloud_project_env'] # This should error out if not set. - ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key] + ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key] # Apply user supplied envs. - ret.update(TEST_CONFIG["envs"]) + ret.update(TEST_CONFIG['envs']) return ret @@ -90,14 +92,11 @@ def get_pytest_env_vars() -> Dict[str, str]: ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] # Any default versions that should be ignored. -IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] +IGNORED_VERSIONS = TEST_CONFIG['ignored_versions'] TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS]) -INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ( - "True", - "true", -) +INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true") # # Style Checks # @@ -142,7 +141,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]: @nox.session def lint(session: nox.sessions.Session) -> None: - if not TEST_CONFIG["enforce_type_hints"]: + if not TEST_CONFIG['enforce_type_hints']: session.install("flake8", "flake8-import-order") else: session.install("flake8", "flake8-import-order", "flake8-annotations") @@ -151,11 +150,9 @@ def lint(session: nox.sessions.Session) -> None: args = FLAKE8_COMMON_ARGS + [ "--application-import-names", ",".join(local_names), - ".", + "." ] session.run("flake8", *args) - - # # Black # @@ -168,7 +165,6 @@ def blacken(session: nox.sessions.Session) -> None: session.run("black", *python_files) - # # Sample Tests # @@ -177,9 +173,7 @@ def blacken(session: nox.sessions.Session) -> None: PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"] -def _session_tests( - session: nox.sessions.Session, post_install: Callable = None -) -> None: +def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None: if TEST_CONFIG["pip_version_override"]: pip_version = TEST_CONFIG["pip_version_override"] session.install(f"pip=={pip_version}") @@ -209,7 +203,7 @@ def _session_tests( # on travis where slow and flaky tests are excluded. # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html success_codes=[0, 5], - env=get_pytest_env_vars(), + env=get_pytest_env_vars() ) @@ -219,9 +213,9 @@ def py(session: nox.sessions.Session) -> None: if session.python in TESTED_VERSIONS: _session_tests(session) else: - session.skip( - "SKIPPED: {} tests are disabled for this sample.".format(session.python) - ) + session.skip("SKIPPED: {} tests are disabled for this sample.".format( + session.python + )) #