Skip to content

Commit

Permalink
feat: added HUMAN_INTERVENTION_NEEDED type in ConversationEvent (#488)
Browse files Browse the repository at this point in the history
* 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: googleapis/googleapis-gen@358c4b9
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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Mar 18, 2022
1 parent 2fb2fff commit e5effaa
Show file tree
Hide file tree
Showing 23 changed files with 1,950 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
from .types.conversation import ListMessagesResponse
from .types.conversation_event import ConversationEvent
from .types.conversation_profile import AutomatedAgentConfig
from .types.conversation_profile import ClearSuggestionFeatureConfigOperationMetadata
from .types.conversation_profile import ClearSuggestionFeatureConfigRequest
from .types.conversation_profile import ConversationProfile
from .types.conversation_profile import CreateConversationProfileRequest
from .types.conversation_profile import DeleteConversationProfileRequest
Expand All @@ -111,10 +113,13 @@
from .types.conversation_profile import ListConversationProfilesResponse
from .types.conversation_profile import LoggingConfig
from .types.conversation_profile import NotificationConfig
from .types.conversation_profile import SetSuggestionFeatureConfigOperationMetadata
from .types.conversation_profile import SetSuggestionFeatureConfigRequest
from .types.conversation_profile import UpdateConversationProfileRequest
from .types.document import CreateDocumentRequest
from .types.document import DeleteDocumentRequest
from .types.document import Document
from .types.document import ExportOperationMetadata
from .types.document import GetDocumentRequest
from .types.document import ImportDocumentsRequest
from .types.document import ImportDocumentsResponse
Expand Down Expand Up @@ -151,6 +156,7 @@
from .types.fulfillment import Fulfillment
from .types.fulfillment import GetFulfillmentRequest
from .types.fulfillment import UpdateFulfillmentRequest
from .types.gcs import GcsDestination
from .types.gcs import GcsSource
from .types.gcs import GcsSources
from .types.human_agent_assistant_event import HumanAgentAssistantEvent
Expand Down Expand Up @@ -281,6 +287,8 @@
"BatchUpdateEntityTypesResponse",
"BatchUpdateIntentsRequest",
"BatchUpdateIntentsResponse",
"ClearSuggestionFeatureConfigOperationMetadata",
"ClearSuggestionFeatureConfigRequest",
"CompileSuggestionRequest",
"CompileSuggestionResponse",
"CompleteConversationRequest",
Expand Down Expand Up @@ -329,9 +337,11 @@
"EventInput",
"ExportAgentRequest",
"ExportAgentResponse",
"ExportOperationMetadata",
"FaqAnswer",
"Fulfillment",
"FulfillmentsClient",
"GcsDestination",
"GcsSource",
"GcsSources",
"GetAgentRequest",
Expand Down Expand Up @@ -419,6 +429,8 @@
"SessionEntityTypesClient",
"SessionsClient",
"SetAgentRequest",
"SetSuggestionFeatureConfigOperationMetadata",
"SetSuggestionFeatureConfigRequest",
"SmartReplyAnswer",
"SpeechContext",
"SpeechModelVariant",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@
"grpc": {
"libraryClient": "ConversationProfilesClient",
"rpcs": {
"ClearSuggestionFeatureConfig": {
"methods": [
"clear_suggestion_feature_config"
]
},
"CreateConversationProfile": {
"methods": [
"create_conversation_profile"
Expand All @@ -252,6 +257,11 @@
"list_conversation_profiles"
]
},
"SetSuggestionFeatureConfig": {
"methods": [
"set_suggestion_feature_config"
]
},
"UpdateConversationProfile": {
"methods": [
"update_conversation_profile"
Expand All @@ -262,6 +272,11 @@
"grpc-async": {
"libraryClient": "ConversationProfilesAsyncClient",
"rpcs": {
"ClearSuggestionFeatureConfig": {
"methods": [
"clear_suggestion_feature_config"
]
},
"CreateConversationProfile": {
"methods": [
"create_conversation_profile"
Expand All @@ -282,6 +297,11 @@
"list_conversation_profiles"
]
},
"SetSuggestionFeatureConfig": {
"methods": [
"set_suggestion_feature_config"
]
},
"UpdateConversationProfile": {
"methods": [
"update_conversation_profile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.dialogflow_v2beta1.services.conversation_profiles import pagers
from google.cloud.dialogflow_v2beta1.types import audio_config
from google.cloud.dialogflow_v2beta1.types import conversation_profile
Expand Down Expand Up @@ -744,6 +746,263 @@ def sample_delete_conversation_profile():
request, retry=retry, timeout=timeout, metadata=metadata,
)

async def set_suggestion_feature_config(
self,
request: Union[
gcd_conversation_profile.SetSuggestionFeatureConfigRequest, dict
] = None,
*,
conversation_profile: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Adds or updates a suggestion feature in a conversation profile.
If the conversation profile contains the type of suggestion
feature for the participant role, it will update it. Otherwise
it will insert the suggestion feature.
This method is a `long-running
operation <https://cloud.google.com/dialogflow/es/docs/how/long-running-operations>`__.
The returned ``Operation`` type has the following
method-specific fields:
- ``metadata``:
[SetSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.SetSuggestionFeatureConfigOperationMetadata]
- ``response``:
[ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]
If a long running operation to add or update suggestion feature
config for the same conversation profile, participant role and
suggestion feature type exists, please cancel the existing long
running operation before sending such request, otherwise the
request will be rejected.
.. code-block:: python
from google.cloud import dialogflow_v2beta1
def sample_set_suggestion_feature_config():
# Create a client
client = dialogflow_v2beta1.ConversationProfilesClient()
# Initialize request argument(s)
request = dialogflow_v2beta1.SetSuggestionFeatureConfigRequest(
conversation_profile="conversation_profile_value",
participant_role="END_USER",
)
# Make the request
operation = client.set_suggestion_feature_config(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.dialogflow_v2beta1.types.SetSuggestionFeatureConfigRequest, dict]):
The request object. The request message for
[ConversationProfiles.SetSuggestionFeature][].
conversation_profile (:class:`str`):
Required. The Conversation Profile to add or update the
suggestion feature config. Format:
``projects/<Project ID>/locations/<Location ID>/conversationProfiles/<Conversation Profile ID>``.
This corresponds to the ``conversation_profile`` 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.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.dialogflow_v2beta1.types.ConversationProfile`
Defines the services to connect to incoming Dialogflow
conversations.
"""
# 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([conversation_profile])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = gcd_conversation_profile.SetSuggestionFeatureConfigRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if conversation_profile is not None:
request.conversation_profile = conversation_profile

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.set_suggestion_feature_config,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("conversation_profile", request.conversation_profile),)
),
)

# Send the request.
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
gcd_conversation_profile.ConversationProfile,
metadata_type=gcd_conversation_profile.SetSuggestionFeatureConfigOperationMetadata,
)

# Done; return the response.
return response

async def clear_suggestion_feature_config(
self,
request: Union[
gcd_conversation_profile.ClearSuggestionFeatureConfigRequest, dict
] = None,
*,
conversation_profile: str = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Clears a suggestion feature from a conversation profile for the
given participant role.
This method is a `long-running
operation <https://cloud.google.com/dialogflow/es/docs/how/long-running-operations>`__.
The returned ``Operation`` type has the following
method-specific fields:
- ``metadata``:
[ClearSuggestionFeatureConfigOperationMetadata][google.cloud.dialogflow.v2beta1.ClearSuggestionFeatureConfigOperationMetadata]
- ``response``:
[ConversationProfile][google.cloud.dialogflow.v2beta1.ConversationProfile]
.. code-block:: python
from google.cloud import dialogflow_v2beta1
def sample_clear_suggestion_feature_config():
# Create a client
client = dialogflow_v2beta1.ConversationProfilesClient()
# Initialize request argument(s)
request = dialogflow_v2beta1.ClearSuggestionFeatureConfigRequest(
conversation_profile="conversation_profile_value",
participant_role="END_USER",
suggestion_feature_type="SMART_REPLY",
)
# Make the request
operation = client.clear_suggestion_feature_config(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.dialogflow_v2beta1.types.ClearSuggestionFeatureConfigRequest, dict]):
The request object. The request message for
[ConversationProfiles.ClearFeature][].
conversation_profile (:class:`str`):
Required. The Conversation Profile to add or update the
suggestion feature config. Format:
``projects/<Project ID>/locations/<Location ID>/conversationProfiles/<Conversation Profile ID>``.
This corresponds to the ``conversation_profile`` 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.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.dialogflow_v2beta1.types.ConversationProfile`
Defines the services to connect to incoming Dialogflow
conversations.
"""
# 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([conversation_profile])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = gcd_conversation_profile.ClearSuggestionFeatureConfigRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if conversation_profile is not None:
request.conversation_profile = conversation_profile

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.clear_suggestion_feature_config,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("conversation_profile", request.conversation_profile),)
),
)

# Send the request.
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
gcd_conversation_profile.ConversationProfile,
metadata_type=gcd_conversation_profile.ClearSuggestionFeatureConfigOperationMetadata,
)

# Done; return the response.
return response

async def __aenter__(self):
return self

Expand Down
Loading

0 comments on commit e5effaa

Please sign in to comment.