diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 32b3c486..02a4dedc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:9bc5fa3b62b091f60614c08a7fb4fd1d3e1678e326f34dd66ce1eefb5dc3267b -# created: 2023-05-25T14:56:16.294623272Z + digest: sha256:240b5bcc2bafd450912d2da2be15e62bc6de2cf839823ae4bf94d4f392b451dc +# created: 2023-06-03T21:25:37.968717478Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 3b8d7ee8..c7929db6 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,28 +113,26 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==39.0.1 \ - --hash=sha256:0f8da300b5c8af9f98111ffd512910bc792b4c77392a9523624680f7956a99d4 \ - --hash=sha256:35f7c7d015d474f4011e859e93e789c87d21f6f4880ebdc29896a60403328f1f \ - --hash=sha256:5aa67414fcdfa22cf052e640cb5ddc461924a045cacf325cd164e65312d99502 \ - --hash=sha256:5d2d8b87a490bfcd407ed9d49093793d0f75198a35e6eb1a923ce1ee86c62b41 \ - --hash=sha256:6687ef6d0a6497e2b58e7c5b852b53f62142cfa7cd1555795758934da363a965 \ - --hash=sha256:6f8ba7f0328b79f08bdacc3e4e66fb4d7aab0c3584e0bd41328dce5262e26b2e \ - --hash=sha256:706843b48f9a3f9b9911979761c91541e3d90db1ca905fd63fee540a217698bc \ - --hash=sha256:807ce09d4434881ca3a7594733669bd834f5b2c6d5c7e36f8c00f691887042ad \ - --hash=sha256:83e17b26de248c33f3acffb922748151d71827d6021d98c70e6c1a25ddd78505 \ - --hash=sha256:96f1157a7c08b5b189b16b47bc9db2332269d6680a196341bf30046330d15388 \ - --hash=sha256:aec5a6c9864be7df2240c382740fcf3b96928c46604eaa7f3091f58b878c0bb6 \ - --hash=sha256:b0afd054cd42f3d213bf82c629efb1ee5f22eba35bf0eec88ea9ea7304f511a2 \ - --hash=sha256:ced4e447ae29ca194449a3f1ce132ded8fcab06971ef5f618605aacaa612beac \ - --hash=sha256:d1f6198ee6d9148405e49887803907fe8962a23e6c6f83ea7d98f1c0de375695 \ - --hash=sha256:e124352fd3db36a9d4a21c1aa27fd5d051e621845cb87fb851c08f4f75ce8be6 \ - --hash=sha256:e422abdec8b5fa8462aa016786680720d78bdce7a30c652b7fadf83a4ba35336 \ - --hash=sha256:ef8b72fa70b348724ff1218267e7f7375b8de4e8194d1636ee60510aae104cd0 \ - --hash=sha256:f0c64d1bd842ca2633e74a1a28033d139368ad959872533b1bab8c80e8240a0c \ - --hash=sha256:f24077a3b5298a5a06a8e0536e3ea9ec60e4c7ac486755e5fb6e6ea9b3500106 \ - --hash=sha256:fdd188c8a6ef8769f148f88f859884507b954cc64db6b52f66ef199bb9ad660a \ - --hash=sha256:fe913f20024eb2cb2f323e42a64bdf2911bb9738a15dba7d3cce48151034e3a8 +cryptography==41.0.0 \ + --hash=sha256:0ddaee209d1cf1f180f1efa338a68c4621154de0afaef92b89486f5f96047c55 \ + --hash=sha256:14754bcdae909d66ff24b7b5f166d69340ccc6cb15731670435efd5719294895 \ + --hash=sha256:344c6de9f8bda3c425b3a41b319522ba3208551b70c2ae00099c205f0d9fd3be \ + --hash=sha256:34d405ea69a8b34566ba3dfb0521379b210ea5d560fafedf9f800a9a94a41928 \ + --hash=sha256:3680248309d340fda9611498a5319b0193a8dbdb73586a1acf8109d06f25b92d \ + --hash=sha256:3c5ef25d060c80d6d9f7f9892e1d41bb1c79b78ce74805b8cb4aa373cb7d5ec8 \ + --hash=sha256:4ab14d567f7bbe7f1cdff1c53d5324ed4d3fc8bd17c481b395db224fb405c237 \ + --hash=sha256:5c1f7293c31ebc72163a9a0df246f890d65f66b4a40d9ec80081969ba8c78cc9 \ + --hash=sha256:6b71f64beeea341c9b4f963b48ee3b62d62d57ba93eb120e1196b31dc1025e78 \ + --hash=sha256:7d92f0248d38faa411d17f4107fc0bce0c42cae0b0ba5415505df72d751bf62d \ + --hash=sha256:8362565b3835ceacf4dc8f3b56471a2289cf51ac80946f9087e66dc283a810e0 \ + --hash=sha256:84a165379cb9d411d58ed739e4af3396e544eac190805a54ba2e0322feb55c46 \ + --hash=sha256:88ff107f211ea696455ea8d911389f6d2b276aabf3231bf72c8853d22db755c5 \ + --hash=sha256:9f65e842cb02550fac96536edb1d17f24c0a338fd84eaf582be25926e993dde4 \ + --hash=sha256:a4fc68d1c5b951cfb72dfd54702afdbbf0fb7acdc9b7dc4301bbf2225a27714d \ + --hash=sha256:b7f2f5c525a642cecad24ee8670443ba27ac1fab81bba4cc24c7b6b41f2d0c75 \ + --hash=sha256:b846d59a8d5a9ba87e2c3d757ca019fa576793e8758174d3868aecb88d6fc8eb \ + --hash=sha256:bf8fc66012ca857d62f6a347007e166ed59c0bc150cefa49f28376ebe7d992a2 \ + --hash=sha256:f5d0bf9b252f30a31664b6f64432b4730bb7038339bd18b1fafe129cfc2be9be # via # gcp-releasetool # secretstorage diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8428ab92..20929136 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.22.0" + ".": "2.23.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1740a0db..aef786b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ [1]: https://pypi.org/project/dialogflow/#history +## [2.23.0](https://github.com/googleapis/python-dialogflow/compare/v2.22.0...v2.23.0) (2023-06-21) + + +### Features + +* Added dialogflow_assist_answer ([73ddd4e](https://github.com/googleapis/python-dialogflow/commit/73ddd4eb51fc8b5acf21f7a75afbc979b8870b02)) +* Added human_agent_side_config ([73ddd4e](https://github.com/googleapis/python-dialogflow/commit/73ddd4eb51fc8b5acf21f7a75afbc979b8870b02)) +* Added session_ttl ([73ddd4e](https://github.com/googleapis/python-dialogflow/commit/73ddd4eb51fc8b5acf21f7a75afbc979b8870b02)) +* Added suggest_dialogflow_assists_response ([73ddd4e](https://github.com/googleapis/python-dialogflow/commit/73ddd4eb51fc8b5acf21f7a75afbc979b8870b02)) +* Added suggest_entity_extraction_response ([73ddd4e](https://github.com/googleapis/python-dialogflow/commit/73ddd4eb51fc8b5acf21f7a75afbc979b8870b02)) +* Added suggestion_input ([73ddd4e](https://github.com/googleapis/python-dialogflow/commit/73ddd4eb51fc8b5acf21f7a75afbc979b8870b02)) + ## [2.22.0](https://github.com/googleapis/python-dialogflow/compare/v2.21.0...v2.22.0) (2023-05-25) diff --git a/google/cloud/dialogflow/gapic_version.py b/google/cloud/dialogflow/gapic_version.py index 03d6d020..f01e1d3a 100644 --- a/google/cloud/dialogflow/gapic_version.py +++ b/google/cloud/dialogflow/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.22.0" # {x-release-please-version} +__version__ = "2.23.0" # {x-release-please-version} diff --git a/google/cloud/dialogflow_v2/gapic_version.py b/google/cloud/dialogflow_v2/gapic_version.py index 03d6d020..f01e1d3a 100644 --- a/google/cloud/dialogflow_v2/gapic_version.py +++ b/google/cloud/dialogflow_v2/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.22.0" # {x-release-please-version} +__version__ = "2.23.0" # {x-release-please-version} diff --git a/google/cloud/dialogflow_v2/types/answer_record.py b/google/cloud/dialogflow_v2/types/answer_record.py index 62fc4a63..34b034b9 100644 --- a/google/cloud/dialogflow_v2/types/answer_record.py +++ b/google/cloud/dialogflow_v2/types/answer_record.py @@ -222,9 +222,9 @@ class AnswerFeedback(proto.Message): clicked (bool): Indicates whether the answer/item was clicked by the human agent or not. Default to false. - For knowledge search, the answer record is - considered to be clicked if the answer was - copied or any URI was clicked. + For knowledge search and knowledge assist, the + answer record is considered to be clicked if the + answer was copied or any URI was clicked. click_time (google.protobuf.timestamp_pb2.Timestamp): Time when the answer/item was clicked. displayed (bool): diff --git a/google/cloud/dialogflow_v2/types/conversation.py b/google/cloud/dialogflow_v2/types/conversation.py index 25ce02c7..165c9b2c 100644 --- a/google/cloud/dialogflow_v2/types/conversation.py +++ b/google/cloud/dialogflow_v2/types/conversation.py @@ -438,7 +438,8 @@ class SuggestConversationSummaryRequest(proto.Message): [latest_message] to use as context when compiling the suggestion. By default 500 and at most 1000. assist_query_params (google.cloud.dialogflow_v2.types.AssistQueryParameters): - Parameters for a human assist query. + Parameters for a human assist query. Only + used for POC/demo purpose. """ conversation: str = proto.Field( diff --git a/google/cloud/dialogflow_v2/types/conversation_profile.py b/google/cloud/dialogflow_v2/types/conversation_profile.py index 6c98c0e8..893f70a1 100644 --- a/google/cloud/dialogflow_v2/types/conversation_profile.py +++ b/google/cloud/dialogflow_v2/types/conversation_profile.py @@ -17,6 +17,7 @@ from typing import MutableMapping, MutableSequence +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -351,12 +352,24 @@ class AutomatedAgentConfig(proto.Message): ``projects//locations//agents//environments/``. If environment is not specified, the default ``draft`` environment is used. + session_ttl (google.protobuf.duration_pb2.Duration): + Optional. Sets Dialogflow CX session life + time. By default, a Dialogflow CX session + remains active and its data is stored for 30 + minutes after the last request is sent for the + session. This value should be no longer than 1 + day. """ agent: str = proto.Field( proto.STRING, number=1, ) + session_ttl: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=3, + message=duration_pb2.Duration, + ) class HumanAgentAssistantConfig(proto.Message): @@ -539,7 +552,8 @@ class SuggestionQueryConfig(proto.Message): that all suggestions are returned. Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, - SMART_COMPOSE. + SMART_COMPOSE, KNOWLEDGE_SEARCH, KNOWLEDGE_ASSIST, + ENTITY_EXTRACTION. context_filter_settings (google.cloud.dialogflow_v2.types.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings): Determines how recent conversation context is filtered when generating suggestions. If @@ -589,7 +603,7 @@ class DialogflowQuerySource(proto.Message): agent (str): Required. The name of a Dialogflow virtual agent used for end user side intent detection and suggestion. Format: - ``projects//locations//agent``. + ``projects//locations//agent``. When multiple agents are allowed in the same Dialogflow project. """ diff --git a/google/cloud/dialogflow_v2/types/document.py b/google/cloud/dialogflow_v2/types/document.py index d727905a..3bae64ee 100644 --- a/google/cloud/dialogflow_v2/types/document.py +++ b/google/cloud/dialogflow_v2/types/document.py @@ -109,7 +109,7 @@ class Document(proto.Message): If a reload fails with internal errors, the system will try to reload the document on the next day. If a reload fails - with non-retriable errors (e.g. PERMISION_DENIED), the + with non-retriable errors (e.g. PERMISSION_DENIED), the system will not try to reload the document anymore. You need to manually reload the document successfully by calling ``ReloadDocument`` and clear the errors. @@ -399,8 +399,8 @@ class ImportDocumentsRequest(proto.Message): Format: ``projects//locations//knowledgeBases/``. gcs_source (google.cloud.dialogflow_v2.types.GcsSources): - The Google Cloud Storage location for the documents. The - path can include a wildcard. + Optional. The Google Cloud Storage location for the + documents. The path can include a wildcard. These URIs may have the forms ``gs:///``. diff --git a/google/cloud/dialogflow_v2beta1/__init__.py b/google/cloud/dialogflow_v2beta1/__init__.py index 42086d76..64013a59 100644 --- a/google/cloud/dialogflow_v2beta1/__init__.py +++ b/google/cloud/dialogflow_v2beta1/__init__.py @@ -211,10 +211,13 @@ CompileSuggestionRequest, CompileSuggestionResponse, CreateParticipantRequest, + DialogflowAssistAnswer, DtmfParameters, FaqAnswer, GetParticipantRequest, InputTextConfig, + IntentInput, + IntentSuggestion, ListParticipantsRequest, ListParticipantsResponse, ListSuggestionsRequest, @@ -229,10 +232,12 @@ StreamingAnalyzeContentResponse, SuggestArticlesRequest, SuggestArticlesResponse, + SuggestDialogflowAssistsResponse, SuggestFaqAnswersRequest, SuggestFaqAnswersResponse, Suggestion, SuggestionFeature, + SuggestionInput, SuggestionResult, SuggestSmartRepliesRequest, SuggestSmartRepliesResponse, @@ -359,6 +364,7 @@ "DeleteVersionRequest", "DetectIntentRequest", "DetectIntentResponse", + "DialogflowAssistAnswer", "Document", "DocumentsClient", "DtmfParameters", @@ -407,6 +413,8 @@ "InputTextConfig", "Intent", "IntentBatch", + "IntentInput", + "IntentSuggestion", "IntentView", "IntentsClient", "KnowledgeAnswers", @@ -484,12 +492,14 @@ "SuggestArticlesResponse", "SuggestConversationSummaryRequest", "SuggestConversationSummaryResponse", + "SuggestDialogflowAssistsResponse", "SuggestFaqAnswersRequest", "SuggestFaqAnswersResponse", "SuggestSmartRepliesRequest", "SuggestSmartRepliesResponse", "Suggestion", "SuggestionFeature", + "SuggestionInput", "SuggestionResult", "SynthesizeSpeechConfig", "TelephonyDtmf", diff --git a/google/cloud/dialogflow_v2beta1/gapic_version.py b/google/cloud/dialogflow_v2beta1/gapic_version.py index 03d6d020..f01e1d3a 100644 --- a/google/cloud/dialogflow_v2beta1/gapic_version.py +++ b/google/cloud/dialogflow_v2beta1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.22.0" # {x-release-please-version} +__version__ = "2.23.0" # {x-release-please-version} diff --git a/google/cloud/dialogflow_v2beta1/services/answer_records/async_client.py b/google/cloud/dialogflow_v2beta1/services/answer_records/async_client.py index 3f8bebb6..219f8fc6 100644 --- a/google/cloud/dialogflow_v2beta1/services/answer_records/async_client.py +++ b/google/cloud/dialogflow_v2beta1/services/answer_records/async_client.py @@ -70,6 +70,12 @@ class AnswerRecordsAsyncClient: parse_answer_record_path = staticmethod( AnswerRecordsClient.parse_answer_record_path ) + context_path = staticmethod(AnswerRecordsClient.context_path) + parse_context_path = staticmethod(AnswerRecordsClient.parse_context_path) + document_path = staticmethod(AnswerRecordsClient.document_path) + parse_document_path = staticmethod(AnswerRecordsClient.parse_document_path) + intent_path = staticmethod(AnswerRecordsClient.intent_path) + parse_intent_path = staticmethod(AnswerRecordsClient.parse_intent_path) common_billing_account_path = staticmethod( AnswerRecordsClient.common_billing_account_path ) diff --git a/google/cloud/dialogflow_v2beta1/services/answer_records/client.py b/google/cloud/dialogflow_v2beta1/services/answer_records/client.py index 504d037f..cdd3c56e 100644 --- a/google/cloud/dialogflow_v2beta1/services/answer_records/client.py +++ b/google/cloud/dialogflow_v2beta1/services/answer_records/client.py @@ -202,6 +202,67 @@ def parse_answer_record_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def context_path( + project: str, + session: str, + context: str, + ) -> str: + """Returns a fully-qualified context string.""" + return "projects/{project}/agent/sessions/{session}/contexts/{context}".format( + project=project, + session=session, + context=context, + ) + + @staticmethod + def parse_context_path(path: str) -> Dict[str, str]: + """Parses a context path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/agent/sessions/(?P.+?)/contexts/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def document_path( + project: str, + knowledge_base: str, + document: str, + ) -> str: + """Returns a fully-qualified document string.""" + return "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format( + project=project, + knowledge_base=knowledge_base, + document=document, + ) + + @staticmethod + def parse_document_path(path: str) -> Dict[str, str]: + """Parses a document path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/knowledgeBases/(?P.+?)/documents/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def intent_path( + project: str, + intent: str, + ) -> str: + """Returns a fully-qualified intent string.""" + return "projects/{project}/agent/intents/{intent}".format( + project=project, + intent=intent, + ) + + @staticmethod + def parse_intent_path(path: str) -> Dict[str, str]: + """Parses a intent path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/agent/intents/(?P.+?)$", path) + return m.groupdict() if m else {} + @staticmethod def common_billing_account_path( billing_account: str, diff --git a/google/cloud/dialogflow_v2beta1/services/environments/async_client.py b/google/cloud/dialogflow_v2beta1/services/environments/async_client.py index da92e730..71e5ee75 100644 --- a/google/cloud/dialogflow_v2beta1/services/environments/async_client.py +++ b/google/cloud/dialogflow_v2beta1/services/environments/async_client.py @@ -267,8 +267,8 @@ async def sample_list_environments(): Required. The agent to list all environments from. Format: - - ``projects//agent`` - - ``projects//locations//agent`` + - ``projects//agent`` + - ``projects//locations//agent`` This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/google/cloud/dialogflow_v2beta1/services/environments/client.py b/google/cloud/dialogflow_v2beta1/services/environments/client.py index 295b4dd0..41a0e3f1 100644 --- a/google/cloud/dialogflow_v2beta1/services/environments/client.py +++ b/google/cloud/dialogflow_v2beta1/services/environments/client.py @@ -525,8 +525,8 @@ def sample_list_environments(): Required. The agent to list all environments from. Format: - - ``projects//agent`` - - ``projects//locations//agent`` + - ``projects//agent`` + - ``projects//locations//agent`` This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/google/cloud/dialogflow_v2beta1/types/__init__.py b/google/cloud/dialogflow_v2beta1/types/__init__.py index 5a3de47c..8ab7996e 100644 --- a/google/cloud/dialogflow_v2beta1/types/__init__.py +++ b/google/cloud/dialogflow_v2beta1/types/__init__.py @@ -181,10 +181,13 @@ CompileSuggestionRequest, CompileSuggestionResponse, CreateParticipantRequest, + DialogflowAssistAnswer, DtmfParameters, FaqAnswer, GetParticipantRequest, InputTextConfig, + IntentInput, + IntentSuggestion, ListParticipantsRequest, ListParticipantsResponse, ListSuggestionsRequest, @@ -199,10 +202,12 @@ StreamingAnalyzeContentResponse, SuggestArticlesRequest, SuggestArticlesResponse, + SuggestDialogflowAssistsResponse, SuggestFaqAnswersRequest, SuggestFaqAnswersResponse, Suggestion, SuggestionFeature, + SuggestionInput, SuggestionResult, SuggestSmartRepliesRequest, SuggestSmartRepliesResponse, @@ -396,10 +401,13 @@ "CompileSuggestionRequest", "CompileSuggestionResponse", "CreateParticipantRequest", + "DialogflowAssistAnswer", "DtmfParameters", "FaqAnswer", "GetParticipantRequest", "InputTextConfig", + "IntentInput", + "IntentSuggestion", "ListParticipantsRequest", "ListParticipantsResponse", "ListSuggestionsRequest", @@ -414,10 +422,12 @@ "StreamingAnalyzeContentResponse", "SuggestArticlesRequest", "SuggestArticlesResponse", + "SuggestDialogflowAssistsResponse", "SuggestFaqAnswersRequest", "SuggestFaqAnswersResponse", "Suggestion", "SuggestionFeature", + "SuggestionInput", "SuggestionResult", "SuggestSmartRepliesRequest", "SuggestSmartRepliesResponse", diff --git a/google/cloud/dialogflow_v2beta1/types/answer_record.py b/google/cloud/dialogflow_v2beta1/types/answer_record.py index da3e8701..9de1c7bf 100644 --- a/google/cloud/dialogflow_v2beta1/types/answer_record.py +++ b/google/cloud/dialogflow_v2beta1/types/answer_record.py @@ -124,6 +124,10 @@ class AgentAssistantRecord(proto.Message): faq_answer (google.cloud.dialogflow_v2beta1.types.FaqAnswer): Output only. The FAQ answer. + This field is a member of `oneof`_ ``answer``. + dialogflow_assist_answer (google.cloud.dialogflow_v2beta1.types.DialogflowAssistAnswer): + Output only. The Dialogflow assist answer. + This field is a member of `oneof`_ ``answer``. """ @@ -139,6 +143,12 @@ class AgentAssistantRecord(proto.Message): oneof="answer", message=participant.FaqAnswer, ) + dialogflow_assist_answer: participant.DialogflowAssistAnswer = proto.Field( + proto.MESSAGE, + number=7, + oneof="answer", + message=participant.DialogflowAssistAnswer, + ) class AnswerFeedback(proto.Message): diff --git a/google/cloud/dialogflow_v2beta1/types/conversation.py b/google/cloud/dialogflow_v2beta1/types/conversation.py index 84b62be1..2ae63e31 100644 --- a/google/cloud/dialogflow_v2beta1/types/conversation.py +++ b/google/cloud/dialogflow_v2beta1/types/conversation.py @@ -380,7 +380,7 @@ class BatchCreateMessagesRequest(proto.Message): message. Format: ``projects//locations//conversations/``. requests (MutableSequence[google.cloud.dialogflow_v2beta1.types.CreateMessageRequest]): - Required. A maximum of 1000 Messages can be created in a + Required. A maximum of 300 messages can be created in a batch. [CreateMessageRequest.message.send_time][] is required. All created messages will have identical [Message.create_time][google.cloud.dialogflow.v2beta1.Message.create_time]. @@ -510,7 +510,8 @@ class SuggestConversationSummaryRequest(proto.Message): [latest_message] to use as context when compiling the suggestion. By default 500 and at most 1000. assist_query_params (google.cloud.dialogflow_v2beta1.types.AssistQueryParameters): - Parameters for a human assist query. + Parameters for a human assist query. Only + used for POC/demo purpose. """ conversation: str = proto.Field( diff --git a/google/cloud/dialogflow_v2beta1/types/conversation_profile.py b/google/cloud/dialogflow_v2beta1/types/conversation_profile.py index b950ee11..8e3ad6e9 100644 --- a/google/cloud/dialogflow_v2beta1/types/conversation_profile.py +++ b/google/cloud/dialogflow_v2beta1/types/conversation_profile.py @@ -17,6 +17,7 @@ from typing import MutableMapping, MutableSequence +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -205,12 +206,24 @@ class AutomatedAgentConfig(proto.Message): ``projects//locations//agents//environments/``. If environment is not specified, the default ``draft`` environment is used. + session_ttl (google.protobuf.duration_pb2.Duration): + Optional. Sets Dialogflow CX session life + time. By default, a Dialogflow CX session + remains active and its data is stored for 30 + minutes after the last request is sent for the + session. This value should be no longer than 1 + day. """ agent: str = proto.Field( proto.STRING, number=1, ) + session_ttl: duration_pb2.Duration = proto.Field( + proto.MESSAGE, + number=3, + message=duration_pb2.Duration, + ) class HumanAgentAssistantConfig(proto.Message): @@ -394,7 +407,8 @@ class SuggestionQueryConfig(proto.Message): that all suggestions are returned. Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, - SMART_COMPOSE. + SMART_COMPOSE, KNOWLEDGE_SEARCH, KNOWLEDGE_ASSIST, + ENTITY_EXTRACTION. context_filter_settings (google.cloud.dialogflow_v2beta1.types.HumanAgentAssistantConfig.SuggestionQueryConfig.ContextFilterSettings): Determines how recent conversation context is filtered when generating suggestions. If @@ -444,15 +458,40 @@ class DialogflowQuerySource(proto.Message): agent (str): Required. The name of a dialogflow virtual agent used for end user side intent detection and suggestion. Format: - ``projects//locations//agent``. + ``projects//locations//agent``. When multiple agents are allowed in the same Dialogflow project. + human_agent_side_config (google.cloud.dialogflow_v2beta1.types.HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.HumanAgentSideConfig): + The Dialogflow assist configuration for human + agent. """ + class HumanAgentSideConfig(proto.Message): + r"""The configuration used for human agent side Dialogflow assist + suggestion. + + Attributes: + agent (str): + Optional. The name of a dialogflow virtual agent used for + intent detection and suggestion triggered by human agent. + Format: + ``projects//locations//agent``. + """ + + agent: str = proto.Field( + proto.STRING, + number=1, + ) + agent: str = proto.Field( proto.STRING, number=1, ) + human_agent_side_config: "HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.HumanAgentSideConfig" = proto.Field( + proto.MESSAGE, + number=3, + message="HumanAgentAssistantConfig.SuggestionQueryConfig.DialogflowQuerySource.HumanAgentSideConfig", + ) class ContextFilterSettings(proto.Message): r"""Settings that determine how to filter recent conversation diff --git a/google/cloud/dialogflow_v2beta1/types/document.py b/google/cloud/dialogflow_v2beta1/types/document.py index 410d8b90..126bb936 100644 --- a/google/cloud/dialogflow_v2beta1/types/document.py +++ b/google/cloud/dialogflow_v2beta1/types/document.py @@ -423,8 +423,8 @@ class ImportDocumentsRequest(proto.Message): Format: ``projects//locations//knowledgeBases/``. gcs_source (google.cloud.dialogflow_v2beta1.types.GcsSources): - The Google Cloud Storage location for the documents. The - path can include a wildcard. + Optional. The Google Cloud Storage location for the + documents. The path can include a wildcard. These URIs may have the forms ``gs:///``. diff --git a/google/cloud/dialogflow_v2beta1/types/environment.py b/google/cloud/dialogflow_v2beta1/types/environment.py index 524c840b..f556da6f 100644 --- a/google/cloud/dialogflow_v2beta1/types/environment.py +++ b/google/cloud/dialogflow_v2beta1/types/environment.py @@ -67,8 +67,8 @@ class Environment(proto.Message): Output only. The unique identifier of this agent environment. Supported formats: - - ``projects//agent/environments/`` - - ``projects//locations//agent/environments/`` + - ``projects//agent/environments/`` + - ``projects//locations//agent/environments/`` description (str): Optional. The developer-provided description for this environment. The maximum length is 500 @@ -212,8 +212,8 @@ class ListEnvironmentsRequest(proto.Message): parent (str): Required. The agent to list all environments from. Format: - - ``projects//agent`` - - ``projects//locations//agent`` + - ``projects//agent`` + - ``projects//locations//agent`` page_size (int): Optional. The maximum number of items to return in a single page. By default 100 and at @@ -275,8 +275,8 @@ class GetEnvironmentRequest(proto.Message): name (str): Required. The name of the environment. Supported formats: - - ``projects//agent/environments/`` - - ``projects//locations//agent/environments/`` + - ``projects//agent/environments/`` + - ``projects//locations//agent/environments/`` """ name: str = proto.Field( @@ -294,8 +294,8 @@ class CreateEnvironmentRequest(proto.Message): Required. The agent to create an environment for. Supported formats: - - ``projects//agent`` - - ``projects//locations//agent`` + - ``projects//agent`` + - ``projects//locations//agent`` environment (google.cloud.dialogflow_v2beta1.types.Environment): Required. The environment to create. environment_id (str): @@ -360,8 +360,8 @@ class DeleteEnvironmentRequest(proto.Message): name (str): Required. The name of the environment to delete. / Format: - - ``projects//agent/environments/`` - - ``projects//locations//agent/environments/`` + - ``projects//agent/environments/`` + - ``projects//locations//agent/environments/`` """ name: str = proto.Field( @@ -379,8 +379,8 @@ class GetEnvironmentHistoryRequest(proto.Message): Required. The name of the environment to retrieve history for. Supported formats: - - ``projects//agent/environments/`` - - ``projects//locations//agent/environments/`` + - ``projects//agent/environments/`` + - ``projects//locations//agent/environments/`` page_size (int): Optional. The maximum number of items to return in a single page. By default 100 and at @@ -413,8 +413,8 @@ class EnvironmentHistory(proto.Message): Output only. The name of the environment this history is for. Supported formats: - - ``projects//agent/environments/`` - - ``projects//locations//agent/environments/`` + - ``projects//agent/environments/`` + - ``projects//locations//agent/environments/`` entries (MutableSequence[google.cloud.dialogflow_v2beta1.types.EnvironmentHistory.Entry]): Output only. The list of agent environments. There will be a maximum number of items returned based on the page_size diff --git a/google/cloud/dialogflow_v2beta1/types/participant.py b/google/cloud/dialogflow_v2beta1/types/participant.py index 64280bd3..31354325 100644 --- a/google/cloud/dialogflow_v2beta1/types/participant.py +++ b/google/cloud/dialogflow_v2beta1/types/participant.py @@ -39,6 +39,8 @@ "AudioInput", "OutputAudio", "AutomatedAgentReply", + "SuggestionInput", + "IntentInput", "SuggestionFeature", "AssistQueryParameters", "AnalyzeContentRequest", @@ -52,6 +54,8 @@ "ArticleAnswer", "FaqAnswer", "SmartReplyAnswer", + "IntentSuggestion", + "DialogflowAssistAnswer", "SuggestionResult", "SuggestArticlesRequest", "SuggestArticlesResponse", @@ -59,6 +63,7 @@ "SuggestFaqAnswersResponse", "SuggestSmartRepliesRequest", "SuggestSmartRepliesResponse", + "SuggestDialogflowAssistsResponse", "Suggestion", "ListSuggestionsRequest", "ListSuggestionsResponse", @@ -101,14 +106,15 @@ class Participant(proto.Message): Dialogflow will update [Participant.obfuscated_external_user_id][google.cloud.dialogflow.v2beta1.Participant.obfuscated_external_user_id]. - Dialogflow uses this user id for following purposes: + Dialogflow uses this user id for billing and measurement. If + a user with the same obfuscated_external_user_id is created + in a later conversation, Dialogflow will know it's the same + user. - 1) Billing and measurement. If user with the same - obfuscated_external_user_id is created in a later - conversation, dialogflow will know it's the same user. 2) - Agent assist suggestion personalization. For example, - Dialogflow can use it to provide personalized smart reply - suggestions for this user. + Dialogflow also uses this user id for Agent Assist + suggestion personalization. For example, Dialogflow can use + it to provide personalized smart reply suggestions for this + user. Note: @@ -558,6 +564,105 @@ class AutomatedAgentReplyType(proto.Enum): ) +class SuggestionInput(proto.Message): + r"""Represents the selection of a suggestion. + + Attributes: + answer_record (str): + Required. The ID of a suggestion selected by the human + agent. The suggestion(s) were generated in a previous call + to request Dialogflow assist. The format is: + ``projects//locations//answerRecords/`` + where is an alphanumeric string. + text_override (google.cloud.dialogflow_v2beta1.types.TextInput): + Optional. If the customer edited the + suggestion before using it, include the revised + text here. + parameters (google.protobuf.struct_pb2.Struct): + In Dialogflow assist for v3, the user can submit a form by + sending a + [SuggestionInput][google.cloud.dialogflow.v2beta1.SuggestionInput]. + The form is uniquely determined by the + [answer_record][google.cloud.dialogflow.v2beta1.SuggestionInput.answer_record] + field, which identifies a v3 + [QueryResult][google.cloud.dialogflow.v3alpha1.QueryResult] + containing the current + [page][google.cloud.dialogflow.v3alpha1.Page]. The form + parameters are specified via the + [parameters][google.cloud.dialogflow.v2beta1.SuggestionInput.parameters] + field. + + Depending on your protocol or client library language, this + is a map, associative array, symbol table, dictionary, or + JSON object composed of a collection of (MapKey, MapValue) + pairs: + + - MapKey type: string + - MapKey value: parameter name + - MapValue type: + + - If parameter's entity type is a composite entity: map + - Else: depending on parameter value type, could be one + of string, number, boolean, null, list or map + + - MapValue value: + + - If parameter's entity type is a composite entity: map + from composite entity property names to property + values + - Else: parameter value + intent_input (google.cloud.dialogflow_v2beta1.types.IntentInput): + The intent to be triggered on V3 agent. + """ + + answer_record: str = proto.Field( + proto.STRING, + number=1, + ) + text_override: session.TextInput = proto.Field( + proto.MESSAGE, + number=2, + message=session.TextInput, + ) + parameters: struct_pb2.Struct = proto.Field( + proto.MESSAGE, + number=4, + message=struct_pb2.Struct, + ) + intent_input: "IntentInput" = proto.Field( + proto.MESSAGE, + number=6, + message="IntentInput", + ) + + +class IntentInput(proto.Message): + r"""Represents the intent to trigger programmatically rather than + as a result of natural language processing. The intent input is + only used for V3 agent. + + Attributes: + intent (str): + Required. The unique identifier of the intent in V3 agent. + Format: + ``projects//locations//locations//agents//intents/``. + language_code (str): + Required. The language of this conversational query. See + `Language + Support `__ + for a list of the currently supported language codes. + """ + + intent: str = proto.Field( + proto.STRING, + number=1, + ) + language_code: str = proto.Field( + proto.STRING, + number=3, + ) + + class SuggestionFeature(proto.Message): r"""The type of Human Agent Assistant API suggestion to perform, and the maximum number of results to return for that type. Multiple @@ -581,6 +686,10 @@ class Type(proto.Enum): Run FAQ model. SMART_REPLY (3): Run smart reply model for chat. + DIALOGFLOW_ASSIST (4): + Run Dialogflow assist model for chat, which + will return automated agent response as + suggestion. CONVERSATION_SUMMARIZATION (8): Run conversation summarization model for chat. @@ -589,6 +698,7 @@ class Type(proto.Enum): ARTICLE_SUGGESTION = 1 FAQ = 2 SMART_REPLY = 3 + DIALOGFLOW_ASSIST = 4 CONVERSATION_SUMMARIZATION = 8 type_: Type = proto.Field( @@ -659,6 +769,11 @@ class AnalyzeContentRequest(proto.Message): event_input (google.cloud.dialogflow_v2beta1.types.EventInput): An input event to send to Dialogflow. + This field is a member of `oneof`_ ``input``. + suggestion_input (google.cloud.dialogflow_v2beta1.types.SuggestionInput): + An input representing the selection of a + suggestion. + This field is a member of `oneof`_ ``input``. reply_audio_config (google.cloud.dialogflow_v2beta1.types.OutputAudioConfig): Speech synthesis configuration. @@ -740,6 +855,12 @@ class AnalyzeContentRequest(proto.Message): oneof="input", message=session.EventInput, ) + suggestion_input: "SuggestionInput" = proto.Field( + proto.MESSAGE, + number=12, + oneof="input", + message="SuggestionInput", + ) reply_audio_config: gcd_audio_config.OutputAudioConfig = proto.Field( proto.MESSAGE, number=5, @@ -1430,6 +1551,86 @@ class SmartReplyAnswer(proto.Message): ) +class IntentSuggestion(proto.Message): + r"""Represents an intent suggestion. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + display_name (str): + The display name of the intent. + intent_v2 (str): + The unique identifier of this + [intent][google.cloud.dialogflow.v2beta1.Intent]. Format: + ``projects//locations//agent/intents/``. + + This field is a member of `oneof`_ ``intent``. + description (str): + Human readable description for better + understanding an intent like its scope, content, + result etc. Maximum character limit: 140 + characters. + """ + + display_name: str = proto.Field( + proto.STRING, + number=1, + ) + intent_v2: str = proto.Field( + proto.STRING, + number=2, + oneof="intent", + ) + description: str = proto.Field( + proto.STRING, + number=5, + ) + + +class DialogflowAssistAnswer(proto.Message): + r"""Represents a Dialogflow assist answer. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + query_result (google.cloud.dialogflow_v2beta1.types.QueryResult): + Result from v2 agent. + + This field is a member of `oneof`_ ``result``. + intent_suggestion (google.cloud.dialogflow_v2beta1.types.IntentSuggestion): + An intent suggestion generated from + conversation. + + This field is a member of `oneof`_ ``result``. + answer_record (str): + The name of answer record, in the format of + "projects//locations//answerRecords/". + """ + + query_result: session.QueryResult = proto.Field( + proto.MESSAGE, + number=1, + oneof="result", + message=session.QueryResult, + ) + intent_suggestion: "IntentSuggestion" = proto.Field( + proto.MESSAGE, + number=5, + oneof="result", + message="IntentSuggestion", + ) + answer_record: str = proto.Field( + proto.STRING, + number=2, + ) + + class SuggestionResult(proto.Message): r"""One response of different type of suggestion response which is used in the response of @@ -1463,6 +1664,16 @@ class SuggestionResult(proto.Message): suggest_smart_replies_response (google.cloud.dialogflow_v2beta1.types.SuggestSmartRepliesResponse): SuggestSmartRepliesResponse if request is for SMART_REPLY. + This field is a member of `oneof`_ ``suggestion_response``. + suggest_dialogflow_assists_response (google.cloud.dialogflow_v2beta1.types.SuggestDialogflowAssistsResponse): + SuggestDialogflowAssistsResponse if request is for + DIALOGFLOW_ASSIST. + + This field is a member of `oneof`_ ``suggestion_response``. + suggest_entity_extraction_response (google.cloud.dialogflow_v2beta1.types.SuggestDialogflowAssistsResponse): + SuggestDialogflowAssistsResponse if request is for + ENTITY_EXTRACTION. + This field is a member of `oneof`_ ``suggestion_response``. """ @@ -1490,6 +1701,22 @@ class SuggestionResult(proto.Message): oneof="suggestion_response", message="SuggestSmartRepliesResponse", ) + suggest_dialogflow_assists_response: "SuggestDialogflowAssistsResponse" = ( + proto.Field( + proto.MESSAGE, + number=5, + oneof="suggestion_response", + message="SuggestDialogflowAssistsResponse", + ) + ) + suggest_entity_extraction_response: "SuggestDialogflowAssistsResponse" = ( + proto.Field( + proto.MESSAGE, + number=7, + oneof="suggestion_response", + message="SuggestDialogflowAssistsResponse", + ) + ) class SuggestArticlesRequest(proto.Message): @@ -1745,6 +1972,47 @@ class SuggestSmartRepliesResponse(proto.Message): ) +class SuggestDialogflowAssistsResponse(proto.Message): + r"""The response message for + [Participants.SuggestDialogflowAssists][google.cloud.dialogflow.v2beta1.Participants.SuggestDialogflowAssists]. + + Attributes: + dialogflow_assist_answers (MutableSequence[google.cloud.dialogflow_v2beta1.types.DialogflowAssistAnswer]): + Output only. Multiple reply options provided + by Dialogflow assist service. The order is based + on the rank of the model prediction. + latest_message (str): + The name of the latest conversation message used to suggest + answer. + + Format: + ``projects//locations//conversations//messages/``. + context_size (int): + Number of messages prior to and including + [latest_message][google.cloud.dialogflow.v2beta1.SuggestDialogflowAssistsResponse.latest_message] + to compile the suggestion. It may be smaller than the + [SuggestDialogflowAssistsRequest.context_size][google.cloud.dialogflow.v2beta1.SuggestDialogflowAssistsRequest.context_size] + field in the request if there aren't that many messages in + the conversation. + """ + + dialogflow_assist_answers: MutableSequence[ + "DialogflowAssistAnswer" + ] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="DialogflowAssistAnswer", + ) + latest_message: str = proto.Field( + proto.STRING, + number=2, + ) + context_size: int = proto.Field( + proto.INT32, + number=3, + ) + + class Suggestion(proto.Message): r"""Represents a suggestion for a human agent. diff --git a/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json b/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json index 0b80ee5b..05104fea 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-dialogflow", - "version": "2.22.0" + "version": "2.23.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json index 5bb5fc08..8bdf5c6c 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.dialogflow.v2beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-dialogflow", - "version": "2.22.0" + "version": "2.23.0" }, "snippets": [ { diff --git a/scripts/fixup_dialogflow_v2beta1_keywords.py b/scripts/fixup_dialogflow_v2beta1_keywords.py index bb10e1a5..e67e3a7a 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', 'audio_input', 'event_input', 'reply_audio_config', 'query_params', 'assist_query_params', 'cx_parameters', 'cx_current_page', 'message_send_time', 'request_id', ), + 'analyze_content': ('participant', 'text_input', 'audio_input', 'event_input', 'suggestion_input', 'reply_audio_config', 'query_params', 'assist_query_params', 'cx_parameters', 'cx_current_page', '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', ), diff --git a/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py b/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py index e8c2c60e..14d2f478 100644 --- a/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py +++ b/tests/unit/gapic/dialogflow_v2/test_conversation_profiles.py @@ -44,6 +44,7 @@ from google.cloud.location import locations_pb2 from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import json_format from google.protobuf import timestamp_pb2 # type: ignore @@ -3470,7 +3471,10 @@ def test_create_conversation_profile_rest(request_type): "display_name": "display_name_value", "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, - "automated_agent_config": {"agent": "agent_value"}, + "automated_agent_config": { + "agent": "agent_value", + "session_ttl": {"seconds": 751, "nanos": 543}, + }, "human_agent_assistant_config": { "notification_config": {"topic": "topic_value", "message_format": 1}, "human_agent_suggestion_config": { @@ -3749,7 +3753,10 @@ def test_create_conversation_profile_rest_bad_request( "display_name": "display_name_value", "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, - "automated_agent_config": {"agent": "agent_value"}, + "automated_agent_config": { + "agent": "agent_value", + "session_ttl": {"seconds": 751, "nanos": 543}, + }, "human_agent_assistant_config": { "notification_config": {"topic": "topic_value", "message_format": 1}, "human_agent_suggestion_config": { @@ -3927,7 +3934,10 @@ def test_update_conversation_profile_rest(request_type): "display_name": "display_name_value", "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, - "automated_agent_config": {"agent": "agent_value"}, + "automated_agent_config": { + "agent": "agent_value", + "session_ttl": {"seconds": 751, "nanos": 543}, + }, "human_agent_assistant_config": { "notification_config": {"topic": "topic_value", "message_format": 1}, "human_agent_suggestion_config": { @@ -4207,7 +4217,10 @@ def test_update_conversation_profile_rest_bad_request( "display_name": "display_name_value", "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, - "automated_agent_config": {"agent": "agent_value"}, + "automated_agent_config": { + "agent": "agent_value", + "session_ttl": {"seconds": 751, "nanos": 543}, + }, "human_agent_assistant_config": { "notification_config": {"topic": "topic_value", "message_format": 1}, "human_agent_suggestion_config": { diff --git a/tests/unit/gapic/dialogflow_v2/test_conversations.py b/tests/unit/gapic/dialogflow_v2/test_conversations.py index c6a96809..d5ae0892 100644 --- a/tests/unit/gapic/dialogflow_v2/test_conversations.py +++ b/tests/unit/gapic/dialogflow_v2/test_conversations.py @@ -35,6 +35,7 @@ from google.cloud.location import locations_pb2 from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import json_format from google.protobuf import struct_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_answer_records.py b/tests/unit/gapic/dialogflow_v2beta1/test_answer_records.py index d74dbca1..762e8d97 100644 --- a/tests/unit/gapic/dialogflow_v2beta1/test_answer_records.py +++ b/tests/unit/gapic/dialogflow_v2beta1/test_answer_records.py @@ -37,6 +37,7 @@ from google.oauth2 import service_account from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import json_format +from google.protobuf import struct_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore import grpc from grpc.experimental import aio @@ -52,9 +53,9 @@ pagers, transports, ) +from google.cloud.dialogflow_v2beta1.types import context, intent, participant, session from google.cloud.dialogflow_v2beta1.types import answer_record as gcd_answer_record from google.cloud.dialogflow_v2beta1.types import answer_record -from google.cloud.dialogflow_v2beta1.types import participant def client_cert_source_callback(): @@ -1993,6 +1994,275 @@ def test_update_answer_record_rest(request_type): "metadata": {}, "answer_record": "answer_record_value", }, + "dialogflow_assist_answer": { + "query_result": { + "query_text": "query_text_value", + "language_code": "language_code_value", + "speech_recognition_confidence": 0.3045, + "action": "action_value", + "parameters": {"fields": {}}, + "all_required_params_present": True, + "cancels_slot_filling": True, + "fulfillment_text": "fulfillment_text_value", + "fulfillment_messages": [ + { + "text": {"text": ["text_value1", "text_value2"]}, + "image": { + "image_uri": "image_uri_value", + "accessibility_text": "accessibility_text_value", + }, + "quick_replies": { + "title": "title_value", + "quick_replies": [ + "quick_replies_value1", + "quick_replies_value2", + ], + }, + "card": { + "title": "title_value", + "subtitle": "subtitle_value", + "image_uri": "image_uri_value", + "buttons": [ + {"text": "text_value", "postback": "postback_value"} + ], + }, + "payload": {}, + "simple_responses": { + "simple_responses": [ + { + "text_to_speech": "text_to_speech_value", + "ssml": "ssml_value", + "display_text": "display_text_value", + } + ] + }, + "basic_card": { + "title": "title_value", + "subtitle": "subtitle_value", + "formatted_text": "formatted_text_value", + "image": {}, + "buttons": [ + { + "title": "title_value", + "open_uri_action": {"uri": "uri_value"}, + } + ], + }, + "suggestions": {"suggestions": [{"title": "title_value"}]}, + "link_out_suggestion": { + "destination_name": "destination_name_value", + "uri": "uri_value", + }, + "list_select": { + "title": "title_value", + "items": [ + { + "info": { + "key": "key_value", + "synonyms": [ + "synonyms_value1", + "synonyms_value2", + ], + }, + "title": "title_value", + "description": "description_value", + "image": {}, + } + ], + "subtitle": "subtitle_value", + }, + "carousel_select": { + "items": [ + { + "info": {}, + "title": "title_value", + "description": "description_value", + "image": {}, + } + ] + }, + "telephony_play_audio": {"audio_uri": "audio_uri_value"}, + "telephony_synthesize_speech": { + "text": "text_value", + "ssml": "ssml_value", + }, + "telephony_transfer_call": { + "phone_number": "phone_number_value" + }, + "rbm_text": { + "text": "text_value", + "rbm_suggestion": [ + { + "reply": { + "text": "text_value", + "postback_data": "postback_data_value", + }, + "action": { + "text": "text_value", + "postback_data": "postback_data_value", + "dial": { + "phone_number": "phone_number_value" + }, + "open_url": {"uri": "uri_value"}, + "share_location": {}, + }, + } + ], + }, + "rbm_standalone_rich_card": { + "card_orientation": 1, + "thumbnail_image_alignment": 1, + "card_content": { + "title": "title_value", + "description": "description_value", + "media": { + "file_uri": "file_uri_value", + "thumbnail_uri": "thumbnail_uri_value", + "height": 1, + }, + "suggestions": {}, + }, + }, + "rbm_carousel_rich_card": { + "card_width": 1, + "card_contents": {}, + }, + "browse_carousel_card": { + "items": [ + { + "open_uri_action": { + "url": "url_value", + "url_type_hint": 1, + }, + "title": "title_value", + "description": "description_value", + "image": {}, + "footer": "footer_value", + } + ], + "image_display_options": 1, + }, + "table_card": { + "title": "title_value", + "subtitle": "subtitle_value", + "image": {}, + "column_properties": [ + { + "header": "header_value", + "horizontal_alignment": 1, + } + ], + "rows": [ + { + "cells": [{"text": "text_value"}], + "divider_after": True, + } + ], + "buttons": {}, + }, + "media_content": { + "media_type": 1, + "media_objects": [ + { + "name": "name_value", + "description": "description_value", + "large_image": {}, + "icon": {}, + "content_url": "content_url_value", + } + ], + }, + "platform": 1, + } + ], + "webhook_source": "webhook_source_value", + "webhook_payload": {}, + "output_contexts": [ + {"name": "name_value", "lifespan_count": 1498, "parameters": {}} + ], + "intent": { + "name": "name_value", + "display_name": "display_name_value", + "webhook_state": 1, + "priority": 898, + "is_fallback": True, + "ml_enabled": True, + "ml_disabled": True, + "live_agent_handoff": True, + "end_interaction": True, + "input_context_names": [ + "input_context_names_value1", + "input_context_names_value2", + ], + "events": ["events_value1", "events_value2"], + "training_phrases": [ + { + "name": "name_value", + "type_": 1, + "parts": [ + { + "text": "text_value", + "entity_type": "entity_type_value", + "alias": "alias_value", + "user_defined": True, + } + ], + "times_added_count": 1787, + } + ], + "action": "action_value", + "output_contexts": {}, + "reset_contexts": True, + "parameters": [ + { + "name": "name_value", + "display_name": "display_name_value", + "value": "value_value", + "default_value": "default_value_value", + "entity_type_display_name": "entity_type_display_name_value", + "mandatory": True, + "prompts": ["prompts_value1", "prompts_value2"], + "is_list": True, + } + ], + "messages": {}, + "default_response_platforms": [1], + "root_followup_intent_name": "root_followup_intent_name_value", + "parent_followup_intent_name": "parent_followup_intent_name_value", + "followup_intent_info": [ + { + "followup_intent_name": "followup_intent_name_value", + "parent_followup_intent_name": "parent_followup_intent_name_value", + } + ], + }, + "intent_detection_confidence": 0.28450000000000003, + "diagnostic_info": {}, + "sentiment_analysis_result": { + "query_text_sentiment": { + "score": 0.54, + "magnitude": 0.9580000000000001, + } + }, + "knowledge_answers": { + "answers": [ + { + "source": "source_value", + "faq_question": "faq_question_value", + "answer": "answer_value", + "match_confidence_level": 1, + "match_confidence": 0.1658, + } + ] + }, + }, + "intent_suggestion": { + "display_name": "display_name_value", + "intent_v2": "intent_v2_value", + "description": "description_value", + }, + "answer_record": "answer_record_value", + }, }, } request = request_type(**request_init) @@ -2208,6 +2478,275 @@ def test_update_answer_record_rest_bad_request( "metadata": {}, "answer_record": "answer_record_value", }, + "dialogflow_assist_answer": { + "query_result": { + "query_text": "query_text_value", + "language_code": "language_code_value", + "speech_recognition_confidence": 0.3045, + "action": "action_value", + "parameters": {"fields": {}}, + "all_required_params_present": True, + "cancels_slot_filling": True, + "fulfillment_text": "fulfillment_text_value", + "fulfillment_messages": [ + { + "text": {"text": ["text_value1", "text_value2"]}, + "image": { + "image_uri": "image_uri_value", + "accessibility_text": "accessibility_text_value", + }, + "quick_replies": { + "title": "title_value", + "quick_replies": [ + "quick_replies_value1", + "quick_replies_value2", + ], + }, + "card": { + "title": "title_value", + "subtitle": "subtitle_value", + "image_uri": "image_uri_value", + "buttons": [ + {"text": "text_value", "postback": "postback_value"} + ], + }, + "payload": {}, + "simple_responses": { + "simple_responses": [ + { + "text_to_speech": "text_to_speech_value", + "ssml": "ssml_value", + "display_text": "display_text_value", + } + ] + }, + "basic_card": { + "title": "title_value", + "subtitle": "subtitle_value", + "formatted_text": "formatted_text_value", + "image": {}, + "buttons": [ + { + "title": "title_value", + "open_uri_action": {"uri": "uri_value"}, + } + ], + }, + "suggestions": {"suggestions": [{"title": "title_value"}]}, + "link_out_suggestion": { + "destination_name": "destination_name_value", + "uri": "uri_value", + }, + "list_select": { + "title": "title_value", + "items": [ + { + "info": { + "key": "key_value", + "synonyms": [ + "synonyms_value1", + "synonyms_value2", + ], + }, + "title": "title_value", + "description": "description_value", + "image": {}, + } + ], + "subtitle": "subtitle_value", + }, + "carousel_select": { + "items": [ + { + "info": {}, + "title": "title_value", + "description": "description_value", + "image": {}, + } + ] + }, + "telephony_play_audio": {"audio_uri": "audio_uri_value"}, + "telephony_synthesize_speech": { + "text": "text_value", + "ssml": "ssml_value", + }, + "telephony_transfer_call": { + "phone_number": "phone_number_value" + }, + "rbm_text": { + "text": "text_value", + "rbm_suggestion": [ + { + "reply": { + "text": "text_value", + "postback_data": "postback_data_value", + }, + "action": { + "text": "text_value", + "postback_data": "postback_data_value", + "dial": { + "phone_number": "phone_number_value" + }, + "open_url": {"uri": "uri_value"}, + "share_location": {}, + }, + } + ], + }, + "rbm_standalone_rich_card": { + "card_orientation": 1, + "thumbnail_image_alignment": 1, + "card_content": { + "title": "title_value", + "description": "description_value", + "media": { + "file_uri": "file_uri_value", + "thumbnail_uri": "thumbnail_uri_value", + "height": 1, + }, + "suggestions": {}, + }, + }, + "rbm_carousel_rich_card": { + "card_width": 1, + "card_contents": {}, + }, + "browse_carousel_card": { + "items": [ + { + "open_uri_action": { + "url": "url_value", + "url_type_hint": 1, + }, + "title": "title_value", + "description": "description_value", + "image": {}, + "footer": "footer_value", + } + ], + "image_display_options": 1, + }, + "table_card": { + "title": "title_value", + "subtitle": "subtitle_value", + "image": {}, + "column_properties": [ + { + "header": "header_value", + "horizontal_alignment": 1, + } + ], + "rows": [ + { + "cells": [{"text": "text_value"}], + "divider_after": True, + } + ], + "buttons": {}, + }, + "media_content": { + "media_type": 1, + "media_objects": [ + { + "name": "name_value", + "description": "description_value", + "large_image": {}, + "icon": {}, + "content_url": "content_url_value", + } + ], + }, + "platform": 1, + } + ], + "webhook_source": "webhook_source_value", + "webhook_payload": {}, + "output_contexts": [ + {"name": "name_value", "lifespan_count": 1498, "parameters": {}} + ], + "intent": { + "name": "name_value", + "display_name": "display_name_value", + "webhook_state": 1, + "priority": 898, + "is_fallback": True, + "ml_enabled": True, + "ml_disabled": True, + "live_agent_handoff": True, + "end_interaction": True, + "input_context_names": [ + "input_context_names_value1", + "input_context_names_value2", + ], + "events": ["events_value1", "events_value2"], + "training_phrases": [ + { + "name": "name_value", + "type_": 1, + "parts": [ + { + "text": "text_value", + "entity_type": "entity_type_value", + "alias": "alias_value", + "user_defined": True, + } + ], + "times_added_count": 1787, + } + ], + "action": "action_value", + "output_contexts": {}, + "reset_contexts": True, + "parameters": [ + { + "name": "name_value", + "display_name": "display_name_value", + "value": "value_value", + "default_value": "default_value_value", + "entity_type_display_name": "entity_type_display_name_value", + "mandatory": True, + "prompts": ["prompts_value1", "prompts_value2"], + "is_list": True, + } + ], + "messages": {}, + "default_response_platforms": [1], + "root_followup_intent_name": "root_followup_intent_name_value", + "parent_followup_intent_name": "parent_followup_intent_name_value", + "followup_intent_info": [ + { + "followup_intent_name": "followup_intent_name_value", + "parent_followup_intent_name": "parent_followup_intent_name_value", + } + ], + }, + "intent_detection_confidence": 0.28450000000000003, + "diagnostic_info": {}, + "sentiment_analysis_result": { + "query_text_sentiment": { + "score": 0.54, + "magnitude": 0.9580000000000001, + } + }, + "knowledge_answers": { + "answers": [ + { + "source": "source_value", + "faq_question": "faq_question_value", + "answer": "answer_value", + "match_confidence_level": 1, + "match_confidence": 0.1658, + } + ] + }, + }, + "intent_suggestion": { + "display_name": "display_name_value", + "intent_v2": "intent_v2_value", + "description": "description_value", + }, + "answer_record": "answer_record_value", + }, }, } request = request_type(**request_init) @@ -2865,8 +3404,83 @@ def test_parse_answer_record_path(): assert expected == actual +def test_context_path(): + project = "oyster" + session = "nudibranch" + context = "cuttlefish" + expected = "projects/{project}/agent/sessions/{session}/contexts/{context}".format( + project=project, + session=session, + context=context, + ) + actual = AnswerRecordsClient.context_path(project, session, context) + assert expected == actual + + +def test_parse_context_path(): + expected = { + "project": "mussel", + "session": "winkle", + "context": "nautilus", + } + path = AnswerRecordsClient.context_path(**expected) + + # Check that the path construction is reversible. + actual = AnswerRecordsClient.parse_context_path(path) + assert expected == actual + + +def test_document_path(): + project = "scallop" + knowledge_base = "abalone" + document = "squid" + expected = "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format( + project=project, + knowledge_base=knowledge_base, + document=document, + ) + actual = AnswerRecordsClient.document_path(project, knowledge_base, document) + assert expected == actual + + +def test_parse_document_path(): + expected = { + "project": "clam", + "knowledge_base": "whelk", + "document": "octopus", + } + path = AnswerRecordsClient.document_path(**expected) + + # Check that the path construction is reversible. + actual = AnswerRecordsClient.parse_document_path(path) + assert expected == actual + + +def test_intent_path(): + project = "oyster" + intent = "nudibranch" + expected = "projects/{project}/agent/intents/{intent}".format( + project=project, + intent=intent, + ) + actual = AnswerRecordsClient.intent_path(project, intent) + assert expected == actual + + +def test_parse_intent_path(): + expected = { + "project": "cuttlefish", + "intent": "mussel", + } + path = AnswerRecordsClient.intent_path(**expected) + + # Check that the path construction is reversible. + actual = AnswerRecordsClient.parse_intent_path(path) + assert expected == actual + + def test_common_billing_account_path(): - billing_account = "oyster" + billing_account = "winkle" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -2876,7 +3490,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "nudibranch", + "billing_account": "nautilus", } path = AnswerRecordsClient.common_billing_account_path(**expected) @@ -2886,7 +3500,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "cuttlefish" + folder = "scallop" expected = "folders/{folder}".format( folder=folder, ) @@ -2896,7 +3510,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "mussel", + "folder": "abalone", } path = AnswerRecordsClient.common_folder_path(**expected) @@ -2906,7 +3520,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "winkle" + organization = "squid" expected = "organizations/{organization}".format( organization=organization, ) @@ -2916,7 +3530,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "nautilus", + "organization": "clam", } path = AnswerRecordsClient.common_organization_path(**expected) @@ -2926,7 +3540,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "scallop" + project = "whelk" expected = "projects/{project}".format( project=project, ) @@ -2936,7 +3550,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "abalone", + "project": "octopus", } path = AnswerRecordsClient.common_project_path(**expected) @@ -2946,8 +3560,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "squid" - location = "clam" + project = "oyster" + location = "nudibranch" expected = "projects/{project}/locations/{location}".format( project=project, location=location, @@ -2958,8 +3572,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "whelk", - "location": "octopus", + "project": "cuttlefish", + "location": "mussel", } path = AnswerRecordsClient.common_location_path(**expected) diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py b/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py index 3c472f27..7fd20730 100644 --- a/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py +++ b/tests/unit/gapic/dialogflow_v2beta1/test_conversation_profiles.py @@ -44,6 +44,7 @@ from google.cloud.location import locations_pb2 from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import json_format from google.protobuf import timestamp_pb2 # type: ignore @@ -3476,7 +3477,10 @@ def test_create_conversation_profile_rest(request_type): "display_name": "display_name_value", "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, - "automated_agent_config": {"agent": "agent_value"}, + "automated_agent_config": { + "agent": "agent_value", + "session_ttl": {"seconds": 751, "nanos": 543}, + }, "human_agent_assistant_config": { "notification_config": {"topic": "topic_value", "message_format": 1}, "human_agent_suggestion_config": { @@ -3498,7 +3502,10 @@ def test_create_conversation_profile_rest(request_type): "document_query_source": { "documents": ["documents_value1", "documents_value2"] }, - "dialogflow_query_source": {"agent": "agent_value"}, + "dialogflow_query_source": { + "agent": "agent_value", + "human_agent_side_config": {"agent": "agent_value"}, + }, "max_results": 1207, "confidence_threshold": 0.2106, "context_filter_settings": { @@ -3755,7 +3762,10 @@ def test_create_conversation_profile_rest_bad_request( "display_name": "display_name_value", "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, - "automated_agent_config": {"agent": "agent_value"}, + "automated_agent_config": { + "agent": "agent_value", + "session_ttl": {"seconds": 751, "nanos": 543}, + }, "human_agent_assistant_config": { "notification_config": {"topic": "topic_value", "message_format": 1}, "human_agent_suggestion_config": { @@ -3777,7 +3787,10 @@ def test_create_conversation_profile_rest_bad_request( "document_query_source": { "documents": ["documents_value1", "documents_value2"] }, - "dialogflow_query_source": {"agent": "agent_value"}, + "dialogflow_query_source": { + "agent": "agent_value", + "human_agent_side_config": {"agent": "agent_value"}, + }, "max_results": 1207, "confidence_threshold": 0.2106, "context_filter_settings": { @@ -3934,7 +3947,10 @@ def test_update_conversation_profile_rest(request_type): "display_name": "display_name_value", "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, - "automated_agent_config": {"agent": "agent_value"}, + "automated_agent_config": { + "agent": "agent_value", + "session_ttl": {"seconds": 751, "nanos": 543}, + }, "human_agent_assistant_config": { "notification_config": {"topic": "topic_value", "message_format": 1}, "human_agent_suggestion_config": { @@ -3956,7 +3972,10 @@ def test_update_conversation_profile_rest(request_type): "document_query_source": { "documents": ["documents_value1", "documents_value2"] }, - "dialogflow_query_source": {"agent": "agent_value"}, + "dialogflow_query_source": { + "agent": "agent_value", + "human_agent_side_config": {"agent": "agent_value"}, + }, "max_results": 1207, "confidence_threshold": 0.2106, "context_filter_settings": { @@ -4214,7 +4233,10 @@ def test_update_conversation_profile_rest_bad_request( "display_name": "display_name_value", "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, - "automated_agent_config": {"agent": "agent_value"}, + "automated_agent_config": { + "agent": "agent_value", + "session_ttl": {"seconds": 751, "nanos": 543}, + }, "human_agent_assistant_config": { "notification_config": {"topic": "topic_value", "message_format": 1}, "human_agent_suggestion_config": { @@ -4236,7 +4258,10 @@ def test_update_conversation_profile_rest_bad_request( "document_query_source": { "documents": ["documents_value1", "documents_value2"] }, - "dialogflow_query_source": {"agent": "agent_value"}, + "dialogflow_query_source": { + "agent": "agent_value", + "human_agent_side_config": {"agent": "agent_value"}, + }, "max_results": 1207, "confidence_threshold": 0.2106, "context_filter_settings": { diff --git a/tests/unit/gapic/dialogflow_v2beta1/test_conversations.py b/tests/unit/gapic/dialogflow_v2beta1/test_conversations.py index 337ae7f2..a81a0625 100644 --- a/tests/unit/gapic/dialogflow_v2beta1/test_conversations.py +++ b/tests/unit/gapic/dialogflow_v2beta1/test_conversations.py @@ -35,6 +35,7 @@ from google.cloud.location import locations_pb2 from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import json_format from google.protobuf import struct_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore