From 380eba07af6924efbbcd87e442e6ff283e9da787 Mon Sep 17 00:00:00 2001 From: Google APIs Date: Mon, 16 Jul 2018 11:09:26 -0700 Subject: [PATCH] Synchronize new proto/yaml changes. PiperOrigin-RevId: 204772388 --- .../cloud/dialogflow/dialogflow_v2beta1.yaml | 19 + google/cloud/dialogflow/v2beta1/agent.proto | 47 ++- .../dialogflow/v2beta1/audio_config.proto | 126 ++++++ google/cloud/dialogflow/v2beta1/context.proto | 47 +-- .../dialogflow/v2beta1/dialogflow_gapic.yaml | 379 +++++++++++++++++- .../cloud/dialogflow/v2beta1/document.proto | 209 ++++++++++ .../dialogflow/v2beta1/entity_type.proto | 2 +- google/cloud/dialogflow/v2beta1/intent.proto | 75 +++- .../dialogflow/v2beta1/knowledge_base.proto | 141 +++++++ google/cloud/dialogflow/v2beta1/session.proto | 238 +++++++++-- .../v2beta1/session_entity_type.proto | 42 +- google/cloud/dialogflow/v2beta1/webhook.proto | 27 +- 12 files changed, 1232 insertions(+), 120 deletions(-) create mode 100644 google/cloud/dialogflow/v2beta1/audio_config.proto create mode 100644 google/cloud/dialogflow/v2beta1/document.proto create mode 100644 google/cloud/dialogflow/v2beta1/knowledge_base.proto diff --git a/google/cloud/dialogflow/dialogflow_v2beta1.yaml b/google/cloud/dialogflow/dialogflow_v2beta1.yaml index 7bc65b93..e598f52a 100644 --- a/google/cloud/dialogflow/dialogflow_v2beta1.yaml +++ b/google/cloud/dialogflow/dialogflow_v2beta1.yaml @@ -6,8 +6,10 @@ title: Dialogflow API apis: - name: google.cloud.dialogflow.v2beta1.Agents - name: google.cloud.dialogflow.v2beta1.Contexts +- name: google.cloud.dialogflow.v2beta1.Documents - name: google.cloud.dialogflow.v2beta1.EntityTypes - name: google.cloud.dialogflow.v2beta1.Intents +- name: google.cloud.dialogflow.v2beta1.KnowledgeBases - name: google.cloud.dialogflow.v2beta1.SessionEntityTypes - name: google.cloud.dialogflow.v2beta1.Sessions @@ -15,6 +17,7 @@ types: - name: google.cloud.dialogflow.v2beta1.ExportAgentResponse - name: google.cloud.dialogflow.v2beta1.BatchUpdateEntityTypesResponse - name: google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse +- name: google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata - name: google.cloud.dialogflow.v2beta1.OriginalDetectIntentRequest - name: google.cloud.dialogflow.v2beta1.WebhookRequest - name: google.cloud.dialogflow.v2beta1.WebhookResponse @@ -91,6 +94,14 @@ backend: deadline: 60.0 - selector: google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts deadline: 60.0 + - selector: google.cloud.dialogflow.v2beta1.Documents.ListDocuments + deadline: 60.0 + - selector: google.cloud.dialogflow.v2beta1.Documents.GetDocument + deadline: 60.0 + - selector: google.cloud.dialogflow.v2beta1.Documents.CreateDocument + deadline: 60.0 + - selector: google.cloud.dialogflow.v2beta1.Documents.DeleteDocument + deadline: 60.0 - selector: google.cloud.dialogflow.v2beta1.EntityTypes.ListEntityTypes deadline: 60.0 - selector: google.cloud.dialogflow.v2beta1.EntityTypes.GetEntityType @@ -125,6 +136,14 @@ backend: deadline: 60.0 - selector: google.cloud.dialogflow.v2beta1.Intents.BatchDeleteIntents deadline: 60.0 + - selector: google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases + deadline: 60.0 + - selector: google.cloud.dialogflow.v2beta1.KnowledgeBases.GetKnowledgeBase + deadline: 60.0 + - selector: google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase + deadline: 60.0 + - selector: google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase + deadline: 60.0 - selector: google.cloud.dialogflow.v2beta1.SessionEntityTypes.ListSessionEntityTypes deadline: 60.0 - selector: google.cloud.dialogflow.v2beta1.SessionEntityTypes.GetSessionEntityType diff --git a/google/cloud/dialogflow/v2beta1/agent.proto b/google/cloud/dialogflow/v2beta1/agent.proto index aca63b2c..e647a868 100644 --- a/google/cloud/dialogflow/v2beta1/agent.proto +++ b/google/cloud/dialogflow/v2beta1/agent.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -43,7 +43,8 @@ option objc_class_prefix = "DF"; // // You can create an agent using both Dialogflow Standard Edition and // Dialogflow Enterprise Edition. For details, see -// [Dialogflow Editions](/dialogflow-enterprise/docs/editions). +// [Dialogflow +// Editions](https://cloud.google.com/dialogflow-enterprise/docs/editions). // // You can save your agent for backup or versioning by exporting the agent by // using the [ExportAgent][google.cloud.dialogflow.v2beta1.Agents.ExportAgent] method. You can import a saved @@ -241,9 +242,11 @@ message ExportAgentRequest { // Format: `projects/`. string parent = 1; - // Optional. The Google Cloud Storage URI to export the agent to. - // Note: The URI must start with - // "gs://". If left unspecified, the serialized agent is returned inline. + // Optional. The + // [Google Cloud Storage](https://cloud.google.com/storage/docs/) + // URI to export the agent to. + // The format of this URI must be `gs:///`. + // If left unspecified, the serialized agent is returned inline. string agent_uri = 2; } @@ -258,17 +261,17 @@ message ExportAgentResponse { // The exported agent. // // Example for how to export an agent to a zip file via a command line: - // - // curl \ - // 'https://dialogflow.googleapis.com/v2beta1/projects//agent:export'\ + //
curl \
+    //   'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:export'\
     //   -X POST \
-    //   -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
+    //   -H 'Authorization: Bearer '$(gcloud auth application-default
+    //   print-access-token) \
     //   -H 'Accept: application/json' \
     //   -H 'Content-Type: application/json' \
     //   --compressed \
     //   --data-binary '{}' \
     // | grep agentContent | sed -e 's/.*"agentContent": "\([^"]*\)".*/\1/' \
-    // | base64 --decode > 
+    // | base64 --decode > <agent zip file>
bytes agent_content = 2; } } @@ -288,17 +291,17 @@ message ImportAgentRequest { // The agent to import. // // Example for how to import an agent via the command line: - // - // curl \ - // 'https://dialogflow.googleapis.com/v2beta1/projects//agent:import\ + //
curl \
+    //   'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:import\
     //    -X POST \
-    //    -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
+    //    -H 'Authorization: Bearer '$(gcloud auth application-default
+    //    print-access-token) \
     //    -H 'Accept: application/json' \
     //    -H 'Content-Type: application/json' \
     //    --compressed \
     //    --data-binary "{
-    //       'agentContent': '$(cat  | base64 -w 0)'
-    //    }"
+    //       'agentContent': '$(cat <agent zip file> | base64 -w 0)'
+    //    }"
bytes agent_content = 3; } } @@ -318,17 +321,17 @@ message RestoreAgentRequest { // The agent to restore. // // Example for how to restore an agent via the command line: - // - // curl \ - // 'https://dialogflow.googleapis.com/v2beta1/projects//agent:restore\ + //
curl \
+    //   'https://dialogflow.googleapis.com/v2beta1/projects/<project_name>/agent:restore\
     //    -X POST \
-    //    -H 'Authorization: Bearer '$(gcloud auth print-access-token) \
+    //    -H 'Authorization: Bearer '$(gcloud auth application-default
+    //    print-access-token) \
     //    -H 'Accept: application/json' \
     //    -H 'Content-Type: application/json' \
     //    --compressed \
     //    --data-binary "{
-    //        'agentContent': '$(cat  | base64 -w 0)'
-    //    }" \
+    //        'agentContent': '$(cat <agent zip file> | base64 -w 0)'
+    //    }"
bytes agent_content = 3; } } diff --git a/google/cloud/dialogflow/v2beta1/audio_config.proto b/google/cloud/dialogflow/v2beta1/audio_config.proto new file mode 100644 index 00000000..e993ad10 --- /dev/null +++ b/google/cloud/dialogflow/v2beta1/audio_config.proto @@ -0,0 +1,126 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "AudioConfigProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + + +// Description of which voice to use for speech synthesis. +message VoiceSelectionParams { + // Optional. The name of the voice. If not set, the service will choose a + // voice based on the other parameters such as language_code and gender. + string name = 1; + + // Optional. The preferred gender of the voice. If not set, the service will + // choose a voice based on the other parameters such as language_code and + // name. Note that this is only a preference, not requirement. If a + // voice of the appropriate gender is not available, the synthesizer should + // substitute a voice with a different gender rather than failing the request. + SsmlVoiceGender ssml_gender = 2; +} + +// Configuration of how speech should be synthesized. +message SynthesizeSpeechConfig { + // Optional. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is the normal + // native speed supported by the specific voice. 2.0 is twice as fast, and + // 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 speed. Any + // other values < 0.25 or > 4.0 will return an error. + double speaking_rate = 1; + + // Optional. Speaking pitch, in the range [-20.0, 20.0]. 20 means increase 20 + // semitones from the original pitch. -20 means decrease 20 semitones from the + // original pitch. + double pitch = 2; + + // Optional. Volume gain (in dB) of the normal native volume supported by the + // specific voice, in the range [-96.0, 16.0]. If unset, or set to a value of + // 0.0 (dB), will play at normal native signal amplitude. A value of -6.0 (dB) + // will play at approximately half the amplitude of the normal native signal + // amplitude. A value of +6.0 (dB) will play at approximately twice the + // amplitude of the normal native signal amplitude. We strongly recommend not + // to exceed +10 (dB) as there's usually no effective increase in loudness for + // any value greater than that. + double volume_gain_db = 3; + + // Optional. An identifier which selects 'audio effects' profiles that are + // applied on (post synthesized) text to speech. Effects are applied on top of + // each other in the order they are given. + repeated string effects_profile_id = 5; + + // Optional. The desired voice of the synthesized audio. + VoiceSelectionParams voice = 4; +} + +// Instructs the speech synthesizer how to generate the output audio content. +message OutputAudioConfig { + // Required. Audio encoding of the synthesized audio content. + OutputAudioEncoding audio_encoding = 1; + + // Optional. The synthesis sample rate (in hertz) for this audio. If not + // provided, then the synthesizer will use the default sample rate based on + // the audio encoding. If this is different from the voice's natural sample + // rate, then the synthesizer will honor this request by converting to the + // desired sample rate (which might result in worse audio quality). + int32 sample_rate_hertz = 2; + + // Optional. Configuration of how speech should be synthesized. + SynthesizeSpeechConfig synthesize_speech_config = 3; +} + +// Gender of the voice as described in +// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). +enum SsmlVoiceGender { + // An unspecified gender, which means that the client doesn't care which + // gender the selected voice will have. + SSML_VOICE_GENDER_UNSPECIFIED = 0; + + // A male voice. + SSML_VOICE_GENDER_MALE = 1; + + // A female voice. + SSML_VOICE_GENDER_FEMALE = 2; + + // A gender-neutral voice. + SSML_VOICE_GENDER_NEUTRAL = 3; +} + +// Audio encoding of the output audio format in Text-To-Speech. +enum OutputAudioEncoding { + // Not specified. + OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; + + // Uncompressed 16-bit signed little-endian samples (Linear PCM). + // Audio content returned as LINEAR16 also contains a WAV header. + OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; + + // MP3 audio. + OUTPUT_AUDIO_ENCODING_MP3 = 2; + + // Opus encoded audio wrapped in an ogg container. The result will be a + // file which can be played natively on Android, and in browsers (at least + // Chrome and Firefox). The quality of the encoding is considerably higher + // than MP3 while using approximately the same bitrate. + OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; +} diff --git a/google/cloud/dialogflow/v2beta1/context.proto b/google/cloud/dialogflow/v2beta1/context.proto index a777ef4f..336a6e37 100644 --- a/google/cloud/dialogflow/v2beta1/context.proto +++ b/google/cloud/dialogflow/v2beta1/context.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -117,12 +117,10 @@ service Contexts { message Context { // Required. The unique identifier of the context. Format: // `projects//agent/sessions//contexts/`, - // or - // `projects//agent/environments//users//sessions//contexts/`. Note: Environments and - // users are under construction and will be available soon. The Context ID is - // always converted to lowercase. If is not specified, we - // assume default 'draft' environment. If is not specified, we + // or `projects//agent/environments//users//sessions//contexts/`. The `Context ID` is + // always converted to lowercase. If `Environment ID` is not specified, we + // assume default 'draft' environment. If `User ID` is not specified, we // assume default '-' user. string name = 1; @@ -143,10 +141,9 @@ message ListContextsRequest { // Required. The session to list all contexts from. // Format: `projects//agent/sessions/` or // `projects//agent/environments//users//sessions/`. Note: Environments and users are under - // construction and will be available soon. If is not - // specified, we assume default 'draft' environment. If is not - // specified, we assume default '-' user. + // ID>/sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment. If `User ID` is not specified, we assume + // default '-' user. string parent = 1; // Optional. The maximum number of items to return in a single page. By @@ -173,10 +170,9 @@ message GetContextRequest { // Required. The name of the context. Format: // `projects//agent/sessions//contexts/` // or `projects//agent/environments//users//sessions//contexts/`. Note: Environments and - // users are under construction and will be available soon. If is not specified, we assume default 'draft' environment. If - // is not specified, we assume default '-' user. + // ID>/sessions//contexts/`. If `Environment ID` is + // not specified, we assume default 'draft' environment. If `User ID` is not + // specified, we assume default '-' user. string name = 1; } @@ -185,10 +181,9 @@ message CreateContextRequest { // Required. The session to create a context for. // Format: `projects//agent/sessions/` or // `projects//agent/environments//users//sessions/`. Note: Environments and users are under - // construction and will be available soon. If is not - // specified, we assume default 'draft' environment. If is not - // specified, we assume default '-' user. + // ID>/sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment. If `User ID` is not specified, we assume + // default '-' user. string parent = 1; // Required. The context to create. @@ -209,11 +204,9 @@ message DeleteContextRequest { // Required. The name of the context to delete. Format: // `projects//agent/sessions//contexts/` // or `projects//agent/environments//users//sessions//contexts/`. Note: Environments and - // users are under construction and will be available soon. If is not specified, we assume default 'draft' environment. If - // is not specified, we assume default - // '-' user. + // ID>/sessions//contexts/`. If `Environment ID` is + // not specified, we assume default 'draft' environment. If `User ID` is not + // specified, we assume default '-' user. string name = 1; } @@ -222,9 +215,7 @@ message DeleteAllContextsRequest { // Required. The name of the session to delete all contexts from. Format: // `projects//agent/sessions/` or `projects//agent/environments//users//sessions/`. Note: Environments and users are under construction and will be - // available soon. If is not specified we assume default - // 'draft' environment. If is not specified, we assume default - // '-' user. + // ID>`. If `Environment ID` is not specified we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. string parent = 1; } diff --git a/google/cloud/dialogflow/v2beta1/dialogflow_gapic.yaml b/google/cloud/dialogflow/v2beta1/dialogflow_gapic.yaml index bd9bc19a..5c1f1f92 100644 --- a/google/cloud/dialogflow/v2beta1/dialogflow_gapic.yaml +++ b/google/cloud/dialogflow/v2beta1/dialogflow_gapic.yaml @@ -195,7 +195,6 @@ interfaces: total_poll_timeout_millis: 300000 resource_name_treatment: STATIC_TYPES - name: RestoreAgent - required_fields: - parent request_object_method: true @@ -695,8 +694,6 @@ interfaces: entity_name: project_agent - name_pattern: projects/{project}/agent/intents/{intent} entity_name: intent - - name_pattern: projects/{project}/agents/{agent} - entity_name: agent # Definition for retryable codes. retry_codes_def: - name: idempotent @@ -861,7 +858,7 @@ interfaces: retry_codes_name: non_idempotent retry_params_name: default field_name_patterns: - parent: agent + parent: project_agent timeout_millis: 60000 long_running: return_type: google.cloud.dialogflow.v2beta1.BatchUpdateIntentsResponse @@ -884,7 +881,7 @@ interfaces: retry_codes_name: idempotent retry_params_name: default field_name_patterns: - parent: project + parent: project_agent timeout_millis: 60000 long_running: return_type: google.protobuf.Empty @@ -1157,6 +1154,338 @@ interfaces: retry_codes_name: non_idempotent retry_params_name: default timeout_millis: 220000 + # The fully qualified name of the API interface. +- name: google.cloud.dialogflow.v2beta1.KnowledgeBases + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + collections: + - name_pattern: projects/{project} + entity_name: project + - name_pattern: projects/{project}/knowledgeBases/{knowledge_base} + entity_name: knowledge_base + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + # A list of method configurations. + # Common properties: + # + # name - The simple name of the method. + # + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce method + # overloads which allow a client to directly pass request message fields as + # method parameters. This information may or may not be used, depending on + # the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request message. + # + # required_fields - Fields that are always required for a request to be + # valid. + # + # request_object_method - Turns on or off the generation of a method whose + # sole parameter is a request object. Not all languages will generate this + # method. + # + # resource_name_treatment - An enum that specifies how to treat the resource + # name formats defined in the field_name_patterns and + # response_field_name_patterns fields. + # UNSET: default value + # NONE: the collection configs will not be used by the generated code. + # VALIDATE: string fields will be validated by the client against the + # specified resource name formats. + # STATIC_TYPES: the client will use generated types for resource names. + # + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a paging + # list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It defines + # which fields match the paging pattern in the request. The request consists + # of a page_size_field and a token_field. The page_size_field is the name of + # the optional field specifying the maximum number of elements to be + # returned in the response. The token_field is the name of the field in the + # request containing the page token. + # The response specifies response information of the list method. It defines + # which fields match the paging pattern in the response. The response + # consists of a token_field and a resources_field. The token_field is the + # name of the field in the response containing the next page token. The + # resources_field is the name of the field in the response containing the + # list of resources belonging to the page. + # + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: ListKnowledgeBases + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: knowledge_bases + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: project + timeout_millis: 60000 + resource_name_treatment: STATIC_TYPES + - name: GetKnowledgeBase + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: knowledge_base + timeout_millis: 60000 + resource_name_treatment: STATIC_TYPES + - name: CreateKnowledgeBase + flattening: + groups: + - parameters: + - parent + - knowledge_base + required_fields: + - parent + - knowledge_base + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: project + timeout_millis: 60000 + resource_name_treatment: STATIC_TYPES + - name: DeleteKnowledgeBase + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: knowledge_base + timeout_millis: 60000 + resource_name_treatment: STATIC_TYPES + # The fully qualified name of the API interface. +- name: google.cloud.dialogflow.v2beta1.Documents + # A list of resource collection configurations. + # Consists of a name_pattern and an entity_name. + # The name_pattern is a pattern to describe the names of the resources of this + # collection, using the platform's conventions for URI patterns. A generator + # may use this to generate methods to compose and decompose such names. The + # pattern should use named placeholders as in `shelves/{shelf}/books/{book}`; + # those will be taken as hints for the parameter names of the generated + # methods. If empty, no name methods are generated. + # The entity_name is the name to be used as a basis for generated methods and + # classes. + collections: + - name_pattern: projects/{project}/knowledgeBases/{knowledge_base} + entity_name: knowledge_base + - name_pattern: projects/{project}/knowledgeBases/{knowledge_base}/documents/{document} + entity_name: document + # Definition for retryable codes. + retry_codes_def: + - name: idempotent + retry_codes: + - UNAVAILABLE + - DEADLINE_EXCEEDED + - name: non_idempotent + retry_codes: [] + # Definition for retry/backoff parameters. + retry_params_def: + - name: default + initial_retry_delay_millis: 100 + retry_delay_multiplier: 1.3 + max_retry_delay_millis: 60000 + initial_rpc_timeout_millis: 20000 + rpc_timeout_multiplier: 1 + max_rpc_timeout_millis: 20000 + total_timeout_millis: 600000 + # A list of method configurations. + # Common properties: + # + # name - The simple name of the method. + # + # flattening - Specifies the configuration for parameter flattening. + # Describes the parameter groups for which a generator should produce method + # overloads which allow a client to directly pass request message fields as + # method parameters. This information may or may not be used, depending on + # the target language. + # Consists of groups, which each represent a list of parameters to be + # flattened. Each parameter listed must be a field of the request message. + # + # required_fields - Fields that are always required for a request to be + # valid. + # + # request_object_method - Turns on or off the generation of a method whose + # sole parameter is a request object. Not all languages will generate this + # method. + # + # resource_name_treatment - An enum that specifies how to treat the resource + # name formats defined in the field_name_patterns and + # response_field_name_patterns fields. + # UNSET: default value + # NONE: the collection configs will not be used by the generated code. + # VALIDATE: string fields will be validated by the client against the + # specified resource name formats. + # STATIC_TYPES: the client will use generated types for resource names. + # + # page_streaming - Specifies the configuration for paging. + # Describes information for generating a method which transforms a paging + # list RPC into a stream of resources. + # Consists of a request and a response. + # The request specifies request information of the list method. It defines + # which fields match the paging pattern in the request. The request consists + # of a page_size_field and a token_field. The page_size_field is the name of + # the optional field specifying the maximum number of elements to be + # returned in the response. The token_field is the name of the field in the + # request containing the page token. + # The response specifies response information of the list method. It defines + # which fields match the paging pattern in the response. The response + # consists of a token_field and a resources_field. The token_field is the + # name of the field in the response containing the next page token. The + # resources_field is the name of the field in the response containing the + # list of resources belonging to the page. + # + # retry_codes_name - Specifies the configuration for retryable codes. The + # name must be defined in interfaces.retry_codes_def. + # + # retry_params_name - Specifies the configuration for retry/backoff + # parameters. The name must be defined in interfaces.retry_params_def. + # + # field_name_patterns - Maps the field name of the request type to + # entity_name of interfaces.collections. + # Specifies the string pattern that the field must follow. + # + # timeout_millis - Specifies the default timeout for a non-retrying call. If + # the call is retrying, refer to retry_params_name instead. + methods: + - name: ListDocuments + flattening: + groups: + - parameters: + - parent + required_fields: + - parent + request_object_method: true + page_streaming: + request: + page_size_field: page_size + token_field: page_token + response: + token_field: next_page_token + resources_field: documents + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + parent: knowledge_base + timeout_millis: 60000 + resource_name_treatment: STATIC_TYPES + - name: GetDocument + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: document + timeout_millis: 60000 + resource_name_treatment: STATIC_TYPES + - name: CreateDocument + flattening: + groups: + - parameters: + - parent + - document + required_fields: + - parent + - document + request_object_method: true + retry_codes_name: non_idempotent + retry_params_name: default + field_name_patterns: + parent: knowledge_base + timeout_millis: 60000 + long_running: + return_type: google.cloud.dialogflow.v2beta1.Document + metadata_type: google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + initial_poll_delay_millis: 500 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 5000 + total_poll_timeout_millis: 300000 + resource_name_treatment: STATIC_TYPES + - name: DeleteDocument + flattening: + groups: + - parameters: + - name + required_fields: + - name + request_object_method: false + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + name: document + timeout_millis: 60000 + long_running: + return_type: google.protobuf.Empty + metadata_type: google.cloud.dialogflow.v2beta1.KnowledgeOperationMetadata + initial_poll_delay_millis: 500 + poll_delay_multiplier: 1.5 + max_poll_delay_millis: 5000 + total_poll_timeout_millis: 300000 + resource_name_treatment: STATIC_TYPES resource_name_generation: - message_name: GetAgentRequest field_entity_map: @@ -1176,6 +1505,12 @@ resource_name_generation: - message_name: RestoreAgentRequest field_entity_map: parent: project +- message_name: CreateAogVersionRequest + field_entity_map: + parent: project +- message_name: WarmUpAogVersionRequest + field_entity_map: + parent: project - message_name: ListContextsRequest field_entity_map: parent: session @@ -1241,10 +1576,10 @@ resource_name_generation: name: intent - message_name: BatchUpdateIntentsRequest field_entity_map: - parent: agent + parent: project_agent - message_name: BatchDeleteIntentsRequest field_entity_map: - parent: project + parent: project_agent - message_name: ListSessionEntityTypesRequest field_entity_map: parent: session @@ -1263,3 +1598,33 @@ resource_name_generation: - message_name: DetectIntentRequest field_entity_map: session: session +- message_name: ListKnowledgeBasesRequest + field_entity_map: + parent: project +- message_name: GetKnowledgeBaseRequest + field_entity_map: + name: knowledge_base +- message_name: CreateKnowledgeBaseRequest + field_entity_map: + parent: project +- message_name: KnowledgeBase + field_entity_map: + name: knowledge_base +- message_name: DeleteKnowledgeBaseRequest + field_entity_map: + name: knowledge_base +- message_name: ListDocumentsRequest + field_entity_map: + parent: knowledge_base +- message_name: GetDocumentRequest + field_entity_map: + name: document +- message_name: CreateDocumentRequest + field_entity_map: + parent: knowledge_base +- message_name: Document + field_entity_map: + name: document +- message_name: DeleteDocumentRequest + field_entity_map: + name: document diff --git a/google/cloud/dialogflow/v2beta1/document.proto b/google/cloud/dialogflow/v2beta1/document.proto new file mode 100644 index 00000000..04c64260 --- /dev/null +++ b/google/cloud/dialogflow/v2beta1/document.proto @@ -0,0 +1,209 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "DocumentProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + + +// Manages documents of a knowledge base. +service Documents { + // Returns the list of all documents of the knowledge base. + rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents" + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" + } + }; + } + + // Retrieves the specified document. + rpc GetDocument(GetDocumentRequest) returns (Document) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + }; + } + + // Creates a new document. + // + // Operation + rpc CreateDocument(CreateDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*/knowledgeBases/*}/documents" + body: "document" + additional_bindings { + post: "/v2beta1/{parent=projects/*/agent/knowledgeBases/*}/documents" + body: "document" + } + }; + } + + // Deletes the specified document. + // + // Operation + rpc DeleteDocument(DeleteDocumentRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/knowledgeBases/*/documents/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/agent/knowledgeBases/*/documents/*}" + } + }; + } +} + +// A document resource. +message Document { + // The knowledge type of document content. + enum KnowledgeType { + // The type is unspecified or arbitrary. + KNOWLEDGE_TYPE_UNSPECIFIED = 0; + + // The document content contains question and answer pairs as either HTML or + // CSV. Typical FAQ HTML formats are parsed accurately, but unusual formats + // may fail to be parsed. + // + // CSV must have questions in the first column and answers in the second, + // with no header. Because of this explicit format, they are always parsed + // accurately. + FAQ = 1; + + // Documents for which unstructured text is extracted and used for + // question answering. + EXTRACTIVE_QA = 2; + } + + // The document resource name. + // The name must be empty when creating a document. + // Format: `projects//knowledgeBases//documents/`. + string name = 1; + + // Required. The display name of the document. The name must be 1024 bytes or + // less; otherwise, the creation request fails. + string display_name = 2; + + // Required. The MIME type of this document. + string mime_type = 3; + + // Required. The knowledge type of document content. + repeated KnowledgeType knowledge_types = 4; + + // Required. The source of this document. + oneof source { + // The URI where the file content is located. + // + // For documents stored in Google Cloud Storage, these URIs must have + // the form `gs:///`. + // + // NOTE: External URLs must correspond to public webpages, i.e., they must + // be indexed by Google Search. In particular, URLs for showing documents in + // Google Cloud Storage (i.e. the URL in your browser) are not supported. + // Instead use the `gs://` format URI described above. + string content_uri = 5; + + // The raw content of the document. This field is only permitted for + // EXTRACTIVE_QA and FAQ knowledge types. + string content = 6; + } +} + +// Request message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. +message ListDocumentsRequest { + // Required. The knowledge base to list all documents for. + // Format: `projects//knowledgeBases/`. + string parent = 1; + + // Optional. The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// Response message for [Documents.ListDocuments][google.cloud.dialogflow.v2beta1.Documents.ListDocuments]. +message ListDocumentsResponse { + // The list of documents. + repeated Document documents = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request message for [Documents.GetDocument][google.cloud.dialogflow.v2beta1.Documents.GetDocument]. +message GetDocumentRequest { + // Required. The name of the document to retrieve. + // Format `projects//knowledgeBases//documents/`. + string name = 1; +} + +// Request message for [Documents.CreateDocument][google.cloud.dialogflow.v2beta1.Documents.CreateDocument]. +message CreateDocumentRequest { + // Required. The knoweldge base to create a document for. + // Format: `projects//knowledgeBases/`. + string parent = 1; + + // Required. The document to create. + Document document = 2; +} + +// Request message for [Documents.DeleteDocument][google.cloud.dialogflow.v2beta1.Documents.DeleteDocument]. +message DeleteDocumentRequest { + // The name of the document to delete. + // Format: `projects//knowledgeBases//documents/`. + string name = 1; +} + +// Metadata in google::longrunning::Operation for Knowledge operations. +message KnowledgeOperationMetadata { + // States of the operation. + enum State { + // State unspecified. + STATE_UNSPECIFIED = 0; + + // The operation has been created. + PENDING = 1; + + // The operation is currently running. + RUNNING = 2; + + // The operation is done, either cancelled or completed. + DONE = 3; + } + + // Required. The current state of this operation. + State state = 1; +} diff --git a/google/cloud/dialogflow/v2beta1/entity_type.proto b/google/cloud/dialogflow/v2beta1/entity_type.proto index eb44197e..3d140f34 100644 --- a/google/cloud/dialogflow/v2beta1/entity_type.proto +++ b/google/cloud/dialogflow/v2beta1/entity_type.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/google/cloud/dialogflow/v2beta1/intent.proto b/google/cloud/dialogflow/v2beta1/intent.proto index c0309522..741dbd6f 100644 --- a/google/cloud/dialogflow/v2beta1/intent.proto +++ b/google/cloud/dialogflow/v2beta1/intent.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -233,8 +233,8 @@ message Intent { // Optional. The public URI to an image file. string image_uri = 1; - // Optional. A text description of the image to be used for accessibility, - // e.g., screen readers. + // A text description of the image to be used for accessibility, + // e.g., screen readers. Required if image_uri is set for CarouselSelect. string accessibility_text = 2; } @@ -410,6 +410,51 @@ message Intent { repeated string synonyms = 2; } + // Plays audio from a file in Telephony Gateway. + message TelephonyPlayAudio { + // Required. URI to a Google Cloud Storage object containing the audio to + // play, e.g., "gs://bucket/object". The object must contain a single + // channel (mono) of linear PCM audio (2 bytes / sample) at 8kHz. + // + // This object must be readable by the `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` service account + // where is the number of the Telephony Gateway project + // (usually the same as the Dialogflow agent project). If the Google Cloud + // Storage bucket is in the Telephony Gateway project, this permission is + // added by default when enabling the Dialogflow V2 API. + // + // For audio from other sources, consider using the + // `TelephonySynthesizeSpeech` message with SSML. + string audio_uri = 1; + } + + // Synthesizes speech and plays back the synthesized audio to the caller in + // Telephony Gateway. + // + // Telephony Gateway takes the synthesizer settings from + // `DetectIntentResponse.output_audio_config` which can either be set + // at request-level or can come from the agent-level synthesizer config. + message TelephonySynthesizeSpeech { + // Required. The source to be synthesized. + oneof source { + // The raw text to be synthesized. + string text = 1; + + // The SSML to be synthesized. For more information, see + // [SSML](https://developers.google.com/actions/reference/ssml). + string ssml = 2; + } + } + + // Transfers the call in Telephony Gateway. + message TelephonyTransferCall { + // Required. The phone number to transfer the call to + // in [E.164 format](https://en.wikipedia.org/wiki/E.164). + // + // We currently only allow transferring to US numbers (+1xxxyyyzzzz). + string phone_number = 1; + } + // Represents different platforms that a rich message can be intended for. enum Platform { // Not specified. @@ -498,6 +543,9 @@ message Intent { // } // } ACTIONS_ON_GOOGLE = 8; + + // Telephony Gateway. + TELEPHONY = 10; } // Required. The rich response message. @@ -536,6 +584,15 @@ message Intent { // Displays a carousel card for Actions on Google. CarouselSelect carousel_select = 12; + + // Plays audio from a file in Telephony Gateway. + TelephonyPlayAudio telephony_play_audio = 13; + + // Synthesizes speech in Telephony Gateway. + TelephonySynthesizeSpeech telephony_synthesize_speech = 14; + + // Transfers the call in Telephony Gateway. + TelephonyTransferCall telephony_transfer_call = 15; } // Optional. The platform that this message is intended for. @@ -590,13 +647,13 @@ message Intent { // taken into account during inference in `ML ONLY` match mode. Also, // auto-markup in the UI is turned off. // DEPRECATED! Please use `ml_disabled` field instead. - // NOTE: If neither `ml_enabled` nor `ml_disabled` field is set, then the - // default value is determined as follows: + // NOTE: If both `ml_enabled` and `ml_disabled` are either not set or false, + // then the default value is determined as follows: // - Before April 15th, 2018 the default is: // ml_enabled = false / ml_disabled = true. // - After April 15th, 2018 the default is: // ml_enabled = true / ml_disabled = false. - bool ml_enabled = 5; + bool ml_enabled = 5 [deprecated = true]; // Optional. Indicates whether Machine Learning is disabled for the intent. // Note: If `ml_disabled` setting is set to true, then this intent is not @@ -604,6 +661,11 @@ message Intent { // auto-markup in the UI is turned off. bool ml_disabled = 19; + // Optional. Indicates that this intent ends an interaction. Some integrations + // (e.g., Actions on Google or Dialogflow phone gateway) use this information + // to close interaction with an end user. Default is false. + bool end_interaction = 21; + // Optional. The list of context names required for this intent to be // triggered. // Format: `projects//agent/sessions/-/contexts/`. @@ -619,6 +681,7 @@ message Intent { repeated TrainingPhrase training_phrases = 9; // Optional. The name of the action associated with the intent. + // Note: The action name must not contain whitespaces. string action = 10; // Optional. The collection of contexts that are activated when the intent diff --git a/google/cloud/dialogflow/v2beta1/knowledge_base.proto b/google/cloud/dialogflow/v2beta1/knowledge_base.proto new file mode 100644 index 00000000..d53592b5 --- /dev/null +++ b/google/cloud/dialogflow/v2beta1/knowledge_base.proto @@ -0,0 +1,141 @@ +// Copyright 2018 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.dialogflow.v2beta1; + +import "google/api/annotations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow"; +option java_multiple_files = true; +option java_outer_classname = "KnowledgeBaseProto"; +option java_package = "com.google.cloud.dialogflow.v2beta1"; +option objc_class_prefix = "DF"; + + +// Manages knowledge bases. +// +// Allows users to setup and maintain knowledge bases with their knowledge data. +service KnowledgeBases { + // Returns the list of all knowledge bases of the specified agent. + rpc ListKnowledgeBases(ListKnowledgeBasesRequest) returns (ListKnowledgeBasesResponse) { + option (google.api.http) = { + get: "/v2beta1/{parent=projects/*}/knowledgeBases" + additional_bindings { + get: "/v2beta1/{parent=projects/*/agent}/knowledgeBases" + } + }; + } + + // Retrieves the specified knowledge base. + rpc GetKnowledgeBase(GetKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + get: "/v2beta1/{name=projects/*/knowledgeBases/*}" + additional_bindings { + get: "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" + } + }; + } + + // Creates a knowledge base. + rpc CreateKnowledgeBase(CreateKnowledgeBaseRequest) returns (KnowledgeBase) { + option (google.api.http) = { + post: "/v2beta1/{parent=projects/*}/knowledgeBases" + body: "knowledge_base" + additional_bindings { + post: "/v2beta1/{parent=projects/*/agent}/knowledgeBases" + body: "knowledge_base" + } + }; + } + + // Deletes the specified knowledge base. + rpc DeleteKnowledgeBase(DeleteKnowledgeBaseRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2beta1/{name=projects/*/knowledgeBases/*}" + additional_bindings { + delete: "/v2beta1/{name=projects/*/agent/knowledgeBases/*}" + } + }; + } +} + +// Represents knowledge base resource. +message KnowledgeBase { + // The knowledge base resource name. + // The name must be empty when creating a knowledge base. + // Format: `projects//knowledgeBases/`. + string name = 1; + + // Required. The display name of the knowledge base. The name must be 1024 + // bytes or less; otherwise, the creation request fails. + string display_name = 2; +} + +// Request message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesRequest { + // Required. The agent to list of knowledge bases for. + // Format: `projects//agent`. + string parent = 1; + + // Optional. The maximum number of items to return in a single page. By + // default 10 and at most 100. + int32 page_size = 2; + + // Optional. The next_page_token value returned from a previous list request. + string page_token = 3; +} + +// Response message for [KnowledgeBases.ListKnowledgeBases][google.cloud.dialogflow.v2beta1.KnowledgeBases.ListKnowledgeBases]. +message ListKnowledgeBasesResponse { + // The list of knowledge bases. + repeated KnowledgeBase knowledge_bases = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results in the list. + string next_page_token = 2; +} + +// Request message for [KnowledgeBase.GetDocument][]. +message GetKnowledgeBaseRequest { + // Required. The name of the knowledge base to retrieve. + // Format `projects//knowledgeBases/`. + string name = 1; +} + +// Request message for [KnowledgeBases.CreateKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.CreateKnowledgeBase]. +message CreateKnowledgeBaseRequest { + // Required. The agent to create a knowledge base for. + // Format: `projects//agent`. + string parent = 1; + + // Required. The knowledge base to create. + KnowledgeBase knowledge_base = 2; +} + +// Request message for [KnowledgeBases.DeleteKnowledgeBase][google.cloud.dialogflow.v2beta1.KnowledgeBases.DeleteKnowledgeBase]. +message DeleteKnowledgeBaseRequest { + // Required. The name of the knowledge base to delete. + // Format: `projects//knowledgeBases/`. + string name = 1; + + // Optional. Force deletes the knowledge base. When set to true, any documents + // in the knowledge base are also deleted. + bool force = 2; +} diff --git a/google/cloud/dialogflow/v2beta1/session.proto b/google/cloud/dialogflow/v2beta1/session.proto index 489c2b9a..69cd4868 100644 --- a/google/cloud/dialogflow/v2beta1/session.proto +++ b/google/cloud/dialogflow/v2beta1/session.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ syntax = "proto3"; package google.cloud.dialogflow.v2beta1; import "google/api/annotations.proto"; +import "google/cloud/dialogflow/v2beta1/audio_config.proto"; import "google/cloud/dialogflow/v2beta1/context.proto"; import "google/cloud/dialogflow/v2beta1/intent.proto"; import "google/cloud/dialogflow/v2beta1/session_entity_type.proto"; @@ -56,7 +57,8 @@ service Sessions { // Processes a natural language query in audio format in a streaming fashion // and returns structured, actionable data as a result. This method is only // available via the gRPC API (not REST). - rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse); + rpc StreamingDetectIntent(stream StreamingDetectIntentRequest) returns (stream StreamingDetectIntentResponse) { + } } // The request to detect user's intent. @@ -64,13 +66,12 @@ message DetectIntentRequest { // Required. The name of the session this query is sent to. Format: // `projects//agent/sessions/`, or // `projects//agent/environments//users//sessions/`. Note: Environments and users are under - // construction and will be available soon. If is not - // specified, we assume default 'draft' environment. If is not - // specified, we are using "-". It’s up to the API caller to choose an - // appropriate . and . They can be a random numbers or - // some type of user and session identifiers (preferably hashed). The length - // of the and must not exceed 36 characters. + // ID>/sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment. If `User ID` is not specified, we are using + // "-". It’s up to the API caller to choose an appropriate `Session ID` and + // `User Id`. They can be a random numbers or some type of user and session + // identifiers (preferably hashed). The length of the `Session ID` and + // `User ID` must not exceed 36 characters. string session = 1; // Optional. The parameters of this query. @@ -86,6 +87,11 @@ message DetectIntentRequest { // 3. an event that specifies which intent to trigger. QueryInput query_input = 3; + // Optional. Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 4; + // Optional. The natural language speech audio to be processed. This field // should be populated iff `query_input` is set to an input audio config. // A single request can contain up to 1 minute of speech audio data. @@ -98,12 +104,30 @@ message DetectIntentResponse { // locate a response in the training example set or for reporting issues. string response_id = 1; - // The results of the conversational query or event processing. + // The selected results of the conversational query or event processing. + // See `alternative_query_results` for additional potential results. QueryResult query_result = 2; + // If Knowledge Connectors are enabled, there could be more than one result + // returned for a given query or event and this field will contain all results + // except for the top one which is captured in query_result. The alternative + // results are ordered by decreasing + // `QueryResult.intent_detection_confidence`. If Knowledge Connectors are + // disabled this field will be empty at which point those additional results + // will be surfaced here. + repeated QueryResult alternative_query_results = 5; + // Specifies the status of the webhook request. `webhook_status` // is never populated in webhook requests. google.rpc.Status webhook_status = 3; + + // The audio data bytes encoded as specified in the request. + bytes output_audio = 4; + + // Instructs the speech synthesizer how to generate the output audio. This + // field is populated from the agent-level speech synthesizer configuration, + // if enabled. + OutputAudioConfig output_audio_config = 6; } // Represents the parameters of the conversational query. @@ -133,6 +157,21 @@ message QueryParameters { // Optional. This field can be used to pass custom data into the webhook // associated with the agent. Arbitrary JSON objects are supported. google.protobuf.Struct payload = 6; + + // Optional. KnowledgeBases to get alternative results from. If not set, the + // KnowledgeBases enabled in the agent (through UI) will be used. + // Format: `projects//knowledgeBases/`. + // + // Note: This field is `repeated` for forward compatibility, currently only + // the first one is supported, we may return an error if multiple + // KnowledgeBases are specified. + repeated string knowledge_base_names = 12; + + // Optional. Configures the type of sentiment analysis to perform. If not + // provided, sentiment analysis is not performed. + // Note: Sentiment Analysis is only currently available for Enterprise Edition + // agents. + SentimentAnalysisRequestConfig sentiment_analysis_request_config = 10; } // Represents the query input. It can contain either: @@ -178,10 +217,10 @@ message QueryResult { // correct. The default of 0.0 is a sentinel value indicating that confidence // was not set. // - // You should not rely on this field as it isn't guaranteed to be accurate, or - // even set. In particular this field isn't set in Webhook calls and for - // StreamingDetectIntent since the streaming endpoint has separate confidence - // estimates per portion of the audio in StreamingRecognitionResult. + // This field is not guaranteed to be accurate or set. In particular this + // field isn't set for StreamingDetectIntent since the streaming endpoint has + // separate confidence estimates per portion of the audio in + // StreamingRecognitionResult. float speech_recognition_confidence = 2; // The action name from the matched intent. @@ -224,11 +263,77 @@ message QueryResult { // The intent detection confidence. Values range from 0.0 // (completely uncertain) to 1.0 (completely certain). + // If there are `multiple knowledge_answers` messages, this value is set to + // the greatest `knowledgeAnswers.match_confidence` value in the list. float intent_detection_confidence = 12; // The free-form diagnostic info. For example, this field // could contain webhook call latency. google.protobuf.Struct diagnostic_info = 14; + + // The sentiment analysis result, which depends on the + // `sentiment_analysis_request_config` specified in the request. + SentimentAnalysisResult sentiment_analysis_result = 17; + + // The result from Knowledge Connector (if any), ordered by decreasing + // `KnowledgeAnswers.match_confidence`. + KnowledgeAnswers knowledge_answers = 18; +} + +// Represents the result of querying a Knowledge base. +message KnowledgeAnswers { + // An answer from Knowledge Connector. + message Answer { + // Represents the system's confidence that this knowledge answer is a good + // match for this conversational query. + enum MatchConfidenceLevel { + // Not specified. + MATCH_CONFIDENCE_LEVEL_UNSPECIFIED = 0; + + // Indicates that the confidence is low. + LOW = 1; + + // Indicates our confidence is medium. + MEDIUM = 2; + + // Indicates our confidence is high. + HIGH = 3; + } + + // Indicates which Knowledge Document this answer was extracted from. + // Format: `projects//knowledgeBases//documents/`. + string source = 1; + + // The corresponding FAQ question if the answer was extracted from a FAQ + // Document, empty otherwise. + string faq_question = 2; + + // The piece of text from the `source` knowledge base document that answers + // this conversational query. + string answer = 3; + + // The system's confidence level that this knowledge answer is a good match + // for this conversational query. + // NOTE: The confidence level for a given `` pair may change + // without notice, as it depends on models that are constantly being + // improved. However, it will change less frequently than the confidence + // score below, and should be preferred for referencing the quality of an + // answer. + MatchConfidenceLevel match_confidence_level = 4; + + // The system's confidence score that this Knowledge answer is a good match + // for this converstational query, range from 0.0 (completely uncertain) + // to 1.0 (completely certain). + // Note: The confidence score is likely to vary somewhat (possibly even for + // identical requests), as the underlying model is under constant + // improvement, we may deprecate it in the future. We recommend using + // `match_confidence_level` which should be generally more stable. + float match_confidence = 5; + } + + // A list of answers from Knowledge Connector. + repeated Answer answers = 1; } // The top-level message sent by the client to the @@ -237,7 +342,9 @@ message QueryResult { // Multiple request messages should be sent in order: // // 1. The first message must contain `session`, `query_input` plus optionally -// `query_params` and/or `single_utterance`. The message must not contain `input_audio`. +// `query_params` and/or `single_utterance`. If the client wants to receive +// an audio response, it should also contain `output_audio_config`. +// The message must not contain `input_audio`. // // 2. If `query_input` was set to a streaming input audio config, // all subsequent messages must contain only `input_audio`. @@ -247,13 +354,12 @@ message StreamingDetectIntentRequest { // Format of the session name: // `projects//agent/sessions/`, or // `projects//agent/environments//users//sessions/`. Note: Environments and users are under - // construction and will be available soon. If is not - // specified, we assume default 'draft' environment. If is not - // specified, we are using "-". It’s up to the API caller to choose an - // appropriate . and . They can be a random numbers or - // some type of user and session identifiers (preferably hashed). The length - // of the and must not exceed 36 characters. + // ID>/sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment. If `User ID` is not specified, we are using + // "-". It’s up to the API caller to choose an appropriate `Session ID` and + // `User Id`. They can be a random numbers or some type of user and session + // identifiers (preferably hashed). The length of the `Session ID` and + // `User ID` must not exceed 36 characters. string session = 1; // Optional. The parameters of this query. @@ -279,6 +385,11 @@ message StreamingDetectIntentRequest { // This setting is ignored when `query_input` is a piece of text or an event. bool single_utterance = 4; + // Optional. Instructs the speech synthesizer how to generate the output + // audio. If this field is not set and agent-level speech synthesizer is not + // configured, no output audio is generated. + OutputAudioConfig output_audio_config = 5; + // Optional. The input audio content to be recognized. Must be sent if // `query_input` was set to a streaming input audio config. The complete audio // over all streaming messages must not exceed 1 minute. @@ -295,8 +406,13 @@ message StreamingDetectIntentRequest { // complete transcript of what the user said. The last `recognition_result` // has `is_final` set to `true`. // -// 2. The next message contains `response_id`, `query_result` -// and optionally `webhook_status` if a WebHook was called. +// 2. The next message contains `response_id`, `query_result`, +// `alternative_query_results` and optionally `webhook_status` if a WebHook +// was called. +// +// 3. If `output_audio_config` was specified in the request or agent-level +// speech synthesizer is configured, all subsequent messages contain +// `output_audio` and `output_audio_config`. message StreamingDetectIntentResponse { // The unique identifier of the response. It can be used to // locate a response in the training example set or for reporting issues. @@ -305,11 +421,29 @@ message StreamingDetectIntentResponse { // The result of speech recognition. StreamingRecognitionResult recognition_result = 2; - // The result of the conversational query or event processing. + // The selected results of the conversational query or event processing. + // See `alternative_query_results` for additional potential results. QueryResult query_result = 3; + // If Knowledge Connectors are enabled, there could be more than one result + // returned for a given query or event and this field will contain all results + // except for the top one which is captured in query_result. The alternative + // results are ordered by decreasing + // `QueryResult.intent_detection_confidence`. If Knowledge Connectors are + // disabled this field will be empty at which point those additional results + // will be surfaced here. + repeated QueryResult alternative_query_results = 7; + // Specifies the status of the webhook request. google.rpc.Status webhook_status = 4; + + // The audio data bytes encoded as specified in the request. + bytes output_audio = 5; + + // Instructs the speech synthesizer how to generate the output audio. This + // field is populated from the agent-level speech synthesizer configuration, + // if enabled. + OutputAudioConfig output_audio_config = 6; } // Contains a speech recognition result corresponding to a portion of the audio @@ -394,8 +528,10 @@ message InputAudioConfig { AudioEncoding audio_encoding = 1; // Required. Sample rate (in Hertz) of the audio content sent in the query. - // Refer to [Cloud Speech API documentation](/speech/docs/basics) for more - // details. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics) for + // more details. int32 sample_rate_hertz = 2; // Required. The language of the supplied audio. Dialogflow does not do @@ -407,9 +543,24 @@ message InputAudioConfig { // Optional. The collection of phrase hints which are used to boost accuracy // of speech recognition. - // Refer to [Cloud Speech API documentation](/speech/docs/basics#phrase-hints) + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) // for more details. repeated string phrase_hints = 4; + + // Optional. Which Speech model to select for the given request. Select the + // model best suited to your domain to get best results. If a model is not + // explicitly specified, then we auto-select a model based on the parameters + // in the InputAudioConfig. + // If enhanced speech model is enabled for the agent and an enhanced + // version of the specified model for the language does not exist, then the + // speech is recognized using the standard version of the specified model. + // Refer to + // [Cloud Speech API + // documentation](https://cloud.google.com/speech-to-text/docs/basics#select-model) + // for more details. + string model = 7; } // Represents the natural language text to be processed. @@ -444,8 +595,37 @@ message EventInput { string language_code = 3; } +// Configures the types of sentiment analysis to perform. +message SentimentAnalysisRequestConfig { + // Optional. Instructs the service to perform sentiment analysis on + // `query_text`. If not provided, sentiment analysis is not performed on + // `query_text`. + bool analyze_query_text_sentiment = 1; +} + +// The result of sentiment analysis as configured by +// `sentiment_analysis_request_config`. +message SentimentAnalysisResult { + // The sentiment analysis result for `query_text`. + Sentiment query_text_sentiment = 1; +} + +// The sentiment, such as positive/negative feeling or association, for a unit +// of analysis, such as the query text. +message Sentiment { + // Sentiment score between -1.0 (negative sentiment) and 1.0 (positive + // sentiment). + float score = 1; + + // A non-negative number in the [0, +inf) range, which represents the absolute + // magnitude of sentiment, regardless of score (positive or negative). + float magnitude = 2; +} + // Audio encoding of the audio content sent in the conversational query request. -// Refer to the [Cloud Speech API documentation](/speech/docs/basics) for more +// Refer to the +// [Cloud Speech API +// documentation](https://cloud.google.com/speech-to-text/docs/basics) for more // details. enum AudioEncoding { // Not specified. diff --git a/google/cloud/dialogflow/v2beta1/session_entity_type.proto b/google/cloud/dialogflow/v2beta1/session_entity_type.proto index 2c36ee3b..f4531215 100644 --- a/google/cloud/dialogflow/v2beta1/session_entity_type.proto +++ b/google/cloud/dialogflow/v2beta1/session_entity_type.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -128,11 +128,9 @@ message SessionEntityType { // `projects//agent/sessions//entityTypes/`, or // `projects//agent/environments//users//sessions - // //entityTypes/`. - // Note: Environments and users are under construction and will be available - // soon. If is not specified, we assume default 'draft' - // environment. If is not specified, we assume default '-' user. + // ID>/sessions//entityTypes/`. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. string name = 1; // Required. Indicates whether the additional data should override or @@ -150,9 +148,8 @@ message ListSessionEntityTypesRequest { // Format: `projects//agent/sessions/` or // `projects//agent/environments//users// // sessions/`. - // Note: Environments and users are under construction and will be available - // soon. If is not specified, we assume default 'draft' - // environment. If is not specified, we assume default '-' user. + // If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. string parent = 1; // Optional. The maximum number of items to return in a single page. By @@ -179,11 +176,9 @@ message GetSessionEntityTypeRequest { // Required. The name of the session entity type. Format: // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions// - // entityTypes/`. - // Note: Environments and users re under construction and will be available - // soon. If is not specified, we assume default 'draft' - // environment. If is not specified, we assume default '-' user. + // ID>/users//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. string name = 1; } @@ -192,10 +187,9 @@ message CreateSessionEntityTypeRequest { // Required. The session to create a session entity type for. // Format: `projects//agent/sessions/` or // `projects//agent/environments//users// - // sessions/`. - // Note: Environments and users are under construction and will be available - // soon. If is not specified, we assume default 'draft' - // environment. If is not specified, we assume default '-' user. + // sessions/`. If `Environment ID` is not specified, we assume + // default 'draft' environment. If `User ID` is not specified, we assume + // default '-' user. string parent = 1; // Required. The session entity type to create. @@ -208,10 +202,8 @@ message UpdateSessionEntityTypeRequest { // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. - // Note: Environments and users are under construction and will be available - // soon. If is not specified, we assume default 'draft' - // environment. If is not specified, we assume default '-' user. + // Name>`. If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. SessionEntityType session_entity_type = 1; // Optional. The mask to control which fields get updated. @@ -224,9 +216,7 @@ message DeleteSessionEntityTypeRequest { // `projects//agent/sessions//entityTypes/` or `projects//agent/environments//users//sessions//entityTypes/`. - // Note: Environments and users are under construction and will be available - // soon. If is not specified, we assume default 'draft' - // environment. If is not specified, we assume default '-' user. + // Name>`. If `Environment ID` is not specified, we assume default 'draft' + // environment. If `User ID` is not specified, we assume default '-' user. string name = 1; } diff --git a/google/cloud/dialogflow/v2beta1/webhook.proto b/google/cloud/dialogflow/v2beta1/webhook.proto index e19ce835..933f28a8 100644 --- a/google/cloud/dialogflow/v2beta1/webhook.proto +++ b/google/cloud/dialogflow/v2beta1/webhook.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -46,6 +46,9 @@ message WebhookRequest { // same value as `[Streaming]DetectIntentResponse.query_result`. QueryResult query_result = 2; + // Alternative query results from KnowledgeService. + repeated QueryResult alternative_query_results = 5; + // Optional. The contents of the original request that was passed to // `[Streaming]DetectIntent` call. OriginalDetectIntentRequest original_detect_intent_request = 3; @@ -96,6 +99,11 @@ message WebhookResponse { // Optional. Makes the platform immediately invoke another `DetectIntent` call // internally with the specified event as input. EventInput followup_event_input = 6; + + // Optional. Indicates that this intent ends an interaction. Some integrations + // (e.g., Actions on Google or Dialogflow phone gateway) use this information + // to close interaction with an end user. Default is false. + bool end_interaction = 8; } // Represents the contents of the original request that was passed to @@ -105,7 +113,24 @@ message OriginalDetectIntentRequest { // by Dialogflow-owned servers. string source = 1; + // Optional. The version of the protocol used for this request. + // This field is AoG-specific. + string version = 2; + // Optional. This field is set to the value of `QueryParameters.payload` field // passed in the request. + // + // This field is used for the telephony gateway. It should have a + // structure similar to this JSON message: + //
{
+  //  "telephony": {
+  //    "caller_id": "+18558363987"
+  //  }
+  // }
+ // Note: The caller ID field (`caller_id`) will be in + // [E.164 format](https://en.wikipedia.org/wiki/E.164) and is only supported + // for Enterprise Edition and not for Standard Edition agents. When the + // telephony gateway is used with a standard tier agent the `caller_id` field + // above will have a value of `REDACTED_IN_STANDARD_TIER_AGENT`. google.protobuf.Struct payload = 3; }