Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
feat: update contact center insight v1 prior to launch (#8)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 386489535

Source-Link: googleapis/googleapis@a5eda9f

Source-Link: googleapis/googleapis-gen@3b7ccb6


fix: change nesting of Conversation.Transcript.Participant to ConversationParticipant
fix: remove AnnotationBoundary.time_offset
  • Loading branch information
gcf-owl-bot[bot] committed Jul 24, 2021
1 parent d3cb3d7 commit 1df2eff
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 40 deletions.
4 changes: 4 additions & 0 deletions google/cloud/contact_center_insights/__init__.py
Expand Up @@ -135,6 +135,9 @@
from google.cloud.contact_center_insights_v1.types.resources import (
ConversationLevelSentiment,
)
from google.cloud.contact_center_insights_v1.types.resources import (
ConversationParticipant,
)
from google.cloud.contact_center_insights_v1.types.resources import DialogflowIntent
from google.cloud.contact_center_insights_v1.types.resources import (
DialogflowInteractionData,
Expand Down Expand Up @@ -215,6 +218,7 @@
"Conversation",
"ConversationDataSource",
"ConversationLevelSentiment",
"ConversationParticipant",
"DialogflowIntent",
"DialogflowInteractionData",
"DialogflowSource",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/contact_center_insights_v1/__init__.py
Expand Up @@ -59,6 +59,7 @@
from .types.resources import Conversation
from .types.resources import ConversationDataSource
from .types.resources import ConversationLevelSentiment
from .types.resources import ConversationParticipant
from .types.resources import DialogflowIntent
from .types.resources import DialogflowInteractionData
from .types.resources import DialogflowSource
Expand Down Expand Up @@ -104,6 +105,7 @@
"Conversation",
"ConversationDataSource",
"ConversationLevelSentiment",
"ConversationParticipant",
"ConversationView",
"CreateAnalysisOperationMetadata",
"CreateAnalysisRequest",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/contact_center_insights_v1/types/__init__.py
Expand Up @@ -58,6 +58,7 @@
Conversation,
ConversationDataSource,
ConversationLevelSentiment,
ConversationParticipant,
DialogflowIntent,
DialogflowInteractionData,
DialogflowSource,
Expand Down Expand Up @@ -131,6 +132,7 @@
"Conversation",
"ConversationDataSource",
"ConversationLevelSentiment",
"ConversationParticipant",
"DialogflowIntent",
"DialogflowInteractionData",
"DialogflowSource",
Expand Down
Expand Up @@ -111,8 +111,48 @@ class CalculateStatsResponse(proto.Message):
respective number of matches in the set of conversations.
Key has the format:
``projects/<Project ID>/locations/<Location ID>/issueModels/<Issue Model ID>/issues/<Issue ID>``
conversation_count_time_series (google.cloud.contact_center_insights_v1.types.CalculateStatsResponse.TimeSeries):
A time series representing the count of
conversations created over time that match that
requested filter criteria.
"""

class TimeSeries(proto.Message):
r"""A time series representing conversations over time.
Attributes:
interval_duration (google.protobuf.duration_pb2.Duration):
The duration of each interval.
points (Sequence[google.cloud.contact_center_insights_v1.types.CalculateStatsResponse.TimeSeries.Interval]):
An ordered list of intervals from earliest to
latest, where each interval represents the
number of conversations that transpired during
the time window.
"""

class Interval(proto.Message):
r"""A single interval in a time series.
Attributes:
start_time (google.protobuf.timestamp_pb2.Timestamp):
The start time of this interval.
conversation_count (int):
The number of conversations created in this
interval.
"""

start_time = proto.Field(
proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,
)
conversation_count = proto.Field(proto.INT32, number=2,)

interval_duration = proto.Field(
proto.MESSAGE, number=1, message=duration_pb2.Duration,
)
points = proto.RepeatedField(
proto.MESSAGE,
number=2,
message="CalculateStatsResponse.TimeSeries.Interval",
)

average_duration = proto.Field(
proto.MESSAGE, number=1, message=duration_pb2.Duration,
)
Expand All @@ -121,6 +161,9 @@ class CalculateStatsResponse(proto.Message):
smart_highlighter_matches = proto.MapField(proto.STRING, proto.INT32, number=4,)
custom_highlighter_matches = proto.MapField(proto.STRING, proto.INT32, number=5,)
issue_matches = proto.MapField(proto.STRING, proto.INT32, number=6,)
conversation_count_time_series = proto.Field(
proto.MESSAGE, number=7, message=TimeSeries,
)


class CreateAnalysisOperationMetadata(proto.Message):
Expand Down Expand Up @@ -384,6 +427,11 @@ class ExportInsightsDataRequest(proto.Message):
class BigQueryDestination(proto.Message):
r"""A BigQuery Table Reference.
Attributes:
project_id (str):
A project ID or number. If specified, then
export will attempt to write data to this
project instead of the resource project.
Otherwise, the resource project will be used.
dataset (str):
Required. The name of the BigQuery dataset that the snapshot
result should be exported to. If this dataset does not
Expand All @@ -394,6 +442,7 @@ class BigQueryDestination(proto.Message):
returns an INVALID_ARGUMENT error.
"""

project_id = proto.Field(proto.STRING, number=3,)
dataset = proto.Field(proto.STRING, number=1,)
table = proto.Field(proto.STRING, number=2,)

Expand Down
75 changes: 35 additions & 40 deletions google/cloud/contact_center_insights_v1/types/resources.py
Expand Up @@ -59,6 +59,7 @@
"SmartReplyData",
"SmartComposeSuggestionData",
"DialogflowInteractionData",
"ConversationParticipant",
},
)

Expand Down Expand Up @@ -176,7 +177,7 @@ class TranscriptSegment(proto.Message):
audioChannelCount = N, its output values can
range from '1' to 'N'. A channel tag of 0
indicates that the audio is mono.
participant (google.cloud.contact_center_insights_v1.types.Conversation.Transcript.TranscriptSegment.Participant):
segment_participant (google.cloud.contact_center_insights_v1.types.ConversationParticipant):
The participant of this segment.
"""

Expand Down Expand Up @@ -208,31 +209,6 @@ class WordInfo(proto.Message):
word = proto.Field(proto.STRING, number=3,)
confidence = proto.Field(proto.FLOAT, number=4,)

class Participant(proto.Message):
r"""The participant of the transcript segment.
Attributes:
dialogflow_participant (str):
The name of the Dialogflow participant.
Format:
projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}
role (google.cloud.contact_center_insights_v1.types.Conversation.Transcript.TranscriptSegment.Participant.Role):
The role of the participant.
"""

class Role(proto.Enum):
r"""The role of the participant."""
ROLE_UNSPECIFIED = 0
HUMAN_AGENT = 1
AUTOMATED_AGENT = 2
END_USER = 3

dialogflow_participant = proto.Field(proto.STRING, number=1,)
role = proto.Field(
proto.ENUM,
number=2,
enum="Conversation.Transcript.TranscriptSegment.Participant.Role",
)

text = proto.Field(proto.STRING, number=1,)
confidence = proto.Field(proto.FLOAT, number=2,)
words = proto.RepeatedField(
Expand All @@ -242,10 +218,8 @@ class Role(proto.Enum):
)
language_code = proto.Field(proto.STRING, number=4,)
channel_tag = proto.Field(proto.INT32, number=5,)
participant = proto.Field(
proto.MESSAGE,
number=8,
message="Conversation.Transcript.TranscriptSegment.Participant",
segment_participant = proto.Field(
proto.MESSAGE, number=9, message="ConversationParticipant",
)

transcript_segments = proto.RepeatedField(
Expand Down Expand Up @@ -532,10 +506,6 @@ class AnnotationBoundary(proto.Message):
an annotation.
Attributes:
time_offset (google.protobuf.duration_pb2.Duration):
Deprecated: Use ``word_index`` for the detailed boundary.
The time offset of this boundary with respect to the start
time of the first word in the transcript piece.
word_index (int):
The word index of this boundary with respect
to the first word in the transcript piece. This
Expand All @@ -546,12 +516,6 @@ class AnnotationBoundary(proto.Message):
located. This index starts at zero.
"""

time_offset = proto.Field(
proto.MESSAGE,
number=2,
oneof="detailed_boundary",
message=duration_pb2.Duration,
)
word_index = proto.Field(proto.INT32, number=3, oneof="detailed_boundary",)
transcript_index = proto.Field(proto.INT32, number=1,)

Expand Down Expand Up @@ -866,6 +830,10 @@ class PhraseMatcher(proto.Message):
activation_update_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The most recent time at which
the activation status was updated.
role_match (google.cloud.contact_center_insights_v1.types.ConversationParticipant.Role):
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.
"""

class PhraseMatcherType(proto.Enum):
Expand All @@ -891,6 +859,9 @@ class PhraseMatcherType(proto.Enum):
activation_update_time = proto.Field(
proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,
)
role_match = proto.Field(
proto.ENUM, number=10, enum="ConversationParticipant.Role",
)


class PhraseMatchRuleGroup(proto.Message):
Expand Down Expand Up @@ -1253,4 +1224,28 @@ class DialogflowInteractionData(proto.Message):
confidence = proto.Field(proto.FLOAT, number=2,)


class ConversationParticipant(proto.Message):
r"""The call participant speaking for a given utterance.
Attributes:
dialogflow_participant (str):
The name of the Dialogflow participant.
Format:
projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}
role (google.cloud.contact_center_insights_v1.types.ConversationParticipant.Role):
The role of the participant.
"""

class Role(proto.Enum):
r"""The role of the participant."""
ROLE_UNSPECIFIED = 0
HUMAN_AGENT = 1
AUTOMATED_AGENT = 2
END_USER = 3
ANY_AGENT = 4

dialogflow_participant = proto.Field(proto.STRING, number=1,)
role = proto.Field(proto.ENUM, number=2, enum=Role,)


__all__ = tuple(sorted(__protobuf__.manifest))
Expand Up @@ -4241,6 +4241,7 @@ def test_create_phrase_matcher(
display_name="display_name_value",
type_=resources.PhraseMatcher.PhraseMatcherType.ALL_OF,
active=True,
role_match=resources.ConversationParticipant.Role.HUMAN_AGENT,
)
response = client.create_phrase_matcher(request)

Expand All @@ -4257,6 +4258,7 @@ def test_create_phrase_matcher(
assert response.display_name == "display_name_value"
assert response.type_ == resources.PhraseMatcher.PhraseMatcherType.ALL_OF
assert response.active is True
assert response.role_match == resources.ConversationParticipant.Role.HUMAN_AGENT


def test_create_phrase_matcher_from_dict():
Expand Down Expand Up @@ -4306,6 +4308,7 @@ async def test_create_phrase_matcher_async(
display_name="display_name_value",
type_=resources.PhraseMatcher.PhraseMatcherType.ALL_OF,
active=True,
role_match=resources.ConversationParticipant.Role.HUMAN_AGENT,
)
)
response = await client.create_phrase_matcher(request)
Expand All @@ -4323,6 +4326,7 @@ async def test_create_phrase_matcher_async(
assert response.display_name == "display_name_value"
assert response.type_ == resources.PhraseMatcher.PhraseMatcherType.ALL_OF
assert response.active is True
assert response.role_match == resources.ConversationParticipant.Role.HUMAN_AGENT


@pytest.mark.asyncio
Expand Down Expand Up @@ -4501,6 +4505,7 @@ def test_get_phrase_matcher(
display_name="display_name_value",
type_=resources.PhraseMatcher.PhraseMatcherType.ALL_OF,
active=True,
role_match=resources.ConversationParticipant.Role.HUMAN_AGENT,
)
response = client.get_phrase_matcher(request)

Expand All @@ -4517,6 +4522,7 @@ def test_get_phrase_matcher(
assert response.display_name == "display_name_value"
assert response.type_ == resources.PhraseMatcher.PhraseMatcherType.ALL_OF
assert response.active is True
assert response.role_match == resources.ConversationParticipant.Role.HUMAN_AGENT


def test_get_phrase_matcher_from_dict():
Expand Down Expand Up @@ -4566,6 +4572,7 @@ async def test_get_phrase_matcher_async(
display_name="display_name_value",
type_=resources.PhraseMatcher.PhraseMatcherType.ALL_OF,
active=True,
role_match=resources.ConversationParticipant.Role.HUMAN_AGENT,
)
)
response = await client.get_phrase_matcher(request)
Expand All @@ -4583,6 +4590,7 @@ async def test_get_phrase_matcher_async(
assert response.display_name == "display_name_value"
assert response.type_ == resources.PhraseMatcher.PhraseMatcherType.ALL_OF
assert response.active is True
assert response.role_match == resources.ConversationParticipant.Role.HUMAN_AGENT


@pytest.mark.asyncio
Expand Down

0 comments on commit 1df2eff

Please sign in to comment.