Skip to content
This repository was archived by the owner on Dec 17, 2023. It is now read-only.

Commit 784954e

Browse files
committed
chore: regen
1 parent c7df05c commit 784954e

27 files changed

+1339
-939
lines changed

dialogflow_v2/gapic/agents_client.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from dialogflow_v2.gapic.transports import agents_grpc_transport
4040
from dialogflow_v2.proto import agent_pb2
4141
from dialogflow_v2.proto import agent_pb2_grpc
42+
from dialogflow_v2.proto import validation_result_pb2
4243
from google.longrunning import operations_pb2
4344
from google.protobuf import empty_pb2
4445
from google.protobuf import field_mask_pb2
@@ -932,3 +933,80 @@ def restore_agent(
932933
empty_pb2.Empty,
933934
metadata_type=struct_pb2.Struct,
934935
)
936+
937+
def get_validation_result(
938+
self,
939+
parent=None,
940+
language_code=None,
941+
retry=google.api_core.gapic_v1.method.DEFAULT,
942+
timeout=google.api_core.gapic_v1.method.DEFAULT,
943+
metadata=None,
944+
):
945+
"""
946+
Gets agent validation result. Agent validation is performed during
947+
training time and is updated automatically when training is completed.
948+
949+
Example:
950+
>>> import dialogflow_v2
951+
>>>
952+
>>> client = dialogflow_v2.AgentsClient()
953+
>>>
954+
>>> response = client.get_validation_result()
955+
956+
Args:
957+
parent (str): Required. The project that the agent is associated with. Format:
958+
``projects/<Project ID>``.
959+
language_code (str): Optional. The language for which you want a validation result. If not
960+
specified, the agent's default language is used. `Many
961+
languages <https://cloud.google.com/dialogflow/docs/reference/language>`__
962+
are supported. Note: languages must be enabled in the agent before they
963+
can be used.
964+
retry (Optional[google.api_core.retry.Retry]): A retry object used
965+
to retry requests. If ``None`` is specified, requests will
966+
be retried using a default configuration.
967+
timeout (Optional[float]): The amount of time, in seconds, to wait
968+
for the request to complete. Note that if ``retry`` is
969+
specified, the timeout applies to each individual attempt.
970+
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
971+
that is provided to the method.
972+
973+
Returns:
974+
A :class:`~google.cloud.dialogflow_v2.types.ValidationResult` instance.
975+
976+
Raises:
977+
google.api_core.exceptions.GoogleAPICallError: If the request
978+
failed for any reason.
979+
google.api_core.exceptions.RetryError: If the request failed due
980+
to a retryable error and retry attempts failed.
981+
ValueError: If the parameters are invalid.
982+
"""
983+
# Wrap the transport method to add retry and timeout logic.
984+
if "get_validation_result" not in self._inner_api_calls:
985+
self._inner_api_calls[
986+
"get_validation_result"
987+
] = google.api_core.gapic_v1.method.wrap_method(
988+
self.transport.get_validation_result,
989+
default_retry=self._method_configs["GetValidationResult"].retry,
990+
default_timeout=self._method_configs["GetValidationResult"].timeout,
991+
client_info=self._client_info,
992+
)
993+
994+
request = agent_pb2.GetValidationResultRequest(
995+
parent=parent, language_code=language_code
996+
)
997+
if metadata is None:
998+
metadata = []
999+
metadata = list(metadata)
1000+
try:
1001+
routing_header = [("parent", parent)]
1002+
except AttributeError:
1003+
pass
1004+
else:
1005+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
1006+
routing_header
1007+
)
1008+
metadata.append(routing_metadata)
1009+
1010+
return self._inner_api_calls["get_validation_result"](
1011+
request, retry=retry, timeout=timeout, metadata=metadata
1012+
)

dialogflow_v2/gapic/agents_client_config.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@
5757
"retry_codes_name": "idempotent",
5858
"retry_params_name": "default",
5959
},
60+
"GetValidationResult": {
61+
"timeout_millis": 60000,
62+
"retry_codes_name": "idempotent",
63+
"retry_params_name": "default",
64+
},
6065
},
6166
}
6267
}

dialogflow_v2/gapic/contexts_client.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from dialogflow_v2.proto import agent_pb2_grpc
3939
from dialogflow_v2.proto import context_pb2
4040
from dialogflow_v2.proto import context_pb2_grpc
41+
from dialogflow_v2.proto import validation_result_pb2
4142
from google.longrunning import operations_pb2
4243
from google.protobuf import empty_pb2
4344
from google.protobuf import field_mask_pb2
@@ -260,7 +261,11 @@ def list_contexts(
260261
261262
Args:
262263
parent (str): Required. The session to list all contexts from. Format:
263-
``projects/<Project ID>/agent/sessions/<Session ID>``.
264+
``projects/<Project ID>/agent/sessions/<Session ID>`` or
265+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>``.
266+
If ``Environment ID`` is not specified, we assume default 'draft'
267+
environment. If ``User ID`` is not specified, we assume default '-'
268+
user.
264269
page_size (int): The maximum number of resources contained in the
265270
underlying API response. If page streaming is performed per-
266271
resource, this parameter does not affect the return value. If page
@@ -349,7 +354,12 @@ def get_context(
349354
350355
Args:
351356
name (str): Required. The name of the context. Format:
352-
``projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>``.
357+
``projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>``
358+
or
359+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>``.
360+
If ``Environment ID`` is not specified, we assume default 'draft'
361+
environment. If ``User ID`` is not specified, we assume default '-'
362+
user.
353363
retry (Optional[google.api_core.retry.Retry]): A retry object used
354364
to retry requests. If ``None`` is specified, requests will
355365
be retried using a default configuration.
@@ -425,7 +435,11 @@ def create_context(
425435
426436
Args:
427437
parent (str): Required. The session to create a context for. Format:
428-
``projects/<Project ID>/agent/sessions/<Session ID>``.
438+
``projects/<Project ID>/agent/sessions/<Session ID>`` or
439+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>``.
440+
If ``Environment ID`` is not specified, we assume default 'draft'
441+
environment. If ``User ID`` is not specified, we assume default '-'
442+
user.
429443
context (Union[dict, ~google.cloud.dialogflow_v2.types.Context]): Required. The context to create.
430444
431445
If a dict is provided, it must be of the same form as the protobuf
@@ -579,7 +593,12 @@ def delete_context(
579593
580594
Args:
581595
name (str): Required. The name of the context to delete. Format:
582-
``projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>``.
596+
``projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>``
597+
or
598+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>``.
599+
If ``Environment ID`` is not specified, we assume default 'draft'
600+
environment. If ``User ID`` is not specified, we assume default '-'
601+
user.
583602
retry (Optional[google.api_core.retry.Retry]): A retry object used
584603
to retry requests. If ``None`` is specified, requests will
585604
be retried using a default configuration.
@@ -646,7 +665,11 @@ def delete_all_contexts(
646665
647666
Args:
648667
parent (str): Required. The name of the session to delete all contexts from. Format:
649-
``projects/<Project ID>/agent/sessions/<Session ID>``.
668+
``projects/<Project ID>/agent/sessions/<Session ID>`` or
669+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>``.
670+
If ``Environment ID`` is not specified we assume default 'draft'
671+
environment. If ``User ID`` is not specified, we assume default '-'
672+
user.
650673
retry (Optional[google.api_core.retry.Retry]): A retry object used
651674
to retry requests. If ``None`` is specified, requests will
652675
be retried using a default configuration.

dialogflow_v2/gapic/entity_types_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from dialogflow_v2.proto import context_pb2_grpc
4444
from dialogflow_v2.proto import entity_type_pb2
4545
from dialogflow_v2.proto import entity_type_pb2_grpc
46+
from dialogflow_v2.proto import validation_result_pb2
4647
from google.longrunning import operations_pb2
4748
from google.protobuf import empty_pb2
4849
from google.protobuf import field_mask_pb2

dialogflow_v2/gapic/enums.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,23 @@ class MessageType(enum.IntEnum):
517517
MESSAGE_TYPE_UNSPECIFIED = 0
518518
TRANSCRIPT = 1
519519
END_OF_SINGLE_UTTERANCE = 2
520+
521+
522+
class ValidationError(object):
523+
class Severity(enum.IntEnum):
524+
"""
525+
Represents a level of severity.
526+
527+
Attributes:
528+
SEVERITY_UNSPECIFIED (int): Not specified. This value should never be used.
529+
INFO (int): The agent doesn't follow Dialogflow best practicies.
530+
WARNING (int): The agent may not behave as expected.
531+
ERROR (int): The agent may experience partial failures.
532+
CRITICAL (int): The agent may completely fail.
533+
"""
534+
535+
SEVERITY_UNSPECIFIED = 0
536+
INFO = 1
537+
WARNING = 2
538+
ERROR = 3
539+
CRITICAL = 4

dialogflow_v2/gapic/intents_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from dialogflow_v2.proto import entity_type_pb2_grpc
4646
from dialogflow_v2.proto import intent_pb2
4747
from dialogflow_v2.proto import intent_pb2_grpc
48+
from dialogflow_v2.proto import validation_result_pb2
4849
from google.longrunning import operations_pb2
4950
from google.protobuf import empty_pb2
5051
from google.protobuf import field_mask_pb2

dialogflow_v2/gapic/session_entity_types_client.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from dialogflow_v2.proto import intent_pb2_grpc
4545
from dialogflow_v2.proto import session_entity_type_pb2
4646
from dialogflow_v2.proto import session_entity_type_pb2_grpc
47+
from dialogflow_v2.proto import validation_result_pb2
4748
from google.longrunning import operations_pb2
4849
from google.protobuf import empty_pb2
4950
from google.protobuf import field_mask_pb2
@@ -270,7 +271,11 @@ def list_session_entity_types(
270271
271272
Args:
272273
parent (str): Required. The session to list all session entity types from. Format:
273-
``projects/<Project ID>/agent/sessions/<Session ID>``.
274+
``projects/<Project ID>/agent/sessions/<Session ID>`` or
275+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/ sessions/<Session ID>``.
276+
If ``Environment ID`` is not specified, we assume default 'draft'
277+
environment. If ``User ID`` is not specified, we assume default '-'
278+
user.
274279
page_size (int): The maximum number of resources contained in the
275280
underlying API response. If page streaming is performed per-
276281
resource, this parameter does not affect the return value. If page
@@ -365,7 +370,12 @@ def get_session_entity_type(
365370
366371
Args:
367372
name (str): Required. The name of the session entity type. Format:
368-
``projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>``.
373+
``projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>``
374+
or
375+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display Name>``.
376+
If ``Environment ID`` is not specified, we assume default 'draft'
377+
environment. If ``User ID`` is not specified, we assume default '-'
378+
user.
369379
retry (Optional[google.api_core.retry.Retry]): A retry object used
370380
to retry requests. If ``None`` is specified, requests will
371381
be retried using a default configuration.
@@ -446,7 +456,11 @@ def create_session_entity_type(
446456
447457
Args:
448458
parent (str): Required. The session to create a session entity type for. Format:
449-
``projects/<Project ID>/agent/sessions/<Session ID>``.
459+
``projects/<Project ID>/agent/sessions/<Session ID>`` or
460+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/ sessions/<Session ID>``.
461+
If ``Environment ID`` is not specified, we assume default 'draft'
462+
environment. If ``User ID`` is not specified, we assume default '-'
463+
user.
450464
session_entity_type (Union[dict, ~google.cloud.dialogflow_v2.types.SessionEntityType]): Required. The session entity type to create.
451465
452466
If a dict is provided, it must be of the same form as the protobuf
@@ -527,8 +541,7 @@ def update_session_entity_type(
527541
>>> response = client.update_session_entity_type(session_entity_type)
528542
529543
Args:
530-
session_entity_type (Union[dict, ~google.cloud.dialogflow_v2.types.SessionEntityType]): Required. The entity type to update. Format:
531-
``projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>``.
544+
session_entity_type (Union[dict, ~google.cloud.dialogflow_v2.types.SessionEntityType]): Required. The session entity type to update.
532545
533546
If a dict is provided, it must be of the same form as the protobuf
534547
message :class:`~google.cloud.dialogflow_v2.types.SessionEntityType`
@@ -611,7 +624,12 @@ def delete_session_entity_type(
611624
612625
Args:
613626
name (str): Required. The name of the entity type to delete. Format:
614-
``projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>``.
627+
``projects/<Project ID>/agent/sessions/<Session ID>/entityTypes/<Entity Type Display Name>``
628+
or
629+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/entityTypes/<Entity Type Display Name>``.
630+
If ``Environment ID`` is not specified, we assume default 'draft'
631+
environment. If ``User ID`` is not specified, we assume default '-'
632+
user.
615633
retry (Optional[google.api_core.retry.Retry]): A retry object used
616634
to retry requests. If ``None`` is specified, requests will
617635
be retried using a default configuration.

dialogflow_v2/gapic/sessions_client.py

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from dialogflow_v2.proto import session_entity_type_pb2_grpc
4646
from dialogflow_v2.proto import session_pb2
4747
from dialogflow_v2.proto import session_pb2_grpc
48+
from dialogflow_v2.proto import validation_result_pb2
4849
from google.longrunning import operations_pb2
4950
from google.protobuf import empty_pb2
5051
from google.protobuf import field_mask_pb2
@@ -216,6 +217,7 @@ def detect_intent(
216217
query_input,
217218
query_params=None,
218219
output_audio_config=None,
220+
output_audio_config_mask=None,
219221
input_audio=None,
220222
retry=google.api_core.gapic_v1.method.DEFAULT,
221223
timeout=google.api_core.gapic_v1.method.DEFAULT,
@@ -241,10 +243,14 @@ def detect_intent(
241243
242244
Args:
243245
session (str): Required. The name of the session this query is sent to. Format:
244-
``projects/<Project ID>/agent/sessions/<Session ID>``. It's up to the
245-
API caller to choose an appropriate session ID. It can be a random
246-
number or some type of user identifier (preferably hashed). The length
247-
of the session ID must not exceed 36 bytes.
246+
``projects/<Project ID>/agent/sessions/<Session ID>``, or
247+
``projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>``.
248+
If ``Environment ID`` is not specified, we assume default 'draft'
249+
environment. If ``User ID`` is not specified, we are using "-". It's up
250+
to the API caller to choose an appropriate ``Session ID`` and
251+
``User Id``. They can be a random number or some type of user and
252+
session identifiers (preferably hashed). The length of the
253+
``Session ID`` and ``User ID`` must not exceed 36 characters.
248254
query_input (Union[dict, ~google.cloud.dialogflow_v2.types.QueryInput]): Required. The input specification. It can be set to:
249255
250256
1. an audio config
@@ -256,19 +262,28 @@ def detect_intent(
256262
257263
If a dict is provided, it must be of the same form as the protobuf
258264
message :class:`~google.cloud.dialogflow_v2.types.QueryInput`
259-
query_params (Union[dict, ~google.cloud.dialogflow_v2.types.QueryParameters]): Optional. The parameters of this query.
265+
query_params (Union[dict, ~google.cloud.dialogflow_v2.types.QueryParameters]): The parameters of this query.
260266
261267
If a dict is provided, it must be of the same form as the protobuf
262268
message :class:`~google.cloud.dialogflow_v2.types.QueryParameters`
263-
output_audio_config (Union[dict, ~google.cloud.dialogflow_v2.types.OutputAudioConfig]): Optional. Instructs the speech synthesizer how to generate the output
269+
output_audio_config (Union[dict, ~google.cloud.dialogflow_v2.types.OutputAudioConfig]): Instructs the speech synthesizer how to generate the output
264270
audio. If this field is not set and agent-level speech synthesizer is not
265271
configured, no output audio is generated.
266272
267273
If a dict is provided, it must be of the same form as the protobuf
268274
message :class:`~google.cloud.dialogflow_v2.types.OutputAudioConfig`
269-
input_audio (bytes): Optional. The natural language speech audio to be processed. This field
270-
should be populated iff ``query_input`` is set to an input audio config.
271-
A single request can contain up to 1 minute of speech audio data.
275+
output_audio_config_mask (Union[dict, ~google.cloud.dialogflow_v2.types.FieldMask]): Mask for ``output_audio_config`` indicating which settings in this
276+
request-level config should override speech synthesizer settings defined
277+
at agent-level.
278+
279+
If unspecified or empty, ``output_audio_config`` replaces the
280+
agent-level config in its entirety.
281+
282+
If a dict is provided, it must be of the same form as the protobuf
283+
message :class:`~google.cloud.dialogflow_v2.types.FieldMask`
284+
input_audio (bytes): The natural language speech audio to be processed. This field should be
285+
populated iff ``query_input`` is set to an input audio config. A single
286+
request can contain up to 1 minute of speech audio data.
272287
retry (Optional[google.api_core.retry.Retry]): A retry object used
273288
to retry requests. If ``None`` is specified, requests will
274289
be retried using a default configuration.
@@ -304,6 +319,7 @@ def detect_intent(
304319
query_input=query_input,
305320
query_params=query_params,
306321
output_audio_config=output_audio_config,
322+
output_audio_config_mask=output_audio_config_mask,
307323
input_audio=input_audio,
308324
)
309325
if metadata is None:
@@ -335,8 +351,6 @@ def streaming_detect_intent(
335351
and returns structured, actionable data as a result. This method is only
336352
available via the gRPC API (not REST).
337353
338-
EXPERIMENTAL: This method interface might change in the future.
339-
340354
Example:
341355
>>> import dialogflow_v2
342356
>>>

0 commit comments

Comments
 (0)