From ef8205d7f816b6d4eba885c5293ba0e8cb80a4db Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 27 Jul 2022 11:35:27 -0400 Subject: [PATCH] docs: updated some method comments and added an explicit note that DetectIntentRequest's text input is limited by 256 characters (#545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: updated some method comments and added an explicit note that DetectIntentRequest's text input is limited by 256 characters PiperOrigin-RevId: 463362184 Source-Link: https://github.com/googleapis/googleapis/commit/1805fc2b06fd2813572f54553b8d030bf9f8b6bb Source-Link: https://github.com/googleapis/googleapis-gen/commit/c47083a7b829c85e3423250f7cf431f07238ad04 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQ3MDgzYTdiODI5Yzg1ZTM0MjMyNTBmN2NmNDMxZjA3MjM4YWQwNCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../services/participants/async_client.py | 18 ++++++++--------- .../services/participants/client.py | 18 ++++++++--------- .../dialogflow_v2beta1/types/answer_record.py | 3 --- .../dialogflow_v2beta1/types/participant.py | 7 ++++--- .../cloud/dialogflow_v2beta1/types/session.py | 3 ++- .../snippet_metadata_dialogflow_v2beta1.json | 16 +++++++-------- .../dialogflow_v2beta1/test_participants.py | 20 ++++++------------- 7 files changed, 38 insertions(+), 47 deletions(-) diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/participants/async_client.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/participants/async_client.py index 27d0d5c620dc..955f5908f016 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/participants/async_client.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/participants/async_client.py @@ -650,8 +650,8 @@ async def analyze_content( *, participant: str = None, text_input: session.TextInput = None, - event_input: session.EventInput = None, audio_input: gcd_participant.AudioInput = None, + event_input: session.EventInput = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -701,11 +701,6 @@ async def sample_analyze_content(): This corresponds to the ``text_input`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - event_input (:class:`google.cloud.dialogflow_v2beta1.types.EventInput`): - An input event to send to Dialogflow. - This corresponds to the ``event_input`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. audio_input (:class:`google.cloud.dialogflow_v2beta1.types.AudioInput`): The natural language speech audio to be processed. @@ -713,6 +708,11 @@ async def sample_analyze_content(): This corresponds to the ``audio_input`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + event_input (:class:`google.cloud.dialogflow_v2beta1.types.EventInput`): + An input event to send to Dialogflow. + This corresponds to the ``event_input`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -728,7 +728,7 @@ async def sample_analyze_content(): # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([participant, text_input, event_input, audio_input]) + has_flattened_params = any([participant, text_input, audio_input, event_input]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -743,10 +743,10 @@ async def sample_analyze_content(): request.participant = participant if text_input is not None: request.text_input = text_input - if event_input is not None: - request.event_input = event_input if audio_input is not None: request.audio_input = audio_input + if event_input is not None: + request.event_input = event_input # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/participants/client.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/participants/client.py index b54559c8fa28..bca7714f27c4 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/participants/client.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/services/participants/client.py @@ -988,8 +988,8 @@ def analyze_content( *, participant: str = None, text_input: session.TextInput = None, - event_input: session.EventInput = None, audio_input: gcd_participant.AudioInput = None, + event_input: session.EventInput = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -1039,11 +1039,6 @@ def sample_analyze_content(): This corresponds to the ``text_input`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - event_input (google.cloud.dialogflow_v2beta1.types.EventInput): - An input event to send to Dialogflow. - This corresponds to the ``event_input`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. audio_input (google.cloud.dialogflow_v2beta1.types.AudioInput): The natural language speech audio to be processed. @@ -1051,6 +1046,11 @@ def sample_analyze_content(): This corresponds to the ``audio_input`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + event_input (google.cloud.dialogflow_v2beta1.types.EventInput): + An input event to send to Dialogflow. + This corresponds to the ``event_input`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -1066,7 +1066,7 @@ def sample_analyze_content(): # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([participant, text_input, event_input, audio_input]) + has_flattened_params = any([participant, text_input, audio_input, event_input]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -1085,10 +1085,10 @@ def sample_analyze_content(): request.participant = participant if text_input is not None: request.text_input = text_input - if event_input is not None: - request.event_input = event_input if audio_input is not None: request.audio_input = audio_input + if event_input is not None: + request.event_input = event_input # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/answer_record.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/answer_record.py index 26659b81b107..e449a4e32643 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/answer_record.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/answer_record.py @@ -339,9 +339,6 @@ class ListAnswerRecordsRequest(proto.Message): Optional. Filters to restrict results to specific answer records. - Marked deprecated as it hasn't been, and isn't currently, - supported. - For more information about filtering, see `API Filtering `__. page_size (int): diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/participant.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/participant.py index 0355c5418c2c..36330ebee702 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/participant.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/participant.py @@ -375,7 +375,7 @@ class AudioInput(proto.Message): to be processed. A single request can contain up to 1 minute of speech audio data. The transcribed text cannot contain more than 256 - bytes. + bytes for virtual agent interactions. """ config = proto.Field( @@ -934,8 +934,9 @@ class StreamingAnalyzeContentRequest(proto.Message): input_text (str): The UTF-8 encoded natural language text to be processed. Must be sent if ``text_config`` is set in the first message. - Text length must not exceed 256 bytes. The ``input_text`` - field can be only sent once. + Text length must not exceed 256 bytes for virtual agent + interactions. The ``input_text`` field can be only sent + once. This field is a member of `oneof`_ ``input``. input_dtmf (google.cloud.dialogflow_v2beta1.types.TelephonyDtmfEvents): diff --git a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/session.py b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/session.py index 9f75fdadc94c..295b0a360021 100644 --- a/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/session.py +++ b/packages/google-cloud-dialogflow/google/cloud/dialogflow_v2beta1/types/session.py @@ -1057,7 +1057,8 @@ class TextInput(proto.Message): text (str): Required. The UTF-8 encoded natural language text to be processed. Text length must not - exceed 256 characters. + exceed 256 characters for virtual agent + interactions. language_code (str): Required. The language of this conversational query. See `Language diff --git a/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_dialogflow_v2beta1.json b/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_dialogflow_v2beta1.json index e33a863da657..ae72eaba8841 100644 --- a/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_dialogflow_v2beta1.json +++ b/packages/google-cloud-dialogflow/samples/generated_samples/snippet_metadata_dialogflow_v2beta1.json @@ -11124,14 +11124,14 @@ "name": "text_input", "type": "google.cloud.dialogflow_v2beta1.types.TextInput" }, - { - "name": "event_input", - "type": "google.cloud.dialogflow_v2beta1.types.EventInput" - }, { "name": "audio_input", "type": "google.cloud.dialogflow_v2beta1.types.AudioInput" }, + { + "name": "event_input", + "type": "google.cloud.dialogflow_v2beta1.types.EventInput" + }, { "name": "retry", "type": "google.api_core.retry.Retry" @@ -11216,14 +11216,14 @@ "name": "text_input", "type": "google.cloud.dialogflow_v2beta1.types.TextInput" }, - { - "name": "event_input", - "type": "google.cloud.dialogflow_v2beta1.types.EventInput" - }, { "name": "audio_input", "type": "google.cloud.dialogflow_v2beta1.types.AudioInput" }, + { + "name": "event_input", + "type": "google.cloud.dialogflow_v2beta1.types.EventInput" + }, { "name": "retry", "type": "google.api_core.retry.Retry" diff --git a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_participants.py b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_participants.py index bc2ce9d0ea04..3ef8a55ec446 100644 --- a/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_participants.py +++ b/packages/google-cloud-dialogflow/tests/unit/gapic/dialogflow_v2beta1/test_participants.py @@ -2061,12 +2061,12 @@ def test_analyze_content_flattened(): client.analyze_content( participant="participant_value", text_input=session.TextInput(text="text_value"), - event_input=session.EventInput(name="name_value"), audio_input=gcd_participant.AudioInput( config=audio_config.InputAudioConfig( audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16 ) ), + event_input=session.EventInput(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -2076,11 +2076,7 @@ def test_analyze_content_flattened(): arg = args[0].participant mock_val = "participant_value" assert arg == mock_val - assert args[0].audio_input == gcd_participant.AudioInput( - config=audio_config.InputAudioConfig( - audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16 - ) - ) + assert args[0].event_input == session.EventInput(name="name_value") def test_analyze_content_flattened_error(): @@ -2095,12 +2091,12 @@ def test_analyze_content_flattened_error(): gcd_participant.AnalyzeContentRequest(), participant="participant_value", text_input=session.TextInput(text="text_value"), - event_input=session.EventInput(name="name_value"), audio_input=gcd_participant.AudioInput( config=audio_config.InputAudioConfig( audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16 ) ), + event_input=session.EventInput(name="name_value"), ) @@ -2123,12 +2119,12 @@ async def test_analyze_content_flattened_async(): response = await client.analyze_content( participant="participant_value", text_input=session.TextInput(text="text_value"), - event_input=session.EventInput(name="name_value"), audio_input=gcd_participant.AudioInput( config=audio_config.InputAudioConfig( audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16 ) ), + event_input=session.EventInput(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -2138,11 +2134,7 @@ async def test_analyze_content_flattened_async(): arg = args[0].participant mock_val = "participant_value" assert arg == mock_val - assert args[0].audio_input == gcd_participant.AudioInput( - config=audio_config.InputAudioConfig( - audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16 - ) - ) + assert args[0].event_input == session.EventInput(name="name_value") @pytest.mark.asyncio @@ -2158,12 +2150,12 @@ async def test_analyze_content_flattened_error_async(): gcd_participant.AnalyzeContentRequest(), participant="participant_value", text_input=session.TextInput(text="text_value"), - event_input=session.EventInput(name="name_value"), audio_input=gcd_participant.AudioInput( config=audio_config.InputAudioConfig( audio_encoding=audio_config.AudioEncoding.AUDIO_ENCODING_LINEAR_16 ) ), + event_input=session.EventInput(name="name_value"), )