Skip to content

Commit

Permalink
feat: add optional SpeechConfig to UploadConversationRequest (#11750)
Browse files Browse the repository at this point in the history
BEGIN_COMMIT_OVERRIDE
feat: add optional SpeechConfig to UploadConversationRequest
END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 567616394

Source-Link:
googleapis/googleapis@37b45d1

Source-Link:
googleapis/googleapis-gen@fa3a564
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbnRhY3QtY2VudGVyLWluc2lnaHRzLy5Pd2xCb3QueWFtbCIsImgiOiJmYTNhNTY0OGQzMjY3YTUyZmY4NzQyYzZiY2E0NjVkMzA2ZmNmNGE1In0=

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
  • Loading branch information
3 people committed Sep 28, 2023
1 parent 8147cff commit bfc25b7
Show file tree
Hide file tree
Showing 14 changed files with 130 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ Running System Tests
$ nox -s system

# Run a single system test
$ nox -s system- -- -k <name of test>
$ nox -s system-3.11 -- -k <name of test>


.. note::

System tests are only configured to run under Python.
System tests are only configured to run under Python 3.8, 3.9, 3.10 and 3.11.
For expediency, we do not run them in older versions of Python 3.

This alone will not run the tests. You'll need to change some local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
SilenceData,
SmartComposeSuggestionData,
SmartReplyData,
SpeechConfig,
View,
)

Expand Down Expand Up @@ -239,5 +240,6 @@
"SilenceData",
"SmartComposeSuggestionData",
"SmartReplyData",
"SpeechConfig",
"View",
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.12.1" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
SilenceData,
SmartComposeSuggestionData,
SmartReplyData,
SpeechConfig,
View,
)

Expand Down Expand Up @@ -226,6 +227,7 @@
"SilenceData",
"SmartComposeSuggestionData",
"SmartReplyData",
"SpeechConfig",
"UndeployIssueModelMetadata",
"UndeployIssueModelRequest",
"UndeployIssueModelResponse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.12.1" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ class ContactCenterInsightsAsyncClient:
parse_phrase_matcher_path = staticmethod(
ContactCenterInsightsClient.parse_phrase_matcher_path
)
recognizer_path = staticmethod(ContactCenterInsightsClient.recognizer_path)
parse_recognizer_path = staticmethod(
ContactCenterInsightsClient.parse_recognizer_path
)
settings_path = staticmethod(ContactCenterInsightsClient.settings_path)
parse_settings_path = staticmethod(ContactCenterInsightsClient.parse_settings_path)
view_path = staticmethod(ContactCenterInsightsClient.view_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,30 @@ def parse_phrase_matcher_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def recognizer_path(
project: str,
location: str,
recognizer: str,
) -> str:
"""Returns a fully-qualified recognizer string."""
return (
"projects/{project}/locations/{location}/recognizers/{recognizer}".format(
project=project,
location=location,
recognizer=recognizer,
)
)

@staticmethod
def parse_recognizer_path(path: str) -> Dict[str, str]:
"""Parses a recognizer path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/recognizers/(?P<recognizer>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def settings_path(
project: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
SilenceData,
SmartComposeSuggestionData,
SmartReplyData,
SpeechConfig,
View,
)

Expand Down Expand Up @@ -226,5 +227,6 @@
"SilenceData",
"SmartComposeSuggestionData",
"SmartReplyData",
"SpeechConfig",
"View",
)
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ class UploadConversationRequest(proto.Message):
Optional. DLP settings for transcript
redaction. Optional, will default to the config
specified in Settings.
speech_config (google.cloud.contact_center_insights_v1.types.SpeechConfig):
Optional. Default Speech-to-Text
configuration. Optional, will default to the
config specified in Settings.
"""

parent: str = proto.Field(
Expand All @@ -380,6 +384,11 @@ class UploadConversationRequest(proto.Message):
number=4,
message=resources.RedactionConfig,
)
speech_config: resources.SpeechConfig = proto.Field(
proto.MESSAGE,
number=11,
message=resources.SpeechConfig,
)


class UploadConversationMetadata(proto.Message):
Expand Down Expand Up @@ -584,7 +593,9 @@ class IngestConversationsRequest(proto.Message):
Attributes:
gcs_source (google.cloud.contact_center_insights_v1.types.IngestConversationsRequest.GcsSource):
A cloud storage bucket source.
A cloud storage bucket source. Note that any
previously ingested objects from the source will
be skipped to avoid duplication.
This field is a member of `oneof`_ ``source``.
transcript_object_config (google.cloud.contact_center_insights_v1.types.IngestConversationsRequest.TranscriptObjectConfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"ExactMatchConfig",
"Settings",
"RedactionConfig",
"SpeechConfig",
"RuntimeAnnotation",
"AnswerFeedback",
"ArticleSuggestionData",
Expand Down Expand Up @@ -1735,6 +1736,11 @@ class Settings(proto.Message):
redaction_config (google.cloud.contact_center_insights_v1.types.RedactionConfig):
Default DLP redaction resources to be applied
while ingesting conversations.
speech_config (google.cloud.contact_center_insights_v1.types.SpeechConfig):
Optional. Default Speech-to-Text resources to
be used while ingesting audio files. Optional,
CCAI Insights will create a default if not
provided.
"""

class AnalysisConfig(proto.Message):
Expand Down Expand Up @@ -1806,6 +1812,11 @@ class AnalysisConfig(proto.Message):
number=10,
message="RedactionConfig",
)
speech_config: "SpeechConfig" = proto.Field(
proto.MESSAGE,
number=11,
message="SpeechConfig",
)


class RedactionConfig(proto.Message):
Expand Down Expand Up @@ -1833,6 +1844,21 @@ class RedactionConfig(proto.Message):
)


class SpeechConfig(proto.Message):
r"""Speech-to-Text configuration.
Attributes:
speech_recognizer (str):
The fully-qualified Speech Recognizer resource name. Format:
``projects/{project_id}/locations/{location}/recognizer/{recognizer}``
"""

speech_recognizer: str = proto.Field(
proto.STRING,
number=1,
)


class RuntimeAnnotation(proto.Message):
r"""An annotation that was generated during the customer and
agent interaction.
Expand Down
23 changes: 1 addition & 22 deletions packages/google-cloud-contact-center-insights/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
UNIT_TEST_EXTRAS = []
UNIT_TEST_EXTRAS_BY_PYTHON = {}

SYSTEM_TEST_PYTHON_VERSIONS = []
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11"]
SYSTEM_TEST_STANDARD_DEPENDENCIES = [
"mock",
"pytest",
Expand Down Expand Up @@ -405,24 +405,3 @@ def prerelease_deps(session):
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")

session.run("py.test", "tests/unit")

system_test_path = os.path.join("tests", "system.py")
system_test_folder_path = os.path.join("tests", "system")

# Only run system tests if found.
if os.path.exists(system_test_path):
session.run(
"py.test",
"--verbose",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
*session.posargs,
)
if os.path.exists(system_test_folder_path):
session.run(
"py.test",
"--verbose",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
*session.posargs,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-contact-center-insights",
"version": "1.12.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class contact_center_insightsCallTransformer(cst.CSTTransformer):
'update_phrase_matcher': ('phrase_matcher', 'update_mask', ),
'update_settings': ('settings', 'update_mask', ),
'update_view': ('view', 'update_mask', ),
'upload_conversation': ('parent', 'conversation', 'conversation_id', 'redaction_config', ),
'upload_conversation': ('parent', 'conversation', 'conversation_id', 'redaction_config', 'speech_config', ),
}

def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode:
Expand Down
Loading

0 comments on commit bfc25b7

Please sign in to comment.