xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/cx/v3beta1/intent.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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.v3beta1;
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/v3beta1/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.V3Beta1";
30option go_package = "cloud.google.com/go/dialogflow/cx/apiv3beta1/cxpb;cxpb";
31option java_multiple_files = true;
32option java_outer_classname = "IntentProto";
33option java_package = "com.google.cloud.dialogflow.cx.v3beta1";
34option objc_class_prefix = "DF";
35option ruby_package = "Google::Cloud::Dialogflow::CX::V3beta1";
36
37// Service for managing [Intents][google.cloud.dialogflow.cx.v3beta1.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: "/v3beta1/{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: "/v3beta1/{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: "/v3beta1/{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: "/v3beta1/{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: "/v3beta1/{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.v3beta1.ImportIntentsMetadata]
106  // - `response`:
107  // [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ImportIntentsResponse]
108  rpc ImportIntents(ImportIntentsRequest)
109      returns (google.longrunning.Operation) {
110    option (google.api.http) = {
111      post: "/v3beta1/{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.v3beta1.ExportIntentsMetadata]
128  // - `response`:
129  // [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ExportIntentsResponse]
130  rpc ExportIntents(ExportIntentsRequest)
131      returns (google.longrunning.Operation) {
132    option (google.api.http) = {
133      post: "/v3beta1/{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.v3beta1.Intent.Parameter]
162      // used to annotate this part of the training phrase. This field is
163      // required for 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.v3beta1.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.v3beta1.Intent.TrainingPhrase] to
201    // annotate their
202    // [parts][google.cloud.dialogflow.cx.v3beta1.Intent.TrainingPhrase.Part].
203    string id = 1 [(google.api.field_behavior) = REQUIRED];
204
205    // Required. The entity type of the parameter.
206    // Format: `projects/-/locations/-/agents/-/entityTypes/<System Entity Type
207    // ID>` for system entity types (for example,
208    // `projects/-/locations/-/agents/-/entityTypes/sys.date`), or
209    // `projects/<Project ID>/locations/<Location ID>/agents/<Agent
210    // ID>/entityTypes/<Entity Type ID>` for developer entity types.
211    string entity_type = 2 [
212      (google.api.field_behavior) = REQUIRED,
213      (google.api.resource_reference) = {
214        type: "dialogflow.googleapis.com/EntityType"
215      }
216    ];
217
218    // Indicates whether the parameter represents a list of values.
219    bool is_list = 3;
220
221    // Indicates whether the parameter content should be redacted in log. If
222    // redaction is enabled, the parameter content will be replaced by parameter
223    // name during logging.
224    // Note: the parameter content is subject to redaction if either parameter
225    // level redaction or [entity type level
226    // redaction][google.cloud.dialogflow.cx.v3beta1.EntityType.redact] is
227    // enabled.
228    bool redact = 4;
229  }
230
231  // The unique identifier of the intent.
232  // Required for the
233  // [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3beta1.Intents.UpdateIntent]
234  // method.
235  // [Intents.CreateIntent][google.cloud.dialogflow.cx.v3beta1.Intents.CreateIntent]
236  // populates the name automatically.
237  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
238  // ID>/intents/<Intent ID>`.
239  string name = 1;
240
241  // Required. The human-readable name of the intent, unique within the agent.
242  string display_name = 2 [(google.api.field_behavior) = REQUIRED];
243
244  // The collection of training phrases the agent is trained on to identify the
245  // intent.
246  repeated TrainingPhrase training_phrases = 3;
247
248  // The collection of parameters associated with the intent.
249  repeated Parameter parameters = 4;
250
251  // The priority of this intent. Higher numbers represent higher
252  // priorities.
253  //
254  // - If the supplied value is unspecified or 0, the service
255  //   translates the value to 500,000, which corresponds to the
256  //   `Normal` priority in the console.
257  // - If the supplied value is negative, the intent is ignored
258  //   in runtime detect intent requests.
259  int32 priority = 5;
260
261  // Indicates whether this is a fallback intent. Currently only default
262  // fallback intent is allowed in the agent, which is added upon agent
263  // creation.
264  // Adding training phrases to fallback intent is useful in the case of
265  // requests that are mistakenly matched, since training phrases assigned to
266  // fallback intents act as negative examples that triggers no-match event.
267  bool is_fallback = 6;
268
269  // The key/value metadata to label an intent. Labels can contain
270  // lowercase letters, digits and the symbols '-' and '_'. International
271  // characters are allowed, including letters from unicase alphabets. Keys must
272  // start with a letter. Keys and values can be no longer than 63 characters
273  // and no more than 128 bytes.
274  //
275  // Prefix "sys-" is reserved for Dialogflow defined labels. Currently allowed
276  // Dialogflow defined labels include:
277  // * sys-head
278  // * sys-contextual
279  // The above labels do not require value. "sys-head" means the intent is a
280  // head intent. "sys-contextual" means the intent is a contextual intent.
281  map<string, string> labels = 7;
282
283  // Human readable description for better understanding an intent like its
284  // scope, content, result etc. Maximum character limit: 140 characters.
285  string description = 8;
286}
287
288// The request message for
289// [Intents.ListIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ListIntents].
290message ListIntentsRequest {
291  // Required. The agent to list all intents for.
292  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
293  string parent = 1 [
294    (google.api.field_behavior) = REQUIRED,
295    (google.api.resource_reference) = {
296      child_type: "dialogflow.googleapis.com/Intent"
297    }
298  ];
299
300  // The language to list intents 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  // The resource view to apply to the returned intent.
313  IntentView intent_view = 5;
314
315  // The maximum number of items to return in a single page. By default 100 and
316  // at most 1000.
317  int32 page_size = 3;
318
319  // The next_page_token value returned from a previous list request.
320  string page_token = 4;
321}
322
323// The response message for
324// [Intents.ListIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ListIntents].
325message ListIntentsResponse {
326  // The list of intents. There will be a maximum number of items returned based
327  // on the page_size field in the request.
328  repeated Intent intents = 1;
329
330  // Token to retrieve the next page of results, or empty if there are no more
331  // results in the list.
332  string next_page_token = 2;
333}
334
335// The request message for
336// [Intents.GetIntent][google.cloud.dialogflow.cx.v3beta1.Intents.GetIntent].
337message GetIntentRequest {
338  // Required. The name of the intent.
339  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
340  // ID>/intents/<Intent ID>`.
341  string name = 1 [
342    (google.api.field_behavior) = REQUIRED,
343    (google.api.resource_reference) = {
344      type: "dialogflow.googleapis.com/Intent"
345    }
346  ];
347
348  // The language to retrieve the intent for. The following fields are language
349  // dependent:
350  //
351  // *   `Intent.training_phrases.parts.text`
352  //
353  // If not specified, the agent's default language is used.
354  // [Many
355  // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
356  // are supported.
357  // Note: languages must be enabled in the agent before they can be used.
358  string language_code = 2;
359}
360
361// The request message for
362// [Intents.CreateIntent][google.cloud.dialogflow.cx.v3beta1.Intents.CreateIntent].
363message CreateIntentRequest {
364  // Required. The agent to create an intent for.
365  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
366  string parent = 1 [
367    (google.api.field_behavior) = REQUIRED,
368    (google.api.resource_reference) = {
369      child_type: "dialogflow.googleapis.com/Intent"
370    }
371  ];
372
373  // Required. The intent to create.
374  Intent intent = 2 [(google.api.field_behavior) = REQUIRED];
375
376  // The language of the following fields in `intent`:
377  //
378  // *   `Intent.training_phrases.parts.text`
379  //
380  // If not specified, the agent's default language is used.
381  // [Many
382  // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
383  // are supported.
384  // Note: languages must be enabled in the agent before they can be used.
385  string language_code = 3;
386}
387
388// The request message for
389// [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3beta1.Intents.UpdateIntent].
390message UpdateIntentRequest {
391  // Required. The intent to update.
392  Intent intent = 1 [(google.api.field_behavior) = REQUIRED];
393
394  // The language of the following fields in `intent`:
395  //
396  // *   `Intent.training_phrases.parts.text`
397  //
398  // If not specified, the agent's default language is used.
399  // [Many
400  // languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
401  // are supported.
402  // Note: languages must be enabled in the agent before they can be used.
403  string language_code = 2;
404
405  // The mask to control which fields get updated. If the mask is not present,
406  // all fields will be updated.
407  google.protobuf.FieldMask update_mask = 3;
408}
409
410// The request message for
411// [Intents.DeleteIntent][google.cloud.dialogflow.cx.v3beta1.Intents.DeleteIntent].
412message DeleteIntentRequest {
413  // Required. The name of the intent to delete.
414  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
415  // ID>/intents/<Intent ID>`.
416  string name = 1 [
417    (google.api.field_behavior) = REQUIRED,
418    (google.api.resource_reference) = {
419      type: "dialogflow.googleapis.com/Intent"
420    }
421  ];
422}
423
424// Represents the options for views of an intent.
425// An intent can be a sizable object. Therefore, we provide a resource view that
426// does not return training phrases in the response.
427enum IntentView {
428  // Not specified. Treated as INTENT_VIEW_FULL.
429  INTENT_VIEW_UNSPECIFIED = 0;
430
431  // Training phrases field is not populated in the response.
432  INTENT_VIEW_PARTIAL = 1;
433
434  // All fields are populated.
435  INTENT_VIEW_FULL = 2;
436}
437
438// The request message for
439// [Intents.ImportIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ImportIntents].
440message ImportIntentsRequest {
441  // Merge option when display name conflicts exist during import.
442  enum MergeOption {
443    // Unspecified. Should not be used.
444    MERGE_OPTION_UNSPECIFIED = 0;
445
446    // DEPRECATED: Please use
447    // [REPORT_CONFLICT][ImportIntentsRequest.REPORT_CONFLICT] instead.
448    // Fail the request if there are intents whose display names conflict with
449    // the display names of intents in the agent.
450    REJECT = 1 [deprecated = true];
451
452    // Replace the original intent in the agent with the new intent when display
453    // name conflicts exist.
454    REPLACE = 2;
455
456    // Merge the original intent with the new intent when display name conflicts
457    // exist.
458    MERGE = 3;
459
460    // Create new intents with new display names to differentiate them from the
461    // existing intents when display name conflicts exist.
462    RENAME = 4;
463
464    // Report conflict information if display names conflict is detected.
465    // Otherwise, import intents.
466    REPORT_CONFLICT = 5;
467
468    // Keep the original intent and discard the conflicting new intent when
469    // display name conflicts exist.
470    KEEP = 6;
471  }
472
473  // Required. The agent to import the intents into.
474  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
475  string parent = 1 [
476    (google.api.field_behavior) = REQUIRED,
477    (google.api.resource_reference) = {
478      child_type: "dialogflow.googleapis.com/Intent"
479    }
480  ];
481
482  // Required. The intents to import.
483  oneof intents {
484    // The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
485    // to import intents from. The format of this URI must be
486    // `gs://<bucket-name>/<object-name>`.
487    //
488    // Dialogflow performs a read operation for the Cloud Storage object
489    // on the caller's behalf, so your request authentication must
490    // have read permissions for the object. For more information, see
491    // [Dialogflow access
492    // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
493    string intents_uri = 2;
494
495    // Uncompressed byte content of intents.
496    InlineSource intents_content = 3;
497  }
498
499  // Merge option for importing intents. If not specified, `REJECT` is assumed.
500  MergeOption merge_option = 4;
501}
502
503// The response message for
504// [Intents.ImportIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ImportIntents].
505message ImportIntentsResponse {
506  // Conflicting resources detected during the import process. Only filled when
507  // [REPORT_CONFLICT][ImportIntentsResponse.REPORT_CONFLICT] is set in the
508  // request and there are conflicts in the display names.
509  message ConflictingResources {
510    // Display names of conflicting intents.
511    repeated string intent_display_names = 1;
512
513    // Display names of conflicting entities.
514    repeated string entity_display_names = 2;
515  }
516
517  // The unique identifier of the imported intents.
518  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
519  // ID>/intents/<Intent ID>`.
520  repeated string intents = 1 [(google.api.resource_reference) = {
521    type: "dialogflow.googleapis.com/Intent"
522  }];
523
524  // Info which resources have conflicts when
525  // [REPORT_CONFLICT][ImportIntentsResponse.REPORT_CONFLICT] merge_option is
526  // set in ImportIntentsRequest.
527  ConflictingResources conflicting_resources = 2;
528}
529
530// Metadata returned for the
531// [Intents.ImportIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ImportIntents]
532// long running operation.
533message ImportIntentsMetadata {}
534
535// The request message for
536// [Intents.ExportIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ExportIntents].
537message ExportIntentsRequest {
538  // Data format of the exported intents.
539  enum DataFormat {
540    // Unspecified format. Treated as `BLOB`.
541    DATA_FORMAT_UNSPECIFIED = 0;
542
543    // Intents will be exported as raw bytes.
544    BLOB = 1;
545
546    // Intents will be exported in JSON format.
547    JSON = 2;
548
549    // Intents will be exported in CSV format.
550    CSV = 3;
551  }
552
553  // Required. The name of the parent agent to export intents.
554  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
555  // ID>`.
556  string parent = 1 [
557    (google.api.field_behavior) = REQUIRED,
558    (google.api.resource_reference) = {
559      child_type: "dialogflow.googleapis.com/Intent"
560    }
561  ];
562
563  // Required. The name of the intents to export.
564  // Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
565  // ID>/intents/<Intent ID>`.
566  repeated string intents = 2 [(google.api.field_behavior) = REQUIRED];
567
568  // The destination to export.
569  oneof destination {
570    // Optional. The [Google Cloud
571    // Storage](https://cloud.google.com/storage/docs/) URI to export the
572    // intents to. The format of this URI must be
573    // `gs://<bucket-name>/<object-name>`.
574    //
575    // Dialogflow performs a write operation for the Cloud Storage object
576    // on the caller's behalf, so your request authentication must
577    // have write permissions for the object. For more information, see
578    // [Dialogflow access
579    // control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
580    string intents_uri = 3 [(google.api.field_behavior) = OPTIONAL];
581
582    // Optional. The option to return the serialized intents inline.
583    bool intents_content_inline = 4 [(google.api.field_behavior) = OPTIONAL];
584  }
585
586  // Optional. The data format of the exported intents. If not specified, `BLOB`
587  // is assumed.
588  DataFormat data_format = 5 [(google.api.field_behavior) = OPTIONAL];
589}
590
591// The response message for
592// [Intents.ExportIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ExportIntents].
593message ExportIntentsResponse {
594  // The exported intents.
595  oneof intents {
596    // The URI to a file containing the exported intents. This field is
597    // populated only if `intents_uri` is specified in
598    // [ExportIntentsRequest][google.cloud.dialogflow.cx.v3beta1.ExportIntentsRequest].
599    string intents_uri = 1;
600
601    // Uncompressed byte content for intents. This field is populated only if
602    // `intents_content_inline` is set to true in
603    // [ExportIntentsRequest][google.cloud.dialogflow.cx.v3beta1.ExportIntentsRequest].
604    InlineDestination intents_content = 2;
605  }
606}
607
608// Metadata returned for the
609// [Intents.ExportIntents][google.cloud.dialogflow.cx.v3beta1.Intents.ExportIntents]
610// long running operation.
611message ExportIntentsMetadata {}
612