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/cloud/dialogflow/cx/v3/inline.proto"; 24import "google/longrunning/operations.proto"; 25import "google/protobuf/empty.proto"; 26import "google/protobuf/field_mask.proto"; 27 28option cc_enable_arenas = true; 29option csharp_namespace = "Google.Cloud.Dialogflow.Cx.V3"; 30option go_package = "cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb"; 31option java_multiple_files = true; 32option java_outer_classname = "IntentProto"; 33option java_package = "com.google.cloud.dialogflow.cx.v3"; 34option objc_class_prefix = "DF"; 35option ruby_package = "Google::Cloud::Dialogflow::CX::V3"; 36 37// Service for managing [Intents][google.cloud.dialogflow.cx.v3.Intent]. 38service Intents { 39 option (google.api.default_host) = "dialogflow.googleapis.com"; 40 option (google.api.oauth_scopes) = 41 "https://www.googleapis.com/auth/cloud-platform," 42 "https://www.googleapis.com/auth/dialogflow"; 43 44 // Returns the list of all intents in the specified agent. 45 rpc ListIntents(ListIntentsRequest) returns (ListIntentsResponse) { 46 option (google.api.http) = { 47 get: "/v3/{parent=projects/*/locations/*/agents/*}/intents" 48 }; 49 option (google.api.method_signature) = "parent"; 50 } 51 52 // Retrieves the specified intent. 53 rpc GetIntent(GetIntentRequest) returns (Intent) { 54 option (google.api.http) = { 55 get: "/v3/{name=projects/*/locations/*/agents/*/intents/*}" 56 }; 57 option (google.api.method_signature) = "name"; 58 } 59 60 // Creates an intent in the specified agent. 61 // 62 // Note: You should always train a flow prior to sending it queries. See the 63 // [training 64 // documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 65 rpc CreateIntent(CreateIntentRequest) returns (Intent) { 66 option (google.api.http) = { 67 post: "/v3/{parent=projects/*/locations/*/agents/*}/intents" 68 body: "intent" 69 }; 70 option (google.api.method_signature) = "parent,intent"; 71 } 72 73 // Updates the specified intent. 74 // 75 // Note: You should always train a flow prior to sending it queries. See the 76 // [training 77 // documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 78 rpc UpdateIntent(UpdateIntentRequest) returns (Intent) { 79 option (google.api.http) = { 80 patch: "/v3/{intent.name=projects/*/locations/*/agents/*/intents/*}" 81 body: "intent" 82 }; 83 option (google.api.method_signature) = "intent,update_mask"; 84 } 85 86 // Deletes the specified intent. 87 // 88 // Note: You should always train a flow prior to sending it queries. See the 89 // [training 90 // documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 91 rpc DeleteIntent(DeleteIntentRequest) returns (google.protobuf.Empty) { 92 option (google.api.http) = { 93 delete: "/v3/{name=projects/*/locations/*/agents/*/intents/*}" 94 }; 95 option (google.api.method_signature) = "name"; 96 } 97 98 // Imports the specified intents into the agent. 99 // 100 // This method is a [long-running 101 // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). 102 // The returned `Operation` type has the following method-specific fields: 103 // 104 // - `metadata`: 105 // [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3.ImportIntentsMetadata] 106 // - `response`: 107 // [ImportIntentsResponse][google.cloud.dialogflow.cx.v3.ImportIntentsResponse] 108 rpc ImportIntents(ImportIntentsRequest) 109 returns (google.longrunning.Operation) { 110 option (google.api.http) = { 111 post: "/v3/{parent=projects/*/locations/*/agents/*}/intents:import" 112 body: "*" 113 }; 114 option (google.longrunning.operation_info) = { 115 response_type: "ImportIntentsResponse" 116 metadata_type: "ImportIntentsMetadata" 117 }; 118 } 119 120 // Exports the selected intents. 121 // 122 // This method is a [long-running 123 // operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). 124 // The returned `Operation` type has the following method-specific fields: 125 // 126 // - `metadata`: 127 // [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3.ExportIntentsMetadata] 128 // - `response`: 129 // [ExportIntentsResponse][google.cloud.dialogflow.cx.v3.ExportIntentsResponse] 130 rpc ExportIntents(ExportIntentsRequest) 131 returns (google.longrunning.Operation) { 132 option (google.api.http) = { 133 post: "/v3/{parent=projects/*/locations/*/agents/*}/intents:export" 134 body: "*" 135 }; 136 option (google.longrunning.operation_info) = { 137 response_type: "ExportIntentsResponse" 138 metadata_type: "ExportIntentsMetadata" 139 }; 140 } 141} 142 143// An intent represents a user's intent to interact with a conversational agent. 144// 145// You can provide information for the Dialogflow API to use to match user input 146// to an intent by adding training phrases (i.e., examples of user input) to 147// your intent. 148message Intent { 149 option (google.api.resource) = { 150 type: "dialogflow.googleapis.com/Intent" 151 pattern: "projects/{project}/locations/{location}/agents/{agent}/intents/{intent}" 152 }; 153 154 // Represents an example that the agent is trained on to identify the intent. 155 message TrainingPhrase { 156 // Represents a part of a training phrase. 157 message Part { 158 // Required. The text for this part. 159 string text = 1 [(google.api.field_behavior) = REQUIRED]; 160 161 // The [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] used to 162 // annotate this part of the training phrase. This field is required for 163 // annotated parts of the training phrase. 164 string parameter_id = 2; 165 } 166 167 // Output only. The unique identifier of the training phrase. 168 string id = 1; 169 170 // Required. The ordered list of training phrase parts. 171 // The parts are concatenated in order to form the training phrase. 172 // 173 // Note: The API does not automatically annotate training phrases like the 174 // Dialogflow Console does. 175 // 176 // Note: Do not forget to include whitespace at part boundaries, so the 177 // training phrase is well formatted when the parts are concatenated. 178 // 179 // If the training phrase does not need to be annotated with parameters, 180 // you just need a single part with only the 181 // [Part.text][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part.text] 182 // field set. 183 // 184 // If you want to annotate the training phrase, you must create multiple 185 // parts, where the fields of each part are populated in one of two ways: 186 // 187 // - `Part.text` is set to a part of the phrase that has no parameters. 188 // - `Part.text` is set to a part of the phrase that you want to annotate, 189 // and the `parameter_id` field is set. 190 repeated Part parts = 2 [(google.api.field_behavior) = REQUIRED]; 191 192 // Indicates how many times this example was added to the intent. 193 int32 repeat_count = 3; 194 } 195 196 // Represents an intent parameter. 197 message Parameter { 198 // Required. The unique identifier of the parameter. This field 199 // is used by [training 200 // phrases][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase] to annotate 201 // their [parts][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part]. 202 string id = 1 [(google.api.field_behavior) = REQUIRED]; 203 204 // Required. The entity type of the parameter. 205 // Format: `projects/-/locations/-/agents/-/entityTypes/<System Entity Type 206 // ID>` for system entity types (for example, 207 // `projects/-/locations/-/agents/-/entityTypes/sys.date`), or 208 // `projects/<Project ID>/locations/<Location ID>/agents/<Agent 209 // ID>/entityTypes/<Entity Type ID>` for developer entity types. 210 string entity_type = 2 [ 211 (google.api.field_behavior) = REQUIRED, 212 (google.api.resource_reference) = { 213 type: "dialogflow.googleapis.com/EntityType" 214 } 215 ]; 216 217 // Indicates whether the parameter represents a list of values. 218 bool is_list = 3; 219 220 // Indicates whether the parameter content should be redacted in log. If 221 // redaction is enabled, the parameter content will be replaced by parameter 222 // name during logging. 223 // Note: the parameter content is subject to redaction if either parameter 224 // level redaction or [entity type level 225 // redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. 226 bool redact = 4; 227 } 228 229 // The unique identifier of the intent. 230 // Required for the 231 // [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3.Intents.UpdateIntent] 232 // method. 233 // [Intents.CreateIntent][google.cloud.dialogflow.cx.v3.Intents.CreateIntent] 234 // populates the name automatically. 235 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 236 // ID>/intents/<Intent ID>`. 237 string name = 1; 238 239 // Required. The human-readable name of the intent, unique within the agent. 240 string display_name = 2 [(google.api.field_behavior) = REQUIRED]; 241 242 // The collection of training phrases the agent is trained on to identify the 243 // intent. 244 repeated TrainingPhrase training_phrases = 3; 245 246 // The collection of parameters associated with the intent. 247 repeated Parameter parameters = 4; 248 249 // The priority of this intent. Higher numbers represent higher 250 // priorities. 251 // 252 // - If the supplied value is unspecified or 0, the service 253 // translates the value to 500,000, which corresponds to the 254 // `Normal` priority in the console. 255 // - If the supplied value is negative, the intent is ignored 256 // in runtime detect intent requests. 257 int32 priority = 5; 258 259 // Indicates whether this is a fallback intent. Currently only default 260 // fallback intent is allowed in the agent, which is added upon agent 261 // creation. 262 // Adding training phrases to fallback intent is useful in the case of 263 // requests that are mistakenly matched, since training phrases assigned to 264 // fallback intents act as negative examples that triggers no-match event. 265 bool is_fallback = 6; 266 267 // The key/value metadata to label an intent. Labels can contain 268 // lowercase letters, digits and the symbols '-' and '_'. International 269 // characters are allowed, including letters from unicase alphabets. Keys must 270 // start with a letter. Keys and values can be no longer than 63 characters 271 // and no more than 128 bytes. 272 // 273 // Prefix "sys-" is reserved for Dialogflow defined labels. Currently allowed 274 // Dialogflow defined labels include: 275 // * sys-head 276 // * sys-contextual 277 // The above labels do not require value. "sys-head" means the intent is a 278 // head intent. "sys.contextual" means the intent is a contextual intent. 279 map<string, string> labels = 7; 280 281 // Human readable description for better understanding an intent like its 282 // scope, content, result etc. Maximum character limit: 140 characters. 283 string description = 8; 284} 285 286// The request message for 287// [Intents.ListIntents][google.cloud.dialogflow.cx.v3.Intents.ListIntents]. 288message ListIntentsRequest { 289 // Required. The agent to list all intents for. 290 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. 291 string parent = 1 [ 292 (google.api.field_behavior) = REQUIRED, 293 (google.api.resource_reference) = { 294 child_type: "dialogflow.googleapis.com/Intent" 295 } 296 ]; 297 298 // The language to list intents for. The following fields are language 299 // dependent: 300 // 301 // * `Intent.training_phrases.parts.text` 302 // 303 // If not specified, the agent's default language is used. 304 // [Many 305 // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 306 // are supported. 307 // Note: languages must be enabled in the agent before they can be used. 308 string language_code = 2; 309 310 // The resource view to apply to the returned intent. 311 IntentView intent_view = 5; 312 313 // The maximum number of items to return in a single page. By default 100 and 314 // at most 1000. 315 int32 page_size = 3; 316 317 // The next_page_token value returned from a previous list request. 318 string page_token = 4; 319} 320 321// The response message for 322// [Intents.ListIntents][google.cloud.dialogflow.cx.v3.Intents.ListIntents]. 323message ListIntentsResponse { 324 // The list of intents. There will be a maximum number of items returned based 325 // on the page_size field in the request. 326 repeated Intent intents = 1; 327 328 // Token to retrieve the next page of results, or empty if there are no more 329 // results in the list. 330 string next_page_token = 2; 331} 332 333// The request message for 334// [Intents.GetIntent][google.cloud.dialogflow.cx.v3.Intents.GetIntent]. 335message GetIntentRequest { 336 // Required. The name of the intent. 337 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 338 // ID>/intents/<Intent ID>`. 339 string name = 1 [ 340 (google.api.field_behavior) = REQUIRED, 341 (google.api.resource_reference) = { 342 type: "dialogflow.googleapis.com/Intent" 343 } 344 ]; 345 346 // The language to retrieve the intent for. The following fields are language 347 // dependent: 348 // 349 // * `Intent.training_phrases.parts.text` 350 // 351 // If not specified, the agent's default language is used. 352 // [Many 353 // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 354 // are supported. 355 // Note: languages must be enabled in the agent before they can be used. 356 string language_code = 2; 357} 358 359// The request message for 360// [Intents.CreateIntent][google.cloud.dialogflow.cx.v3.Intents.CreateIntent]. 361message CreateIntentRequest { 362 // Required. The agent to create an intent for. 363 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. 364 string parent = 1 [ 365 (google.api.field_behavior) = REQUIRED, 366 (google.api.resource_reference) = { 367 child_type: "dialogflow.googleapis.com/Intent" 368 } 369 ]; 370 371 // Required. The intent to create. 372 Intent intent = 2 [(google.api.field_behavior) = REQUIRED]; 373 374 // The language of the following fields in `intent`: 375 // 376 // * `Intent.training_phrases.parts.text` 377 // 378 // If not specified, the agent's default language is used. 379 // [Many 380 // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 381 // are supported. 382 // Note: languages must be enabled in the agent before they can be used. 383 string language_code = 3; 384} 385 386// The request message for 387// [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3.Intents.UpdateIntent]. 388message UpdateIntentRequest { 389 // Required. The intent to update. 390 Intent intent = 1 [(google.api.field_behavior) = REQUIRED]; 391 392 // The language of the following fields in `intent`: 393 // 394 // * `Intent.training_phrases.parts.text` 395 // 396 // If not specified, the agent's default language is used. 397 // [Many 398 // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 399 // are supported. 400 // Note: languages must be enabled in the agent before they can be used. 401 string language_code = 2; 402 403 // The mask to control which fields get updated. If the mask is not present, 404 // all fields will be updated. 405 google.protobuf.FieldMask update_mask = 3; 406} 407 408// The request message for 409// [Intents.DeleteIntent][google.cloud.dialogflow.cx.v3.Intents.DeleteIntent]. 410message DeleteIntentRequest { 411 // Required. The name of the intent to delete. 412 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 413 // ID>/intents/<Intent ID>`. 414 string name = 1 [ 415 (google.api.field_behavior) = REQUIRED, 416 (google.api.resource_reference) = { 417 type: "dialogflow.googleapis.com/Intent" 418 } 419 ]; 420} 421 422// Represents the options for views of an intent. 423// An intent can be a sizable object. Therefore, we provide a resource view that 424// does not return training phrases in the response. 425enum IntentView { 426 // Not specified. Treated as INTENT_VIEW_FULL. 427 INTENT_VIEW_UNSPECIFIED = 0; 428 429 // Training phrases field is not populated in the response. 430 INTENT_VIEW_PARTIAL = 1; 431 432 // All fields are populated. 433 INTENT_VIEW_FULL = 2; 434} 435 436// The request message for 437// [Intents.ImportIntents][google.cloud.dialogflow.cx.v3.Intents.ImportIntents]. 438message ImportIntentsRequest { 439 // Merge option when display name conflicts exist during import. 440 enum MergeOption { 441 // Unspecified. Should not be used. 442 MERGE_OPTION_UNSPECIFIED = 0; 443 444 // DEPRECATED: Please use 445 // [REPORT_CONFLICT][ImportIntentsRequest.REPORT_CONFLICT] instead. 446 // Fail the request if there are intents whose display names conflict with 447 // the display names of intents in the agent. 448 REJECT = 1 [deprecated = true]; 449 450 // Replace the original intent in the agent with the new intent when display 451 // name conflicts exist. 452 REPLACE = 2; 453 454 // Merge the original intent with the new intent when display name conflicts 455 // exist. 456 MERGE = 3; 457 458 // Create new intents with new display names to differentiate them from the 459 // existing intents when display name conflicts exist. 460 RENAME = 4; 461 462 // Report conflict information if display names conflict is detected. 463 // Otherwise, import intents. 464 REPORT_CONFLICT = 5; 465 466 // Keep the original intent and discard the conflicting new intent when 467 // display name conflicts exist. 468 KEEP = 6; 469 } 470 471 // Required. The agent to import the intents into. 472 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`. 473 string parent = 1 [ 474 (google.api.field_behavior) = REQUIRED, 475 (google.api.resource_reference) = { 476 child_type: "dialogflow.googleapis.com/Intent" 477 } 478 ]; 479 480 // Required. The intents to import. 481 oneof intents { 482 // The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI 483 // to import intents from. The format of this URI must be 484 // `gs://<bucket-name>/<object-name>`. 485 // 486 // Dialogflow performs a read operation for the Cloud Storage object 487 // on the caller's behalf, so your request authentication must 488 // have read permissions for the object. For more information, see 489 // [Dialogflow access 490 // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). 491 string intents_uri = 2; 492 493 // Uncompressed byte content of intents. 494 InlineSource intents_content = 3; 495 } 496 497 // Merge option for importing intents. If not specified, `REJECT` is assumed. 498 MergeOption merge_option = 4; 499} 500 501// The response message for 502// [Intents.ImportIntents][google.cloud.dialogflow.cx.v3.Intents.ImportIntents]. 503message ImportIntentsResponse { 504 // Conflicting resources detected during the import process. Only filled when 505 // [REPORT_CONFLICT][ImportIntentsResponse.REPORT_CONFLICT] is set in the 506 // request and there are conflicts in the display names. 507 message ConflictingResources { 508 // Display names of conflicting intents. 509 repeated string intent_display_names = 1; 510 511 // Display names of conflicting entities. 512 repeated string entity_display_names = 2; 513 } 514 515 // The unique identifier of the imported intents. 516 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 517 // ID>/intents/<Intent ID>`. 518 repeated string intents = 1 [(google.api.resource_reference) = { 519 type: "dialogflow.googleapis.com/Intent" 520 }]; 521 522 // Info which resources have conflicts when 523 // [REPORT_CONFLICT][ImportIntentsResponse.REPORT_CONFLICT] merge_option is 524 // set in ImportIntentsRequest. 525 ConflictingResources conflicting_resources = 2; 526} 527 528// Metadata returned for the 529// [Intents.ImportIntents][google.cloud.dialogflow.cx.v3.Intents.ImportIntents] 530// long running operation. 531message ImportIntentsMetadata {} 532 533// The request message for 534// [Intents.ExportIntents][google.cloud.dialogflow.cx.v3.Intents.ExportIntents]. 535message ExportIntentsRequest { 536 // Data format of the exported intents. 537 enum DataFormat { 538 // Unspecified format. Treated as `BLOB`. 539 DATA_FORMAT_UNSPECIFIED = 0; 540 541 // Intents will be exported as raw bytes. 542 BLOB = 1; 543 544 // Intents will be exported in JSON format. 545 JSON = 2; 546 547 // Intents will be exported in CSV format. 548 CSV = 3; 549 } 550 551 // Required. The name of the parent agent to export intents. 552 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 553 // ID>`. 554 string parent = 1 [ 555 (google.api.field_behavior) = REQUIRED, 556 (google.api.resource_reference) = { 557 child_type: "dialogflow.googleapis.com/Intent" 558 } 559 ]; 560 561 // Required. The name of the intents to export. 562 // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent 563 // ID>/intents/<Intent ID>`. 564 repeated string intents = 2 [(google.api.field_behavior) = REQUIRED]; 565 566 // The destination to export. 567 oneof destination { 568 // Optional. The [Google Cloud 569 // Storage](https://cloud.google.com/storage/docs/) URI to export the 570 // intents to. The format of this URI must be 571 // `gs://<bucket-name>/<object-name>`. 572 // 573 // Dialogflow performs a write operation for the Cloud Storage object 574 // on the caller's behalf, so your request authentication must 575 // have write permissions for the object. For more information, see 576 // [Dialogflow access 577 // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). 578 string intents_uri = 3 [(google.api.field_behavior) = OPTIONAL]; 579 580 // Optional. The option to return the serialized intents inline. 581 bool intents_content_inline = 4 [(google.api.field_behavior) = OPTIONAL]; 582 } 583 584 // Optional. The data format of the exported intents. If not specified, `BLOB` 585 // is assumed. 586 DataFormat data_format = 5 [(google.api.field_behavior) = OPTIONAL]; 587} 588 589// The response message for 590// [Intents.ExportIntents][google.cloud.dialogflow.cx.v3.Intents.ExportIntents]. 591message ExportIntentsResponse { 592 // The exported intents. 593 oneof intents { 594 // The URI to a file containing the exported intents. This field is 595 // populated only if `intents_uri` is specified in 596 // [ExportIntentsRequest][google.cloud.dialogflow.cx.v3.ExportIntentsRequest]. 597 string intents_uri = 1; 598 599 // Uncompressed byte content for intents. This field is populated only if 600 // `intents_content_inline` is set to true in 601 // [ExportIntentsRequest][google.cloud.dialogflow.cx.v3.ExportIntentsRequest]. 602 InlineDestination intents_content = 2; 603 } 604} 605 606// Metadata returned for the 607// [Intents.ExportIntents][google.cloud.dialogflow.cx.v3.Intents.ExportIntents] 608// long running operation. 609message ExportIntentsMetadata {} 610