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

Commit fa5fd8b

Browse files
feat: added HUMAN_INTERVENTION_NEEDED type in ConversationEvent (#488)
* feat: added HUMAN_INTERVENTION_NEEDED type in ConversationEvent feat: added SetSuggestionFeatureConfig and ClearSuggestionFeatureConfig apis feat: added AGENT_FACING_SMART_REPLY type in KnowledgeType feat: added GcsDestination. docs: added explanation for uri fields in resources docs: added explanation for SuggestionResult docs: added explanation for language code in session PiperOrigin-RevId: 435479473 Source-Link: googleapis/googleapis@d9ca515 Source-Link: https://github.com/googleapis/googleapis-gen/commit/358c4b9b1df149bc50620bc3811004f913d43236 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzU4YzRiOWIxZGYxNDliYzUwNjIwYmMzODExMDA0ZjkxM2Q0MzIzNiJ9 * 🦉 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>
1 parent 546689d commit fa5fd8b

23 files changed

+1950
-10
lines changed

google/cloud/dialogflow_v2beta1/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@
101101
from .types.conversation import ListMessagesResponse
102102
from .types.conversation_event import ConversationEvent
103103
from .types.conversation_profile import AutomatedAgentConfig
104+
from .types.conversation_profile import ClearSuggestionFeatureConfigOperationMetadata
105+
from .types.conversation_profile import ClearSuggestionFeatureConfigRequest
104106
from .types.conversation_profile import ConversationProfile
105107
from .types.conversation_profile import CreateConversationProfileRequest
106108
from .types.conversation_profile import DeleteConversationProfileRequest
@@ -111,10 +113,13 @@
111113
from .types.conversation_profile import ListConversationProfilesResponse
112114
from .types.conversation_profile import LoggingConfig
113115
from .types.conversation_profile import NotificationConfig
116+
from .types.conversation_profile import SetSuggestionFeatureConfigOperationMetadata
117+
from .types.conversation_profile import SetSuggestionFeatureConfigRequest
114118
from .types.conversation_profile import UpdateConversationProfileRequest
115119
from .types.document import CreateDocumentRequest
116120
from .types.document import DeleteDocumentRequest
117121
from .types.document import Document
122+
from .types.document import ExportOperationMetadata
118123
from .types.document import GetDocumentRequest
119124
from .types.document import ImportDocumentsRequest
120125
from .types.document import ImportDocumentsResponse
@@ -151,6 +156,7 @@
151156
from .types.fulfillment import Fulfillment
152157
from .types.fulfillment import GetFulfillmentRequest
153158
from .types.fulfillment import UpdateFulfillmentRequest
159+
from .types.gcs import GcsDestination
154160
from .types.gcs import GcsSource
155161
from .types.gcs import GcsSources
156162
from .types.human_agent_assistant_event import HumanAgentAssistantEvent
@@ -281,6 +287,8 @@
281287
"BatchUpdateEntityTypesResponse",
282288
"BatchUpdateIntentsRequest",
283289
"BatchUpdateIntentsResponse",
290+
"ClearSuggestionFeatureConfigOperationMetadata",
291+
"ClearSuggestionFeatureConfigRequest",
284292
"CompileSuggestionRequest",
285293
"CompileSuggestionResponse",
286294
"CompleteConversationRequest",
@@ -329,9 +337,11 @@
329337
"EventInput",
330338
"ExportAgentRequest",
331339
"ExportAgentResponse",
340+
"ExportOperationMetadata",
332341
"FaqAnswer",
333342
"Fulfillment",
334343
"FulfillmentsClient",
344+
"GcsDestination",
335345
"GcsSource",
336346
"GcsSources",
337347
"GetAgentRequest",
@@ -419,6 +429,8 @@
419429
"SessionEntityTypesClient",
420430
"SessionsClient",
421431
"SetAgentRequest",
432+
"SetSuggestionFeatureConfigOperationMetadata",
433+
"SetSuggestionFeatureConfigRequest",
422434
"SmartReplyAnswer",
423435
"SpeechContext",
424436
"SpeechModelVariant",

google/cloud/dialogflow_v2beta1/gapic_metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@
232232
"grpc": {
233233
"libraryClient": "ConversationProfilesClient",
234234
"rpcs": {
235+
"ClearSuggestionFeatureConfig": {
236+
"methods": [
237+
"clear_suggestion_feature_config"
238+
]
239+
},
235240
"CreateConversationProfile": {
236241
"methods": [
237242
"create_conversation_profile"
@@ -252,6 +257,11 @@
252257
"list_conversation_profiles"
253258
]
254259
},
260+
"SetSuggestionFeatureConfig": {
261+
"methods": [
262+
"set_suggestion_feature_config"
263+
]
264+
},
255265
"UpdateConversationProfile": {
256266
"methods": [
257267
"update_conversation_profile"
@@ -262,6 +272,11 @@
262272
"grpc-async": {
263273
"libraryClient": "ConversationProfilesAsyncClient",
264274
"rpcs": {
275+
"ClearSuggestionFeatureConfig": {
276+
"methods": [
277+
"clear_suggestion_feature_config"
278+
]
279+
},
265280
"CreateConversationProfile": {
266281
"methods": [
267282
"create_conversation_profile"
@@ -282,6 +297,11 @@
282297
"list_conversation_profiles"
283298
]
284299
},
300+
"SetSuggestionFeatureConfig": {
301+
"methods": [
302+
"set_suggestion_feature_config"
303+
]
304+
},
285305
"UpdateConversationProfile": {
286306
"methods": [
287307
"update_conversation_profile"

google/cloud/dialogflow_v2beta1/services/conversation_profiles/async_client.py

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
except AttributeError: # pragma: NO COVER
3232
OptionalRetry = Union[retries.Retry, object] # type: ignore
3333

34+
from google.api_core import operation # type: ignore
35+
from google.api_core import operation_async # type: ignore
3436
from google.cloud.dialogflow_v2beta1.services.conversation_profiles import pagers
3537
from google.cloud.dialogflow_v2beta1.types import audio_config
3638
from google.cloud.dialogflow_v2beta1.types import conversation_profile
@@ -744,6 +746,263 @@ def sample_delete_conversation_profile():
744746
request, retry=retry, timeout=timeout, metadata=metadata,
745747
)
746748

749+
async def set_suggestion_feature_config(
750+
self,
751+
request: Union[
752+
gcd_conversation_profile.SetSuggestionFeatureConfigRequest, dict
753+
] = None,
754+
*,
755+
conversation_profile: str = None,
756+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
757+
timeout: float = None,
758+
metadata: Sequence[Tuple[str, str]] = (),
759+
) -> operation_async.AsyncOperation:
760+
r"""Adds or updates a suggestion feature in a conversation profile.
761+
If the conversation profile contains the type of suggestion
762+
feature for the participant role, it will update it. Otherwise
763+
it will insert the suggestion feature.
764+
765+
This method is a `long-running
766+
operation <https://cloud.google.com/dialogflow/es/docs/how/long-running-operations>`__.
767+
The returned ``Operation`` type has the following
768+
method-specific fields:
769+
770+
- ``metadata``:
771+
[SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata]
772+
- ``response``:
773+
[ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]
774+
775+
If a long running operation to add or update suggestion feature
776+
config for the same conversation profile, participant role and
777+
suggestion feature type exists, please cancel the existing long
778+
running operation before sending such request, otherwise the
779+
request will be rejected.
780+
781+
782+
.. code-block:: python
783+
784+
from google.cloud import dialogflow_v2beta1
785+
786+
def sample_set_suggestion_feature_config():
787+
# Create a client
788+
client = dialogflow_v2beta1.ConversationProfilesClient()
789+
790+
# Initialize request argument(s)
791+
request = dialogflow_v2beta1.SetSuggestionFeatureConfigRequest(
792+
conversation_profile="conversation_profile_value",
793+
participant_role="END_USER",
794+
)
795+
796+
# Make the request
797+
operation = client.set_suggestion_feature_config(request=request)
798+
799+
print("Waiting for operation to complete...")
800+
801+
response = operation.result()
802+
803+
# Handle the response
804+
print(response)
805+
806+
Args:
807+
request (Union[google.cloud.dialogflow_v2beta1.types.SetSuggestionFeatureConfigRequest, dict]):
808+
The request object. The request message for
809+
[ConversationProfiles.SetSuggestionFeature][].
810+
conversation_profile (:class:`str`):
811+
Required. The Conversation Profile to add or update the
812+
suggestion feature config. Format:
813+
``projects/<Project ID>/locations/<Location ID>/conversationProfiles/<Conversation Profile ID>``.
814+
815+
This corresponds to the ``conversation_profile`` field
816+
on the ``request`` instance; if ``request`` is provided, this
817+
should not be set.
818+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
819+
should be retried.
820+
timeout (float): The timeout for this request.
821+
metadata (Sequence[Tuple[str, str]]): Strings which should be
822+
sent along with the request as metadata.
823+
824+
Returns:
825+
google.api_core.operation_async.AsyncOperation:
826+
An object representing a long-running operation.
827+
828+
The result type for the operation will be
829+
:class:`google.cloud.dialogflow_v2beta1.types.ConversationProfile`
830+
Defines the services to connect to incoming Dialogflow
831+
conversations.
832+
833+
"""
834+
# Create or coerce a protobuf request object.
835+
# Quick check: If we got a request object, we should *not* have
836+
# gotten any keyword arguments that map to the request.
837+
has_flattened_params = any([conversation_profile])
838+
if request is not None and has_flattened_params:
839+
raise ValueError(
840+
"If the `request` argument is set, then none of "
841+
"the individual field arguments should be set."
842+
)
843+
844+
request = gcd_conversation_profile.SetSuggestionFeatureConfigRequest(request)
845+
846+
# If we have keyword arguments corresponding to fields on the
847+
# request, apply these.
848+
if conversation_profile is not None:
849+
request.conversation_profile = conversation_profile
850+
851+
# Wrap the RPC method; this adds retry and timeout information,
852+
# and friendly error handling.
853+
rpc = gapic_v1.method_async.wrap_method(
854+
self._client._transport.set_suggestion_feature_config,
855+
default_timeout=None,
856+
client_info=DEFAULT_CLIENT_INFO,
857+
)
858+
859+
# Certain fields should be provided within the metadata header;
860+
# add these here.
861+
metadata = tuple(metadata) + (
862+
gapic_v1.routing_header.to_grpc_metadata(
863+
(("conversation_profile", request.conversation_profile),)
864+
),
865+
)
866+
867+
# Send the request.
868+
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
869+
870+
# Wrap the response in an operation future.
871+
response = operation_async.from_gapic(
872+
response,
873+
self._client._transport.operations_client,
874+
gcd_conversation_profile.ConversationProfile,
875+
metadata_type=gcd_conversation_profile.SetSuggestionFeatureConfigOperationMetadata,
876+
)
877+
878+
# Done; return the response.
879+
return response
880+
881+
async def clear_suggestion_feature_config(
882+
self,
883+
request: Union[
884+
gcd_conversation_profile.ClearSuggestionFeatureConfigRequest, dict
885+
] = None,
886+
*,
887+
conversation_profile: str = None,
888+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
889+
timeout: float = None,
890+
metadata: Sequence[Tuple[str, str]] = (),
891+
) -> operation_async.AsyncOperation:
892+
r"""Clears a suggestion feature from a conversation profile for the
893+
given participant role.
894+
895+
This method is a `long-running
896+
operation <https://cloud.google.com/dialogflow/es/docs/how/long-running-operations>`__.
897+
The returned ``Operation`` type has the following
898+
method-specific fields:
899+
900+
- ``metadata``:
901+
[ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata]
902+
- ``response``:
903+
[ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]
904+
905+
906+
.. code-block:: python
907+
908+
from google.cloud import dialogflow_v2beta1
909+
910+
def sample_clear_suggestion_feature_config():
911+
# Create a client
912+
client = dialogflow_v2beta1.ConversationProfilesClient()
913+
914+
# Initialize request argument(s)
915+
request = dialogflow_v2beta1.ClearSuggestionFeatureConfigRequest(
916+
conversation_profile="conversation_profile_value",
917+
participant_role="END_USER",
918+
suggestion_feature_type="SMART_REPLY",
919+
)
920+
921+
# Make the request
922+
operation = client.clear_suggestion_feature_config(request=request)
923+
924+
print("Waiting for operation to complete...")
925+
926+
response = operation.result()
927+
928+
# Handle the response
929+
print(response)
930+
931+
Args:
932+
request (Union[google.cloud.dialogflow_v2beta1.types.ClearSuggestionFeatureConfigRequest, dict]):
933+
The request object. The request message for
934+
[ConversationProfiles.ClearFeature][].
935+
conversation_profile (:class:`str`):
936+
Required. The Conversation Profile to add or update the
937+
suggestion feature config. Format:
938+
``projects/<Project ID>/locations/<Location ID>/conversationProfiles/<Conversation Profile ID>``.
939+
940+
This corresponds to the ``conversation_profile`` field
941+
on the ``request`` instance; if ``request`` is provided, this
942+
should not be set.
943+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
944+
should be retried.
945+
timeout (float): The timeout for this request.
946+
metadata (Sequence[Tuple[str, str]]): Strings which should be
947+
sent along with the request as metadata.
948+
949+
Returns:
950+
google.api_core.operation_async.AsyncOperation:
951+
An object representing a long-running operation.
952+
953+
The result type for the operation will be
954+
:class:`google.cloud.dialogflow_v2beta1.types.ConversationProfile`
955+
Defines the services to connect to incoming Dialogflow
956+
conversations.
957+
958+
"""
959+
# Create or coerce a protobuf request object.
960+
# Quick check: If we got a request object, we should *not* have
961+
# gotten any keyword arguments that map to the request.
962+
has_flattened_params = any([conversation_profile])
963+
if request is not None and has_flattened_params:
964+
raise ValueError(
965+
"If the `request` argument is set, then none of "
966+
"the individual field arguments should be set."
967+
)
968+
969+
request = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest(request)
970+
971+
# If we have keyword arguments corresponding to fields on the
972+
# request, apply these.
973+
if conversation_profile is not None:
974+
request.conversation_profile = conversation_profile
975+
976+
# Wrap the RPC method; this adds retry and timeout information,
977+
# and friendly error handling.
978+
rpc = gapic_v1.method_async.wrap_method(
979+
self._client._transport.clear_suggestion_feature_config,
980+
default_timeout=None,
981+
client_info=DEFAULT_CLIENT_INFO,
982+
)
983+
984+
# Certain fields should be provided within the metadata header;
985+
# add these here.
986+
metadata = tuple(metadata) + (
987+
gapic_v1.routing_header.to_grpc_metadata(
988+
(("conversation_profile", request.conversation_profile),)
989+
),
990+
)
991+
992+
# Send the request.
993+
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
994+
995+
# Wrap the response in an operation future.
996+
response = operation_async.from_gapic(
997+
response,
998+
self._client._transport.operations_client,
999+
gcd_conversation_profile.ConversationProfile,
1000+
metadata_type=gcd_conversation_profile.ClearSuggestionFeatureConfigOperationMetadata,
1001+
)
1002+
1003+
# Done; return the response.
1004+
return response
1005+
7471006
async def __aenter__(self):
7481007
return self
7491008

0 commit comments

Comments
 (0)