1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.cloud.dialogflow.cx.v3; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/protobuf/empty.proto"; 24import "google/protobuf/field_mask.proto"; 25 26option cc_enable_arenas = true; 27option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3"; 28option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb"; 29option java_multiple_files = true; 30option java_outer_classname = "IntentProto"; 31option java_package = "com.google.cloud.dialogflow.cx.v3"; 32option objc_class_prefix = "DF"; 33option ruby_package = "Google::Cloud::Dialogflow::CX::V3"; 34 35// Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent]. 36service Intents { 37 option (google.api.default_host) = "dialogflow.googleapis.com"; 38 option (google.api.oauth_scopes) = 39 "https://www.googleapis.com/auth/cloud-platform," 40 "https://www.googleapis.com/auth/dialogflow"; 41 42 // Returns the list of all intents in the specified agent. 43 rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { 44 option (google.api.http) = { 45 get: "/v3/{parent=projects/*/locations/*/agents/*}/intents" 46 }; 47 option (google.api.method_signature) = "parent"; 48 } 49 50 // Retrieves the specified intent. 51 rpc GetIntent(GetIntentRequest) returns (Intent) { 52 option (google.api.http) = { 53 get: "/v3/{name=projects/*/locations/*/agents/*/intents/*}" 54 }; 55 option (google.api.method_signature) = "name"; 56 } 57 58 // Creates an intent in the specified agent. 59 // 60 // Note: You should always train a flow prior to sending it queries. See the 61 // [training 62 // documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 63 rpc CreateIntent(CreateIntentRequest) returns (Intent) { 64 option (google.api.http) = { 65 post: "/v3/{parent=projects/*/locations/*/agents/*}/intents" 66 body: "intent" 67 }; 68 option (google.api.method_signature) = "parent,intent"; 69 } 70 71 // Updates the specified intent. 72 // 73 // Note: You should always train a flow prior to sending it queries. See the 74 // [training 75 // documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 76 rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { 77 option (google.api.http) = { 78 patch: "/v3/{intent.name=projects/*/locations/*/agents/*/intents/*}" 79 body: "intent" 80 }; 81 option (google.api.method_signature) = "intent,update_mask"; 82 } 83 84 // Deletes the specified intent. 85 // 86 // Note: You should always train a flow prior to sending it queries. See the 87 // [training 88 // documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 89 rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { 90 option (google.api.http) = { 91 delete: "/v3/{name=projects/*/locations/*/agents/*/intents/*}" 92 }; 93 option (google.api.method_signature) = "name"; 94 } 95} 96 97// An intent represents a user's intent to interact with a conversational agent. 98// 99// You can provide information for the Dialogflow API to use to match user input 100// to an intent by adding training phrases (i.e., examples of user input) to 101// your intent. 102message Intent { 103 option (google.api.resource) = { 104 type: "dialogflow.googleapis.com/Intent" 105 pattern: "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}" 106 }; 107 108 // Represents an example that the agent is trained on to identify the intent. 109 message TrainingPhrase { 110 // Represents a part of a training phrase. 111 message Part { 112 // Required. The text for this part. 113 string text = 1 [(google.api.field_behavior) = REQUIRED]; 114 115 // The [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] used to 116 // annotate this part of the training phrase. This field is required for 117 // annotated parts of the training phrase. 118 string parameter_id = 2; 119 } 120 121 // Output only. The unique identifier of the training phrase. 122 string id = 1; 123 124 // Required. The ordered list of training phrase parts. 125 // The parts are concatenated in order to form the training phrase. 126 // 127 // Note: The API does not automatically annotate training phrases like the 128 // Dialogflow Console does. 129 // 130 // Note: Do not forget to include whitespace at part boundaries, so the 131 // training phrase is well formatted when the parts are concatenated. 132 // 133 // If the training phrase does not need to be annotated with parameters, 134 // you just need a single part with only the 135 // [Part.text][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part.text] 136 // field set. 137 // 138 // If you want to annotate the training phrase, you must create multiple 139 // parts, where the fields of each part are populated in one of two ways: 140 // 141 // - `Part.text` is set to a part of the phrase that has no parameters. 142 // - `Part.text` is set to a part of the phrase that you want to annotate, 143 // and the `parameter_id` field is set. 144 repeated Part parts = 2 [(google.api.field_behavior) = REQUIRED]; 145 146 // Indicates how many times this example was added to the intent. 147 int32 repeat_count = 3; 148 } 149 150 // Represents an intent parameter. 151 message Parameter { 152 // Required. The unique identifier of the parameter. This field 153 // is used by [training 154 // phrases][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase] to annotate 155 // their [parts][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part]. 156 string id = 1 [(google.api.field_behavior) = REQUIRED]; 157 158 // Required. The entity type of the parameter. 159 // Format: `projects/-/locations/-/agents/-/entityTypes/<System Entity Type 160 // ID>` for system entity types (for example, 161 // `projects/-/locations/-/agents/-/entityTypes/sys.date`), or 162 // `projects/<Project ID>/locations/<Location ID>/agents/<Agent 163 // ID>/entityTypes/<Entity Type ID>` for developer entity types. 164 string entity_type = 2 [ 165 (google.api.field_behavior) = REQUIRED, 166 (google.api.resource_reference) = { 167 type: "dialogflow.googleapis.com/EntityType" 168 } 169 ]; 170 171 // Indicates whether the parameter represents a list of values. 172 bool is_list = 3; 173 174 // Indicates whether the parameter content should be redacted in log. If 175 // redaction is enabled, the parameter content will be replaced by parameter 176 // name during logging. 177 // Note: the parameter content is subject to redaction if either parameter 178 // level redaction or [entity type level 179 // redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. 180 bool redact = 4; 181 } 182 183 // The unique identifier of the intent. 184 // Required for the 185 // [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3.Intents.UpdateIntent] 186 // method. 187 // [Intents.CreateIntent][google.cloud.dialogflow.cx.v3.Intents.CreateIntent] 188 // populates the name automatically. 189 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 190 // ID>/intents/<Intent ID>`. 191 string name = 1; 192 193 // Required. The human-readable name of the intent, unique within the agent. 194 string display_name = 2 [(google.api.field_behavior) = REQUIRED]; 195 196 // The collection of training phrases the agent is trained on to identify the 197 // intent. 198 repeated TrainingPhrase training_phrases = 3; 199 200 // The collection of parameters associated with the intent. 201 repeated Parameter parameters = 4; 202 203 // The priority of this intent. Higher numbers represent higher 204 // priorities. 205 // 206 // - If the supplied value is unspecified or 0, the service 207 // translates the value to 500,000, which corresponds to the 208 // `Normal` priority in the console. 209 // - If the supplied value is negative, the intent is ignored 210 // in runtime detect intent requests. 211 int32 priority = 5; 212 213 // Indicates whether this is a fallback intent. Currently only default 214 // fallback intent is allowed in the agent, which is added upon agent 215 // creation. 216 // Adding training phrases to fallback intent is useful in the case of 217 // requests that are mistakenly matched, since training phrases assigned to 218 // fallback intents act as negative examples that triggers no-match event. 219 bool is_fallback = 6; 220 221 // The key/value metadata to label an intent. Labels can contain 222 // lowercase letters, digits and the symbols '-' and '_'. International 223 // characters are allowed, including letters from unicase alphabets. Keys must 224 // start with a letter. Keys and values can be no longer than 63 characters 225 // and no more than 128 bytes. 226 // 227 // Prefix "sys-" is reserved for Dialogflow defined labels. Currently allowed 228 // Dialogflow defined labels include: 229 // * sys-head 230 // * sys-contextual 231 // The above labels do not require value. "sys-head" means the intent is a 232 // head intent. "sys.contextual" means the intent is a contextual intent. 233 map<string, string> labels = 7; 234 235 // Human readable description for better understanding an intent like its 236 // scope, content, result etc. Maximum character limit: 140 characters. 237 string description = 8; 238} 239 240// The request message for 241// [Intents.ListIntents][google.cloud.dialogflow.cx.v3.Intents.ListIntents]. 242message ListIntentsRequest { 243 // Required. The agent to list all intents for. 244 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. 245 string parent = 1 [ 246 (google.api.field_behavior) = REQUIRED, 247 (google.api.resource_reference) = { 248 child_type: "dialogflow.googleapis.com/Intent" 249 } 250 ]; 251 252 // The language to list intents for. The following fields are language 253 // dependent: 254 // 255 // * `Intent.training_phrases.parts.text` 256 // 257 // If not specified, the agent's default language is used. 258 // [Many 259 // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 260 // are supported. 261 // Note: languages must be enabled in the agent before they can be used. 262 string language_code = 2; 263 264 // The resource view to apply to the returned intent. 265 IntentView intent_view = 5; 266 267 // The maximum number of items to return in a single page. By default 100 and 268 // at most 1000. 269 int32 page_size = 3; 270 271 // The next_page_token value returned from a previous list request. 272 string page_token = 4; 273} 274 275// The response message for 276// [Intents.ListIntents][google.cloud.dialogflow.cx.v3.Intents.ListIntents]. 277message ListIntentsResponse { 278 // The list of intents. There will be a maximum number of items returned based 279 // on the page_size field in the request. 280 repeated Intent intents = 1; 281 282 // Token to retrieve the next page of results, or empty if there are no more 283 // results in the list. 284 string next_page_token = 2; 285} 286 287// The request message for 288// [Intents.GetIntent][google.cloud.dialogflow.cx.v3.Intents.GetIntent]. 289message GetIntentRequest { 290 // Required. The name of the intent. 291 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 292 // ID>/intents/<Intent ID>`. 293 string name = 1 [ 294 (google.api.field_behavior) = REQUIRED, 295 (google.api.resource_reference) = { 296 type: "dialogflow.googleapis.com/Intent" 297 } 298 ]; 299 300 // The language to retrieve the intent for. The following fields are language 301 // dependent: 302 // 303 // * `Intent.training_phrases.parts.text` 304 // 305 // If not specified, the agent's default language is used. 306 // [Many 307 // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 308 // are supported. 309 // Note: languages must be enabled in the agent before they can be used. 310 string language_code = 2; 311} 312 313// The request message for 314// [Intents.CreateIntent][google.cloud.dialogflow.cx.v3.Intents.CreateIntent]. 315message CreateIntentRequest { 316 // Required. The agent to create an intent for. 317 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. 318 string parent = 1 [ 319 (google.api.field_behavior) = REQUIRED, 320 (google.api.resource_reference) = { 321 child_type: "dialogflow.googleapis.com/Intent" 322 } 323 ]; 324 325 // Required. The intent to create. 326 Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; 327 328 // The language of the following fields in `intent`: 329 // 330 // * `Intent.training_phrases.parts.text` 331 // 332 // If not specified, the agent's default language is used. 333 // [Many 334 // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 335 // are supported. 336 // Note: languages must be enabled in the agent before they can be used. 337 string language_code = 3; 338} 339 340// The request message for 341// [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3.Intents.UpdateIntent]. 342message UpdateIntentRequest { 343 // Required. The intent to update. 344 Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; 345 346 // The language of the following fields in `intent`: 347 // 348 // * `Intent.training_phrases.parts.text` 349 // 350 // If not specified, the agent's default language is used. 351 // [Many 352 // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 353 // are supported. 354 // Note: languages must be enabled in the agent before they can be used. 355 string language_code = 2; 356 357 // The mask to control which fields get updated. If the mask is not present, 358 // all fields will be updated. 359 google.protobuf.FieldMask update_mask = 3; 360} 361 362// The request message for 363// [Intents.DeleteIntent][google.cloud.dialogflow.cx.v3.Intents.DeleteIntent]. 364message DeleteIntentRequest { 365 // Required. The name of the intent to delete. 366 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 367 // ID>/intents/<Intent ID>`. 368 string name = 1 [ 369 (google.api.field_behavior) = REQUIRED, 370 (google.api.resource_reference) = { 371 type: "dialogflow.googleapis.com/Intent" 372 } 373 ]; 374} 375 376// Represents the options for views of an intent. 377// An intent can be a sizable object. Therefore, we provide a resource view that 378// does not return training phrases in the response. 379enum IntentView { 380 // Not specified. Treated as INTENT_VIEW_FULL. 381 INTENT_VIEW_UNSPECIFIED = 0; 382 383 // Training phrases field is not populated in the response. 384 INTENT_VIEW_PARTIAL = 1; 385 386 // All fields are populated. 387 INTENT_VIEW_FULL = 2; 388} 389