From aa998161a58ad9ce48c61ce913184fd49532327d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:20:12 -0800 Subject: [PATCH] feat: [google-cloud-dialogflow] add new fields for delivering intermediate transcriptions through PubSub (#13358) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 705999588 Source-Link: https://github.com/googleapis/googleapis/commit/35c27e3dff6a232c9c83014c677cf353c3a8aaf5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/fb8444ee2d1364e2e6a84e112206e886e003b8e6 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6ImZiODQ0NGVlMmQxMzY0ZTJlNmE4NGUxMTIyMDZlODg2ZTAwM2I4ZTYifQ== BEGIN_NESTED_COMMIT feat: [google-cloud-dialogflow] add new fields for delivering intermediate transcriptions through PubSub PiperOrigin-RevId: 705962694 Source-Link: https://github.com/googleapis/googleapis/commit/d140b5109f2abfe1ad4205c4a791cf16f09036c2 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8fc7ff91ca69b762ae3c3784b684dc45d8d4c8eb Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpYWxvZ2Zsb3cvLk93bEJvdC55YW1sIiwiaCI6IjhmYzdmZjkxY2E2OWI3NjJhZTNjMzc4NGI2ODRkYzQ1ZDhkNGM4ZWIifQ== END_NESTED_COMMIT --------- Co-authored-by: Owl Bot --- .../google/cloud/dialogflow/gapic_version.py | 2 +- .../cloud/dialogflow_v2/gapic_version.py | 2 +- .../dialogflow_v2/types/conversation_event.py | 22 ++++++++++++++++++- .../types/conversation_profile.py | 17 ++++++++++++++ .../cloud/dialogflow_v2beta1/gapic_version.py | 2 +- .../types/conversation_event.py | 22 ++++++++++++++++++- .../types/conversation_profile.py | 17 ++++++++++++++ ...t_metadata_google.cloud.dialogflow.v2.json | 2 +- ...adata_google.cloud.dialogflow.v2beta1.json | 2 +- .../test_conversation_profiles.py | 2 ++ .../test_conversation_profiles.py | 2 ++ 11 files changed, 85 insertions(+), 7 deletions(-) diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow/gapic_version.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow/gapic_version.py index c34cf46454e4..558c8aab67c5 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow/gapic_version.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow/gapic_version.py @@ -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} diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/gapic_version.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/gapic_version.py index c34cf46454e4..558c8aab67c5 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/gapic_version.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/gapic_version.py @@ -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} diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_event.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_event.py index 5e7803b19708..849d9bd4da33 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_event.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_event.py @@ -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", @@ -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 @@ -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``. """ @@ -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. @@ -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( @@ -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)) diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_profile.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_profile.py index da87185af50d..5743baa763ca 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_profile.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2/types/conversation_profile.py @@ -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): @@ -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, diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/gapic_version.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/gapic_version.py index c34cf46454e4..558c8aab67c5 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/gapic_version.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/gapic_version.py @@ -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} diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation_event.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation_event.py index 3f6d53efa77f..ad94f74d2e28 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation_event.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation_event.py @@ -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", @@ -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 @@ -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``. """ @@ -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. @@ -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( @@ -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)) diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation_profile.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation_profile.py index 2833990358f9..af969b3c905f 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation_profile.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/conversation_profile.py @@ -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): @@ -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, diff --git a/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json b/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json index 5fba10b79137..7319fdfb442c 100644 --- a/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json +++ b/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-dialogflow", - "version": "2.37.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json b/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json index e97b1de71665..9da05b9adb39 100644 --- a/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json +++ b/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-dialogflow", - "version": "2.37.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py index 87487ae97adb..f2a4a6d94404 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py @@ -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", @@ -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", diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py index 82bde4e771fb..3be5468b0291 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py @@ -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", @@ -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",