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

Commit

Permalink
feat(v2): Added SuggestConversationSummary RPC (#607)
Browse files Browse the repository at this point in the history
* feat: Added SuggestConversationSummary RPC
docs: updated go library package

PiperOrigin-RevId: 501862436

Source-Link: googleapis/googleapis@155e0f4

Source-Link: googleapis/googleapis-gen@3051f61
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzA1MWY2MTdhOTkxYzI3NGM4OGQyNzA2NGU4MDMwOTVlNGVmOWQzOSJ9

* 🦉 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] committed Jan 14, 2023
1 parent f1ff2fb commit e5aabc8
Show file tree
Hide file tree
Showing 48 changed files with 1,199 additions and 172 deletions.
4 changes: 4 additions & 0 deletions google/cloud/dialogflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
ListConversationsResponse,
ListMessagesRequest,
ListMessagesResponse,
SuggestConversationSummaryRequest,
SuggestConversationSummaryResponse,
)
from google.cloud.dialogflow_v2.types.conversation_dataset import (
ConversationDataset,
Expand Down Expand Up @@ -446,6 +448,8 @@
"ListConversationsResponse",
"ListMessagesRequest",
"ListMessagesResponse",
"SuggestConversationSummaryRequest",
"SuggestConversationSummaryResponse",
"ConversationDataset",
"ConversationInfo",
"CreateConversationDatasetOperationMetadata",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/dialogflow_v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
ListConversationsResponse,
ListMessagesRequest,
ListMessagesResponse,
SuggestConversationSummaryRequest,
SuggestConversationSummaryResponse,
)
from .types.conversation_dataset import (
ConversationDataset,
Expand Down Expand Up @@ -534,6 +536,8 @@
"StreamingRecognitionResult",
"SuggestArticlesRequest",
"SuggestArticlesResponse",
"SuggestConversationSummaryRequest",
"SuggestConversationSummaryResponse",
"SuggestFaqAnswersRequest",
"SuggestFaqAnswersResponse",
"SuggestSmartRepliesRequest",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/dialogflow_v2/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@
"methods": [
"list_messages"
]
},
"SuggestConversationSummary": {
"methods": [
"suggest_conversation_summary"
]
}
}
},
Expand Down Expand Up @@ -528,6 +533,11 @@
"methods": [
"list_messages"
]
},
"SuggestConversationSummary": {
"methods": [
"suggest_conversation_summary"
]
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions google/cloud/dialogflow_v2/services/agents/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ async def sample_search_agents():
Returns:
google.cloud.dialogflow_v2.services.agents.pagers.SearchAgentsAsyncPager:
The response message for
[Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
[Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -867,10 +867,8 @@ async def sample_export_agent():
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_v2.types.ExportAgentResponse`
The response message for
[Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
The result type for the operation will be :class:`google.cloud.dialogflow_v2.types.ExportAgentResponse` The response message for
[Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
"""
# Create or coerce a protobuf request object.
Expand Down
8 changes: 3 additions & 5 deletions google/cloud/dialogflow_v2/services/agents/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ def sample_search_agents():
Returns:
google.cloud.dialogflow_v2.services.agents.pagers.SearchAgentsPager:
The response message for
[Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
[Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -1095,10 +1095,8 @@ def sample_export_agent():
google.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.dialogflow_v2.types.ExportAgentResponse`
The response message for
[Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
The result type for the operation will be :class:`google.cloud.dialogflow_v2.types.ExportAgentResponse` The response message for
[Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ async def sample_list_answer_records():
Returns:
google.cloud.dialogflow_v2.services.answer_records.pagers.ListAnswerRecordsAsyncPager:
Response message for
[AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords].
[AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -431,11 +431,12 @@ async def sample_update_answer_record():
the answers,
[AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name]
are returned to the customers.
2. The customer uses the
[AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name]
to call the [UpdateAnswerRecord][] method to send
feedback about a specific answer that they believe
is wrong.
[AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name]
to call the [UpdateAnswerRecord][] method to send
feedback about a specific answer that they believe is
wrong.
"""
# Create or coerce a protobuf request object.
Expand Down
11 changes: 6 additions & 5 deletions google/cloud/dialogflow_v2/services/answer_records/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def sample_list_answer_records():
Returns:
google.cloud.dialogflow_v2.services.answer_records.pagers.ListAnswerRecordsPager:
Response message for
[AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords].
[AnswerRecords.ListAnswerRecords][google.cloud.dialogflow.v2.AnswerRecords.ListAnswerRecords].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -651,11 +651,12 @@ def sample_update_answer_record():
the answers,
[AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name]
are returned to the customers.
2. The customer uses the
[AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name]
to call the [UpdateAnswerRecord][] method to send
feedback about a specific answer that they believe
is wrong.
[AnswerRecord.name][google.cloud.dialogflow.v2.AnswerRecord.name]
to call the [UpdateAnswerRecord][] method to send
feedback about a specific answer that they believe is
wrong.
"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ async def sample_list_contexts():
Returns:
google.cloud.dialogflow_v2.services.contexts.pagers.ListContextsAsyncPager:
The response message for
[Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
[Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/dialogflow_v2/services/contexts/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def sample_list_contexts():
Returns:
google.cloud.dialogflow_v2.services.contexts.pagers.ListContextsPager:
The response message for
[Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
[Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,9 @@ async def sample_import_conversation_data():
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_v2.types.ImportConversationDataOperationResponse` Response used for [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData] long
running operation.
The result type for the operation will be :class:`google.cloud.dialogflow_v2.types.ImportConversationDataOperationResponse` Response used for
[ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]
long running operation.
"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,9 @@ def sample_import_conversation_data():
google.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.dialogflow_v2.types.ImportConversationDataOperationResponse` Response used for [ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData] long
running operation.
The result type for the operation will be :class:`google.cloud.dialogflow_v2.types.ImportConversationDataOperationResponse` Response used for
[ConversationDatasets.ImportConversationData][google.cloud.dialogflow.v2.ConversationDatasets.ImportConversationData]
long running operation.
"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ async def sample_list_conversation_profiles():
Returns:
google.cloud.dialogflow_v2.services.conversation_profiles.pagers.ListConversationProfilesAsyncPager:
The response message for
[ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles].
[ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def sample_list_conversation_profiles():
Returns:
google.cloud.dialogflow_v2.services.conversation_profiles.pagers.ListConversationProfilesPager:
The response message for
[ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles].
[ConversationProfiles.ListConversationProfiles][google.cloud.dialogflow.v2.ConversationProfiles.ListConversationProfiles].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down
117 changes: 115 additions & 2 deletions google/cloud/dialogflow_v2/services/conversations/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class ConversationsAsyncClient:
DEFAULT_ENDPOINT = ConversationsClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = ConversationsClient.DEFAULT_MTLS_ENDPOINT

answer_record_path = staticmethod(ConversationsClient.answer_record_path)
parse_answer_record_path = staticmethod(
ConversationsClient.parse_answer_record_path
)
conversation_path = staticmethod(ConversationsClient.conversation_path)
parse_conversation_path = staticmethod(ConversationsClient.parse_conversation_path)
conversation_profile_path = staticmethod(
Expand Down Expand Up @@ -432,7 +436,7 @@ async def sample_list_conversations():
Returns:
google.cloud.dialogflow_v2.services.conversations.pagers.ListConversationsAsyncPager:
The response message for
[Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations].
[Conversations.ListConversations][google.cloud.dialogflow.v2.Conversations.ListConversations].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -769,7 +773,7 @@ async def sample_list_messages():
Returns:
google.cloud.dialogflow_v2.services.conversations.pagers.ListMessagesAsyncPager:
The response message for
[Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages].
[Conversations.ListMessages][google.cloud.dialogflow.v2.Conversations.ListMessages].
Iterating over this object will yield results and
resolve additional pages automatically.
Expand Down Expand Up @@ -826,6 +830,115 @@ async def sample_list_messages():
# Done; return the response.
return response

async def suggest_conversation_summary(
self,
request: Optional[
Union[gcd_conversation.SuggestConversationSummaryRequest, dict]
] = None,
*,
conversation: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcd_conversation.SuggestConversationSummaryResponse:
r"""Suggests summary for a conversation based on specific
historical messages. The range of the messages to be
used for summary can be specified in the request.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import dialogflow_v2
async def sample_suggest_conversation_summary():
# Create a client
client = dialogflow_v2.ConversationsAsyncClient()
# Initialize request argument(s)
request = dialogflow_v2.SuggestConversationSummaryRequest(
conversation="conversation_value",
)
# Make the request
response = await client.suggest_conversation_summary(request=request)
# Handle the response
print(response)
Args:
request (Optional[Union[google.cloud.dialogflow_v2.types.SuggestConversationSummaryRequest, dict]]):
The request object. The request message for
[Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary].
conversation (:class:`str`):
Required. The conversation to fetch suggestion for.
Format:
``projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>``.
This corresponds to the ``conversation`` 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.cloud.dialogflow_v2.types.SuggestConversationSummaryResponse:
The response message for
[Conversations.SuggestConversationSummary][google.cloud.dialogflow.v2.Conversations.SuggestConversationSummary].
"""
# 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])
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.SuggestConversationSummaryRequest(request)

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

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.suggest_conversation_summary,
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", request.conversation),)
),
)

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

# Done; return the response.
return response

async def list_operations(
self,
request: Optional[operations_pb2.ListOperationsRequest] = None,
Expand Down
Loading

0 comments on commit e5aabc8

Please sign in to comment.