intent.proto 14 KB

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