diff --git a/google/cloud/dialogflow_v2beta1/__init__.py b/google/cloud/dialogflow_v2beta1/__init__.py index a31bffd6d..5c390d8e9 100644 --- a/google/cloud/dialogflow_v2beta1/__init__.py +++ b/google/cloud/dialogflow_v2beta1/__init__.py @@ -177,6 +177,7 @@ from .types.participant import AnalyzeContentResponse from .types.participant import AnnotatedMessagePart from .types.participant import ArticleAnswer +from .types.participant import AssistQueryParameters from .types.participant import AutomatedAgentReply from .types.participant import CompileSuggestionRequest from .types.participant import CompileSuggestionResponse @@ -265,6 +266,7 @@ "AnswerRecord", "AnswerRecordsClient", "ArticleAnswer", + "AssistQueryParameters", "AudioEncoding", "AutomatedAgentConfig", "AutomatedAgentReply", diff --git a/google/cloud/dialogflow_v2beta1/services/participants/async_client.py b/google/cloud/dialogflow_v2beta1/services/participants/async_client.py index 8f175cf5e..213eae8dc 100644 --- a/google/cloud/dialogflow_v2beta1/services/participants/async_client.py +++ b/google/cloud/dialogflow_v2beta1/services/participants/async_client.py @@ -364,7 +364,7 @@ async def list_participants( Returns: google.cloud.dialogflow_v2beta1.services.participants.pagers.ListParticipantsAsyncPager: The response message for - [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. + [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. Iterating over this object will yield results and resolve additional pages automatically. @@ -545,7 +545,7 @@ async def analyze_content( Returns: google.cloud.dialogflow_v2beta1.types.AnalyzeContentResponse: The response message for - [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. + [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. """ # Create or coerce a protobuf request object. @@ -640,7 +640,7 @@ async def suggest_articles( Returns: google.cloud.dialogflow_v2beta1.types.SuggestArticlesResponse: The response message for - [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. + [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. """ # Create or coerce a protobuf request object. @@ -713,7 +713,7 @@ async def suggest_faq_answers( Returns: google.cloud.dialogflow_v2beta1.types.SuggestFaqAnswersResponse: The request message for - [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. + [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. """ # Create or coerce a protobuf request object. @@ -786,7 +786,7 @@ async def suggest_smart_replies( Returns: google.cloud.dialogflow_v2beta1.types.SuggestSmartRepliesResponse: The response message for - [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. + [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. """ # Create or coerce a protobuf request object. @@ -868,7 +868,7 @@ async def list_suggestions( Returns: google.cloud.dialogflow_v2beta1.services.participants.pagers.ListSuggestionsAsyncPager: The response message for - [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. + [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. Iterating over this object will yield results and resolve additional pages automatically. @@ -944,7 +944,7 @@ async def compile_suggestion( Returns: google.cloud.dialogflow_v2beta1.types.CompileSuggestionResponse: The response message for - [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. + [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. """ warnings.warn( diff --git a/google/cloud/dialogflow_v2beta1/services/participants/client.py b/google/cloud/dialogflow_v2beta1/services/participants/client.py index ba6083695..e24c2f407 100644 --- a/google/cloud/dialogflow_v2beta1/services/participants/client.py +++ b/google/cloud/dialogflow_v2beta1/services/participants/client.py @@ -623,7 +623,7 @@ def list_participants( Returns: google.cloud.dialogflow_v2beta1.services.participants.pagers.ListParticipantsPager: The response message for - [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. + [Participants.ListParticipants][google.cloud.dialogflow.v2beta1.Participants.ListParticipants]. Iterating over this object will yield results and resolve additional pages automatically. @@ -804,7 +804,7 @@ def analyze_content( Returns: google.cloud.dialogflow_v2beta1.types.AnalyzeContentResponse: The response message for - [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. + [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. """ # Create or coerce a protobuf request object. @@ -890,7 +890,7 @@ def suggest_articles( Returns: google.cloud.dialogflow_v2beta1.types.SuggestArticlesResponse: The response message for - [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. + [Participants.SuggestArticles][google.cloud.dialogflow.v2beta1.Participants.SuggestArticles]. """ # Create or coerce a protobuf request object. @@ -963,7 +963,7 @@ def suggest_faq_answers( Returns: google.cloud.dialogflow_v2beta1.types.SuggestFaqAnswersResponse: The request message for - [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. + [Participants.SuggestFaqAnswers][google.cloud.dialogflow.v2beta1.Participants.SuggestFaqAnswers]. """ # Create or coerce a protobuf request object. @@ -1036,7 +1036,7 @@ def suggest_smart_replies( Returns: google.cloud.dialogflow_v2beta1.types.SuggestSmartRepliesResponse: The response message for - [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. + [Participants.SuggestSmartReplies][google.cloud.dialogflow.v2beta1.Participants.SuggestSmartReplies]. """ # Create or coerce a protobuf request object. @@ -1118,7 +1118,7 @@ def list_suggestions( Returns: google.cloud.dialogflow_v2beta1.services.participants.pagers.ListSuggestionsPager: The response message for - [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. + [Participants.ListSuggestions][google.cloud.dialogflow.v2beta1.Participants.ListSuggestions]. Iterating over this object will yield results and resolve additional pages automatically. @@ -1195,7 +1195,7 @@ def compile_suggestion( Returns: google.cloud.dialogflow_v2beta1.types.CompileSuggestionResponse: The response message for - [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. + [Participants.CompileSuggestion][google.cloud.dialogflow.v2beta1.Participants.CompileSuggestion]. """ warnings.warn( diff --git a/google/cloud/dialogflow_v2beta1/types/__init__.py b/google/cloud/dialogflow_v2beta1/types/__init__.py index efe17b293..c09d039ae 100644 --- a/google/cloud/dialogflow_v2beta1/types/__init__.py +++ b/google/cloud/dialogflow_v2beta1/types/__init__.py @@ -172,6 +172,7 @@ AnalyzeContentResponse, AnnotatedMessagePart, ArticleAnswer, + AssistQueryParameters, AutomatedAgentReply, CompileSuggestionRequest, CompileSuggestionResponse, @@ -377,6 +378,7 @@ "AnalyzeContentResponse", "AnnotatedMessagePart", "ArticleAnswer", + "AssistQueryParameters", "AutomatedAgentReply", "CompileSuggestionRequest", "CompileSuggestionResponse", diff --git a/google/cloud/dialogflow_v2beta1/types/participant.py b/google/cloud/dialogflow_v2beta1/types/participant.py index b2185dfb9..b6cdefe6b 100644 --- a/google/cloud/dialogflow_v2beta1/types/participant.py +++ b/google/cloud/dialogflow_v2beta1/types/participant.py @@ -36,6 +36,7 @@ "OutputAudio", "AutomatedAgentReply", "SuggestionFeature", + "AssistQueryParameters", "AnalyzeContentRequest", "DtmfParameters", "AnalyzeContentResponse", @@ -109,6 +110,27 @@ class Participant(proto.Message): - Dialogflow only accepts a UTF-8 encoded string, e.g., a hex digest of a hash function like SHA-512. - The length of the user id must be <= 256 characters. + documents_metadata_filters (Sequence[google.cloud.dialogflow_v2beta1.types.Participant.DocumentsMetadataFiltersEntry]): + Optional. Key-value filters on the metadata of documents + returned by article suggestion. If specified, article + suggestion only returns suggested documents that match all + filters in their + [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. + Multiple values for a metadata key should be concatenated by + comma. For example, filters to match all documents that have + 'US' or 'CA' in their market metadata values and 'agent' in + their user metadata values will be + + :: + + documents_metadata_filters { + key: "market" + value: "US,CA" + } + documents_metadata_filters { + key: "user" + value: "agent" + } """ class Role(proto.Enum): @@ -123,6 +145,7 @@ class Role(proto.Enum): name = proto.Field(proto.STRING, number=1,) role = proto.Field(proto.ENUM, number=2, enum=Role,) obfuscated_external_user_id = proto.Field(proto.STRING, number=7,) + documents_metadata_filters = proto.MapField(proto.STRING, proto.STRING, number=8,) class Message(proto.Message): @@ -385,6 +408,35 @@ class Type(proto.Enum): type_ = proto.Field(proto.ENUM, number=1, enum=Type,) +class AssistQueryParameters(proto.Message): + r"""Represents the parameters of human assist query. + + Attributes: + documents_metadata_filters (Sequence[google.cloud.dialogflow_v2beta1.types.AssistQueryParameters.DocumentsMetadataFiltersEntry]): + Key-value filters on the metadata of documents returned by + article suggestion. If specified, article suggestion only + returns suggested documents that match all filters in their + [Document.metadata][google.cloud.dialogflow.v2beta1.Document.metadata]. + Multiple values for a metadata key should be concatenated by + comma. For example, filters to match all documents that have + 'US' or 'CA' in their market metadata values and 'agent' in + their user metadata values will be + + :: + + documents_metadata_filters { + key: "market" + value: "US,CA" + } + documents_metadata_filters { + key: "user" + value: "agent" + } + """ + + documents_metadata_filters = proto.MapField(proto.STRING, proto.STRING, number=1,) + + class AnalyzeContentRequest(proto.Message): r"""The request message for [Participants.AnalyzeContent][google.cloud.dialogflow.v2beta1.Participants.AnalyzeContent]. @@ -419,6 +471,8 @@ class AnalyzeContentRequest(proto.Message): query_params (google.cloud.dialogflow_v2beta1.types.QueryParameters): Parameters for a Dialogflow virtual-agent query. + assist_query_params (google.cloud.dialogflow_v2beta1.types.AssistQueryParameters): + Parameters for a human assist query. message_send_time (google.protobuf.timestamp_pb2.Timestamp): Optional. The send time of the message from end user or human agent's perspective. It is @@ -456,6 +510,9 @@ class AnalyzeContentRequest(proto.Message): query_params = proto.Field( proto.MESSAGE, number=9, message=session.QueryParameters, ) + assist_query_params = proto.Field( + proto.MESSAGE, number=14, message="AssistQueryParameters", + ) message_send_time = proto.Field( proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, ) @@ -756,11 +813,17 @@ class SuggestArticlesRequest(proto.Message): [latest_message][google.cloud.dialogflow.v2beta1.SuggestArticlesRequest.latest_message] to use as context when compiling the suggestion. By default 20 and at most 50. + assist_query_params (google.cloud.dialogflow_v2beta1.types.AssistQueryParameters): + Optional. Parameters for a human assist + query. """ parent = proto.Field(proto.STRING, number=1,) latest_message = proto.Field(proto.STRING, number=2,) context_size = proto.Field(proto.INT32, number=3,) + assist_query_params = proto.Field( + proto.MESSAGE, number=4, message="AssistQueryParameters", + ) class SuggestArticlesResponse(proto.Message): @@ -813,11 +876,17 @@ class SuggestFaqAnswersRequest(proto.Message): Optional. Max number of messages prior to and including [latest_message] to use as context when compiling the suggestion. By default 20 and at most 50. + assist_query_params (google.cloud.dialogflow_v2beta1.types.AssistQueryParameters): + Optional. Parameters for a human assist + query. """ parent = proto.Field(proto.STRING, number=1,) latest_message = proto.Field(proto.STRING, number=2,) context_size = proto.Field(proto.INT32, number=3,) + assist_query_params = proto.Field( + proto.MESSAGE, number=4, message="AssistQueryParameters", + ) class SuggestFaqAnswersResponse(proto.Message): diff --git a/scripts/fixup_dialogflow_v2beta1_keywords.py b/scripts/fixup_dialogflow_v2beta1_keywords.py index dc332e8f5..a921e3c51 100644 --- a/scripts/fixup_dialogflow_v2beta1_keywords.py +++ b/scripts/fixup_dialogflow_v2beta1_keywords.py @@ -39,7 +39,7 @@ def partition( class dialogflowCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { - 'analyze_content': ('participant', 'text_input', 'event_input', 'reply_audio_config', 'query_params', 'message_send_time', 'request_id', ), + 'analyze_content': ('participant', 'text_input', 'event_input', 'reply_audio_config', 'query_params', 'assist_query_params', 'message_send_time', 'request_id', ), 'batch_create_entities': ('parent', 'entities', 'language_code', ), 'batch_create_messages': ('parent', 'requests', ), 'batch_delete_entities': ('parent', 'entity_values', 'language_code', ), @@ -111,8 +111,8 @@ class dialogflowCallTransformer(cst.CSTTransformer): 'search_agents': ('parent', 'page_size', 'page_token', ), 'set_agent': ('agent', 'update_mask', ), 'streaming_detect_intent': ('session', 'query_input', 'query_params', 'single_utterance', 'output_audio_config', 'output_audio_config_mask', 'input_audio', ), - 'suggest_articles': ('parent', 'latest_message', 'context_size', ), - 'suggest_faq_answers': ('parent', 'latest_message', 'context_size', ), + 'suggest_articles': ('parent', 'latest_message', 'context_size', 'assist_query_params', ), + 'suggest_faq_answers': ('parent', 'latest_message', 'context_size', 'assist_query_params', ), 'suggest_smart_replies': ('parent', 'current_text_input', 'latest_message', 'context_size', ), 'train_agent': ('parent', ), 'update_answer_record': ('answer_record', 'update_mask', ),