Skip to content

Commit

Permalink
docs: updated some method comments and added an explicit note that De…
Browse files Browse the repository at this point in the history
…tectIntentRequest's text input is limited by 256 characters (#545)

* 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: googleapis/googleapis@1805fc2

Source-Link: googleapis/googleapis-gen@c47083a
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 <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Jul 27, 2022
1 parent 3b05c67 commit ef8205d
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = (),
Expand Down Expand Up @@ -701,18 +701,18 @@ 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.
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.
Expand All @@ -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 "
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = (),
Expand Down Expand Up @@ -1039,18 +1039,18 @@ 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.
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.
Expand All @@ -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 "
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://aip.dev/160>`__.
page_size (int):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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():
Expand All @@ -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"),
)


Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"),
)


Expand Down

0 comments on commit ef8205d

Please sign in to comment.