agent.proto 21 KB

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