agent.proto 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. // Copyright 2021 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.v2;
  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/cloud/dialogflow/v2/validation_result.proto";
  21. import "google/longrunning/operations.proto";
  22. import "google/protobuf/empty.proto";
  23. import "google/protobuf/field_mask.proto";
  24. option cc_enable_arenas = true;
  25. option csharp_namespace = "Google.Cloud.Dialogflow.V2";
  26. option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "AgentProto";
  29. option java_package = "com.google.cloud.dialogflow.v2";
  30. option objc_class_prefix = "DF";
  31. // Service for managing [Agents][google.cloud.dialogflow.v2.Agent].
  32. service Agents {
  33. option (google.api.default_host) = "dialogflow.googleapis.com";
  34. option (google.api.oauth_scopes) =
  35. "https://www.googleapis.com/auth/cloud-platform,"
  36. "https://www.googleapis.com/auth/dialogflow";
  37. // Retrieves the specified agent.
  38. rpc GetAgent(GetAgentRequest) returns (Agent) {
  39. option (google.api.http) = {
  40. get: "/v2/{parent=projects/*}/agent"
  41. additional_bindings {
  42. get: "/v2/{parent=projects/*/locations/*}/agent"
  43. }
  44. };
  45. option (google.api.method_signature) = "parent";
  46. }
  47. // Creates/updates the specified agent.
  48. //
  49. // Note: You should always train an agent prior to sending it queries. See the
  50. // [training
  51. // documentation](https://cloud.google.com/dialogflow/es/docs/training).
  52. rpc SetAgent(SetAgentRequest) returns (Agent) {
  53. option (google.api.http) = {
  54. post: "/v2/{agent.parent=projects/*}/agent"
  55. body: "agent"
  56. additional_bindings {
  57. post: "/v2/{agent.parent=projects/*/locations/*}/agent"
  58. body: "agent"
  59. }
  60. };
  61. option (google.api.method_signature) = "agent";
  62. }
  63. // Deletes the specified agent.
  64. rpc DeleteAgent(DeleteAgentRequest) returns (google.protobuf.Empty) {
  65. option (google.api.http) = {
  66. delete: "/v2/{parent=projects/*}/agent"
  67. additional_bindings {
  68. delete: "/v2/{parent=projects/*/locations/*}/agent"
  69. }
  70. };
  71. option (google.api.method_signature) = "parent";
  72. }
  73. // Returns the list of agents.
  74. //
  75. // Since there is at most one conversational agent per project, this method is
  76. // useful primarily for listing all agents across projects the caller has
  77. // access to. One can achieve that with a wildcard project collection id "-".
  78. // Refer to [List
  79. // Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
  80. rpc SearchAgents(SearchAgentsRequest) returns (SearchAgentsResponse) {
  81. option (google.api.http) = {
  82. get: "/v2/{parent=projects/*}/agent:search"
  83. additional_bindings {
  84. get: "/v2/{parent=projects/*/locations/*}/agent:search"
  85. }
  86. };
  87. option (google.api.method_signature) = "parent";
  88. }
  89. // Trains the specified agent.
  90. //
  91. //
  92. // Note: You should always train an agent prior to sending it queries. See the
  93. // [training
  94. // documentation](https://cloud.google.com/dialogflow/es/docs/training).
  95. rpc TrainAgent(TrainAgentRequest) returns (google.longrunning.Operation) {
  96. option (google.api.http) = {
  97. post: "/v2/{parent=projects/*}/agent:train"
  98. body: "*"
  99. additional_bindings {
  100. post: "/v2/{parent=projects/*/locations/*}/agent:train"
  101. body: "*"
  102. }
  103. };
  104. option (google.api.method_signature) = "parent";
  105. option (google.longrunning.operation_info) = {
  106. response_type: "google.protobuf.Empty"
  107. metadata_type: "google.protobuf.Struct"
  108. };
  109. }
  110. // Exports the specified agent to a ZIP file.
  111. rpc ExportAgent(ExportAgentRequest) returns (google.longrunning.Operation) {
  112. option (google.api.http) = {
  113. post: "/v2/{parent=projects/*}/agent:export"
  114. body: "*"
  115. additional_bindings {
  116. post: "/v2/{parent=projects/*/locations/*}/agent:export"
  117. body: "*"
  118. }
  119. };
  120. option (google.api.method_signature) = "parent";
  121. option (google.longrunning.operation_info) = {
  122. response_type: "google.cloud.dialogflow.v2.ExportAgentResponse"
  123. metadata_type: "google.protobuf.Struct"
  124. };
  125. }
  126. // Imports the specified agent from a ZIP file.
  127. //
  128. // Uploads new intents and entity types without deleting the existing ones.
  129. // Intents and entity types with the same name are replaced with the new
  130. // versions from [ImportAgentRequest][google.cloud.dialogflow.v2.ImportAgentRequest]. After the import, the imported draft
  131. // agent will be trained automatically (unless disabled in agent settings).
  132. // However, once the import is done, training may not be completed yet. Please
  133. // call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it returns in order to train
  134. // explicitly.
  135. //
  136. // An operation which tracks when importing is complete. It only tracks
  137. // when the draft agent is updated not when it is done training.
  138. //
  139. // Note: You should always train an agent prior to sending it queries. See the
  140. // [training
  141. // documentation](https://cloud.google.com/dialogflow/es/docs/training).
  142. rpc ImportAgent(ImportAgentRequest) returns (google.longrunning.Operation) {
  143. option (google.api.http) = {
  144. post: "/v2/{parent=projects/*}/agent:import"
  145. body: "*"
  146. additional_bindings {
  147. post: "/v2/{parent=projects/*/locations/*}/agent:import"
  148. body: "*"
  149. }
  150. };
  151. option (google.longrunning.operation_info) = {
  152. response_type: "google.protobuf.Empty"
  153. metadata_type: "google.protobuf.Struct"
  154. };
  155. }
  156. // Restores the specified agent from a ZIP file.
  157. //
  158. // Replaces the current agent version with a new one. All the intents and
  159. // entity types in the older version are deleted. After the restore, the
  160. // restored draft agent will be trained automatically (unless disabled in
  161. // agent settings). However, once the restore is done, training may not be
  162. // completed yet. Please call [TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent] and wait for the operation it
  163. // returns in order to train explicitly.
  164. //
  165. // An operation which tracks when restoring is complete. It only tracks
  166. // when the draft agent is updated not when it is done training.
  167. //
  168. // Note: You should always train an agent prior to sending it queries. See the
  169. // [training
  170. // documentation](https://cloud.google.com/dialogflow/es/docs/training).
  171. rpc RestoreAgent(RestoreAgentRequest) returns (google.longrunning.Operation) {
  172. option (google.api.http) = {
  173. post: "/v2/{parent=projects/*}/agent:restore"
  174. body: "*"
  175. additional_bindings {
  176. post: "/v2/{parent=projects/*/locations/*}/agent:restore"
  177. body: "*"
  178. }
  179. };
  180. option (google.longrunning.operation_info) = {
  181. response_type: "google.protobuf.Empty"
  182. metadata_type: "google.protobuf.Struct"
  183. };
  184. }
  185. // Gets agent validation result. Agent validation is performed during
  186. // training time and is updated automatically when training is completed.
  187. rpc GetValidationResult(GetValidationResultRequest) returns (ValidationResult) {
  188. option (google.api.http) = {
  189. get: "/v2/{parent=projects/*}/agent/validationResult"
  190. additional_bindings {
  191. get: "/v2/{parent=projects/*/locations/*}/agent/validationResult"
  192. }
  193. };
  194. }
  195. }
  196. // A Dialogflow agent is a virtual agent that handles conversations with your
  197. // end-users. It is a natural language understanding module that understands the
  198. // nuances of human language. Dialogflow translates end-user text or audio
  199. // during a conversation to structured data that your apps and services can
  200. // understand. You design and build a Dialogflow agent to handle the types of
  201. // conversations required for your system.
  202. //
  203. // For more information about agents, see the
  204. // [Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview).
  205. //
  206. message Agent {
  207. option (google.api.resource) = {
  208. type: "dialogflow.googleapis.com/Agent"
  209. pattern: "projects/{project}/agent"
  210. pattern: "projects/{project}/locations/{location}/agent"
  211. };
  212. // Match mode determines how intents are detected from user queries.
  213. enum MatchMode {
  214. // Not specified.
  215. MATCH_MODE_UNSPECIFIED = 0;
  216. // Best for agents with a small number of examples in intents and/or wide
  217. // use of templates syntax and composite entities.
  218. MATCH_MODE_HYBRID = 1;
  219. // Can be used for agents with a large number of examples in intents,
  220. // especially the ones using @sys.any or very large custom entities.
  221. MATCH_MODE_ML_ONLY = 2;
  222. }
  223. // API version for the agent.
  224. enum ApiVersion {
  225. // Not specified.
  226. API_VERSION_UNSPECIFIED = 0;
  227. // Legacy V1 API.
  228. API_VERSION_V1 = 1;
  229. // V2 API.
  230. API_VERSION_V2 = 2;
  231. // V2beta1 API.
  232. API_VERSION_V2_BETA_1 = 3;
  233. }
  234. // Represents the agent tier.
  235. enum Tier {
  236. // Not specified. This value should never be used.
  237. TIER_UNSPECIFIED = 0;
  238. // Standard tier.
  239. TIER_STANDARD = 1;
  240. // Enterprise tier (Essentials).
  241. TIER_ENTERPRISE = 2;
  242. // Enterprise tier (Plus).
  243. TIER_ENTERPRISE_PLUS = 3;
  244. }
  245. // Required. The project of this agent.
  246. // Format: `projects/<Project ID>`.
  247. string parent = 1 [
  248. (google.api.field_behavior) = REQUIRED,
  249. (google.api.resource_reference) = {
  250. type: "cloudresourcemanager.googleapis.com/Project"
  251. }
  252. ];
  253. // Required. The name of this agent.
  254. string display_name = 2 [(google.api.field_behavior) = REQUIRED];
  255. // Required. The default language of the agent as a language tag. See
  256. // [Language
  257. // Support](https://cloud.google.com/dialogflow/docs/reference/language)
  258. // for a list of the currently supported language codes. This field cannot be
  259. // set by the `Update` method.
  260. string default_language_code = 3 [(google.api.field_behavior) = REQUIRED];
  261. // Optional. The list of all languages supported by this agent (except for the
  262. // `default_language_code`).
  263. repeated string supported_language_codes = 4 [(google.api.field_behavior) = OPTIONAL];
  264. // Required. The time zone of this agent from the
  265. // [time zone database](https://www.iana.org/time-zones), e.g.,
  266. // America/New_York, Europe/Paris.
  267. string time_zone = 5 [(google.api.field_behavior) = REQUIRED];
  268. // Optional. The description of this agent.
  269. // The maximum length is 500 characters. If exceeded, the request is rejected.
  270. string description = 6 [(google.api.field_behavior) = OPTIONAL];
  271. // Optional. The URI of the agent's avatar.
  272. // Avatars are used throughout the Dialogflow console and in the self-hosted
  273. // [Web
  274. // Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo)
  275. // integration.
  276. string avatar_uri = 7 [(google.api.field_behavior) = OPTIONAL];
  277. // Optional. Determines whether this agent should log conversation queries.
  278. bool enable_logging = 8 [(google.api.field_behavior) = OPTIONAL];
  279. // Optional. Determines how intents are detected from user queries.
  280. MatchMode match_mode = 9 [
  281. deprecated = true,
  282. (google.api.field_behavior) = OPTIONAL
  283. ];
  284. // Optional. To filter out false positive results and still get variety in
  285. // matched natural language inputs for your agent, you can tune the machine
  286. // learning classification threshold. If the returned score value is less than
  287. // the threshold value, then a fallback intent will be triggered or, if there
  288. // are no fallback intents defined, no intent will be triggered. The score
  289. // values range from 0.0 (completely uncertain) to 1.0 (completely certain).
  290. // If set to 0.0, the default of 0.3 is used.
  291. float classification_threshold = 10 [(google.api.field_behavior) = OPTIONAL];
  292. // Optional. API version displayed in Dialogflow console. If not specified,
  293. // V2 API is assumed. Clients are free to query different service endpoints
  294. // for different API versions. However, bots connectors and webhook calls will
  295. // follow the specified API version.
  296. ApiVersion api_version = 14 [(google.api.field_behavior) = OPTIONAL];
  297. // Optional. The agent tier. If not specified, TIER_STANDARD is assumed.
  298. Tier tier = 15 [(google.api.field_behavior) = OPTIONAL];
  299. }
  300. // The request message for [Agents.GetAgent][google.cloud.dialogflow.v2.Agents.GetAgent].
  301. message GetAgentRequest {
  302. // Required. The project that the agent to fetch is associated with.
  303. // Format: `projects/<Project ID>`.
  304. string parent = 1 [
  305. (google.api.field_behavior) = REQUIRED,
  306. (google.api.resource_reference) = {
  307. child_type: "dialogflow.googleapis.com/Agent"
  308. }
  309. ];
  310. }
  311. // The request message for [Agents.SetAgent][google.cloud.dialogflow.v2.Agents.SetAgent].
  312. message SetAgentRequest {
  313. // Required. The agent to update.
  314. Agent agent = 1 [(google.api.field_behavior) = REQUIRED];
  315. // Optional. The mask to control which fields get updated.
  316. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL];
  317. }
  318. // The request message for [Agents.DeleteAgent][google.cloud.dialogflow.v2.Agents.DeleteAgent].
  319. message DeleteAgentRequest {
  320. // Required. The project that the agent to delete is associated with.
  321. // Format: `projects/<Project ID>`.
  322. string parent = 1 [
  323. (google.api.field_behavior) = REQUIRED,
  324. (google.api.resource_reference) = {
  325. child_type: "dialogflow.googleapis.com/Agent"
  326. }
  327. ];
  328. }
  329. // The request message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
  330. message SearchAgentsRequest {
  331. // Required. The project to list agents from.
  332. // Format: `projects/<Project ID or '-'>`.
  333. string parent = 1 [
  334. (google.api.field_behavior) = REQUIRED,
  335. (google.api.resource_reference) = {
  336. child_type: "dialogflow.googleapis.com/Agent"
  337. }
  338. ];
  339. // Optional. The maximum number of items to return in a single page. By
  340. // default 100 and at most 1000.
  341. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  342. // The next_page_token value returned from a previous list request.
  343. string page_token = 3;
  344. }
  345. // The response message for [Agents.SearchAgents][google.cloud.dialogflow.v2.Agents.SearchAgents].
  346. message SearchAgentsResponse {
  347. // The list of agents. There will be a maximum number of items returned based
  348. // on the page_size field in the request.
  349. repeated Agent agents = 1;
  350. // Token to retrieve the next page of results, or empty if there are no
  351. // more results in the list.
  352. string next_page_token = 2;
  353. }
  354. // The request message for [Agents.TrainAgent][google.cloud.dialogflow.v2.Agents.TrainAgent].
  355. message TrainAgentRequest {
  356. // Required. The project that the agent to train is associated with.
  357. // Format: `projects/<Project ID>`.
  358. string parent = 1 [
  359. (google.api.field_behavior) = REQUIRED,
  360. (google.api.resource_reference) = {
  361. child_type: "dialogflow.googleapis.com/Agent"
  362. }
  363. ];
  364. }
  365. // The request message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
  366. message ExportAgentRequest {
  367. // Required. The project that the agent to export is associated with.
  368. // Format: `projects/<Project ID>`.
  369. string parent = 1 [
  370. (google.api.field_behavior) = REQUIRED,
  371. (google.api.resource_reference) = {
  372. child_type: "dialogflow.googleapis.com/Agent"
  373. }
  374. ];
  375. // Required. The [Google Cloud Storage](https://cloud.google.com/storage/docs/)
  376. // URI to export the agent to.
  377. // The format of this URI must be `gs://<bucket-name>/<object-name>`.
  378. // If left unspecified, the serialized agent is returned inline.
  379. string agent_uri = 2 [(google.api.field_behavior) = REQUIRED];
  380. }
  381. // The response message for [Agents.ExportAgent][google.cloud.dialogflow.v2.Agents.ExportAgent].
  382. message ExportAgentResponse {
  383. // The exported agent.
  384. oneof agent {
  385. // The URI to a file containing the exported agent. This field is populated
  386. // only if `agent_uri` is specified in `ExportAgentRequest`.
  387. string agent_uri = 1;
  388. // Zip compressed raw byte content for agent.
  389. bytes agent_content = 2;
  390. }
  391. }
  392. // The request message for [Agents.ImportAgent][google.cloud.dialogflow.v2.Agents.ImportAgent].
  393. message ImportAgentRequest {
  394. // Required. The project that the agent to import is associated with.
  395. // Format: `projects/<Project ID>`.
  396. string parent = 1 [
  397. (google.api.field_behavior) = REQUIRED,
  398. (google.api.resource_reference) = {
  399. child_type: "dialogflow.googleapis.com/Agent"
  400. }
  401. ];
  402. // Required. The agent to import.
  403. oneof agent {
  404. // The URI to a Google Cloud Storage file containing the agent to import.
  405. // Note: The URI must start with "gs://".
  406. string agent_uri = 2;
  407. // Zip compressed raw byte content for agent.
  408. bytes agent_content = 3;
  409. }
  410. }
  411. // The request message for [Agents.RestoreAgent][google.cloud.dialogflow.v2.Agents.RestoreAgent].
  412. message RestoreAgentRequest {
  413. // Required. The project that the agent to restore is associated with.
  414. // Format: `projects/<Project ID>`.
  415. string parent = 1 [
  416. (google.api.field_behavior) = REQUIRED,
  417. (google.api.resource_reference) = {
  418. child_type: "dialogflow.googleapis.com/Agent"
  419. }
  420. ];
  421. // Required. The agent to restore.
  422. oneof agent {
  423. // The URI to a Google Cloud Storage file containing the agent to restore.
  424. // Note: The URI must start with "gs://".
  425. string agent_uri = 2;
  426. // Zip compressed raw byte content for agent.
  427. bytes agent_content = 3;
  428. }
  429. }
  430. // The request message for [Agents.GetValidationResult][google.cloud.dialogflow.v2.Agents.GetValidationResult].
  431. message GetValidationResultRequest {
  432. // Required. The project that the agent is associated with.
  433. // Format: `projects/<Project ID>`.
  434. string parent = 1 [
  435. (google.api.field_behavior) = REQUIRED,
  436. (google.api.resource_reference) = {
  437. child_type: "dialogflow.googleapis.com/Agent"
  438. }
  439. ];
  440. // Optional. The language for which you want a validation result. If not
  441. // specified, the agent's default language is used. [Many
  442. // languages](https://cloud.google.com/dialogflow/docs/reference/language)
  443. // are supported. Note: languages must be enabled in the agent before they can
  444. // be used.
  445. string language_code = 3 [(google.api.field_behavior) = OPTIONAL];
  446. }