Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [google-cloud-dialogflow] add new fields for delivering intermediate transcriptions through PubSub #13358

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff 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__ = "2.37.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
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__ = "2.37.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from google.rpc import status_pb2 # type: ignore
import proto # type: ignore

from google.cloud.dialogflow_v2.types import participant
from google.cloud.dialogflow_v2.types import participant, session

__protobuf__ = proto.module(
package="google.cloud.dialogflow.v2",
Expand All @@ -34,6 +34,10 @@ class ConversationEvent(proto.Message):
r"""Represents a notification sent to Pub/Sub subscribers for
conversation lifecycle events.

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Expand All @@ -51,6 +55,10 @@ class ConversationEvent(proto.Message):
new_message_payload (google.cloud.dialogflow_v2.types.Message):
Payload of NEW_MESSAGE event.

This field is a member of `oneof`_ ``payload``.
new_recognition_result_payload (google.cloud.dialogflow_v2.types.StreamingRecognitionResult):
Payload of NEW_RECOGNITION_RESULT event.

This field is a member of `oneof`_ ``payload``.
"""

Expand All @@ -76,6 +84,11 @@ class Type(proto.Enum):
An existing conversation has received a new message, either
from API or telephony. It is configured in
[ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2.ConversationProfile.new_message_event_notification_config]
NEW_RECOGNITION_RESULT (7):
An existing conversation has received a new speech
recognition result. This is mainly for delivering
intermediate transcripts. The notification is configured in
[ConversationProfile.new_recognition_event_notification_config][].
UNRECOVERABLE_ERROR (4):
Unrecoverable error during a telephone call.

Expand All @@ -95,6 +108,7 @@ class Type(proto.Enum):
CONVERSATION_FINISHED = 2
HUMAN_INTERVENTION_NEEDED = 3
NEW_MESSAGE = 5
NEW_RECOGNITION_RESULT = 7
UNRECOVERABLE_ERROR = 4

conversation: str = proto.Field(
Expand All @@ -117,6 +131,12 @@ class Type(proto.Enum):
oneof="payload",
message=participant.Message,
)
new_recognition_result_payload: session.StreamingRecognitionResult = proto.Field(
proto.MESSAGE,
number=5,
oneof="payload",
message=session.StreamingRecognitionResult,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ class ConversationProfile(proto.Message):
Configuration for publishing new message events. Event will
be sent in format of
[ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent]
new_recognition_result_notification_config (google.cloud.dialogflow_v2.types.NotificationConfig):
Optional. Configuration for publishing transcription
intermediate results. Event will be sent in format of
[ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent].
If configured, the following information will be populated
as
[ConversationEvent][google.cloud.dialogflow.v2.ConversationEvent]
Pub/Sub message attributes:

- "participant_id"
- "participant_role"
- "message_id".
stt_config (google.cloud.dialogflow_v2.types.SpeechToTextConfig):
Settings for speech transcription.
language_code (str):
Expand Down Expand Up @@ -161,6 +173,11 @@ class ConversationProfile(proto.Message):
number=8,
message="NotificationConfig",
)
new_recognition_result_notification_config: "NotificationConfig" = proto.Field(
proto.MESSAGE,
number=21,
message="NotificationConfig",
)
stt_config: audio_config.SpeechToTextConfig = proto.Field(
proto.MESSAGE,
number=9,
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__ = "2.37.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from google.rpc import status_pb2 # type: ignore
import proto # type: ignore

from google.cloud.dialogflow_v2beta1.types import participant
from google.cloud.dialogflow_v2beta1.types import participant, session

__protobuf__ = proto.module(
package="google.cloud.dialogflow.v2beta1",
Expand All @@ -34,6 +34,10 @@ class ConversationEvent(proto.Message):
r"""Represents a notification sent to Pub/Sub subscribers for
conversation lifecycle events.

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.

.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields

Expand All @@ -51,6 +55,10 @@ class ConversationEvent(proto.Message):
new_message_payload (google.cloud.dialogflow_v2beta1.types.Message):
Payload of NEW_MESSAGE event.

This field is a member of `oneof`_ ``payload``.
new_recognition_result_payload (google.cloud.dialogflow_v2beta1.types.StreamingRecognitionResult):
Payload of NEW_RECOGNITION_RESULT event.

This field is a member of `oneof`_ ``payload``.
"""

Expand All @@ -76,6 +84,11 @@ class Type(proto.Enum):
An existing conversation has received a new message, either
from API or telephony. It is configured in
[ConversationProfile.new_message_event_notification_config][google.cloud.dialogflow.v2beta1.ConversationProfile.new_message_event_notification_config]
NEW_RECOGNITION_RESULT (7):
An existing conversation has received a new speech
recognition result. This is mainly for delivering
intermediate transcripts. The notification is configured in
[ConversationProfile.new_recognition_event_notification_config][].
UNRECOVERABLE_ERROR (4):
Unrecoverable error during a telephone call.

Expand All @@ -95,6 +108,7 @@ class Type(proto.Enum):
CONVERSATION_FINISHED = 2
HUMAN_INTERVENTION_NEEDED = 3
NEW_MESSAGE = 5
NEW_RECOGNITION_RESULT = 7
UNRECOVERABLE_ERROR = 4

conversation: str = proto.Field(
Expand All @@ -117,6 +131,12 @@ class Type(proto.Enum):
oneof="payload",
message=participant.Message,
)
new_recognition_result_payload: session.StreamingRecognitionResult = proto.Field(
proto.MESSAGE,
number=5,
oneof="payload",
message=session.StreamingRecognitionResult,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ class ConversationProfile(proto.Message):
Configuration for publishing new message events. Event will
be sent in format of
[ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent]
new_recognition_result_notification_config (google.cloud.dialogflow_v2beta1.types.NotificationConfig):
Optional. Configuration for publishing transcription
intermediate results. Event will be sent in format of
[ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent].
If configured, the following information will be populated
as
[ConversationEvent][google.cloud.dialogflow.v2beta1.ConversationEvent]
Pub/Sub message attributes:

- "participant_id"
- "participant_role"
- "message_id".
stt_config (google.cloud.dialogflow_v2beta1.types.SpeechToTextConfig):
Settings for speech transcription.
language_code (str):
Expand Down Expand Up @@ -160,6 +172,11 @@ class ConversationProfile(proto.Message):
number=8,
message="NotificationConfig",
)
new_recognition_result_notification_config: "NotificationConfig" = proto.Field(
proto.MESSAGE,
number=21,
message="NotificationConfig",
)
stt_config: audio_config.SpeechToTextConfig = proto.Field(
proto.MESSAGE,
number=9,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow",
"version": "2.37.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow",
"version": "2.37.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6193,6 +6193,7 @@ def test_create_conversation_profile_rest_call_success(request_type):
"notification_config": {},
"logging_config": {"enable_stackdriver_logging": True},
"new_message_event_notification_config": {},
"new_recognition_result_notification_config": {},
"stt_config": {
"speech_model_variant": 1,
"model": "model_value",
Expand Down Expand Up @@ -6507,6 +6508,7 @@ def test_update_conversation_profile_rest_call_success(request_type):
"notification_config": {},
"logging_config": {"enable_stackdriver_logging": True},
"new_message_event_notification_config": {},
"new_recognition_result_notification_config": {},
"stt_config": {
"speech_model_variant": 1,
"model": "model_value",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6201,6 +6201,7 @@ def test_create_conversation_profile_rest_call_success(request_type):
"notification_config": {},
"logging_config": {"enable_stackdriver_logging": True},
"new_message_event_notification_config": {},
"new_recognition_result_notification_config": {},
"stt_config": {
"speech_model_variant": 1,
"model": "model_value",
Expand Down Expand Up @@ -6515,6 +6516,7 @@ def test_update_conversation_profile_rest_call_success(request_type):
"notification_config": {},
"logging_config": {"enable_stackdriver_logging": True},
"new_message_event_notification_config": {},
"new_recognition_result_notification_config": {},
"stt_config": {
"speech_model_variant": 1,
"model": "model_value",
Expand Down
Loading