conversation.proto 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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.v2beta1;
  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/v2beta1/gcs.proto";
  21. import "google/cloud/dialogflow/v2beta1/participant.proto";
  22. import "google/cloud/dialogflow/v2beta1/session.proto";
  23. import "google/longrunning/operations.proto";
  24. import "google/protobuf/empty.proto";
  25. import "google/protobuf/field_mask.proto";
  26. import "google/protobuf/timestamp.proto";
  27. import "google/rpc/status.proto";
  28. option cc_enable_arenas = true;
  29. option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
  30. option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
  31. option java_multiple_files = true;
  32. option java_outer_classname = "ConversationProto";
  33. option java_package = "com.google.cloud.dialogflow.v2beta1";
  34. option objc_class_prefix = "DF";
  35. // Service for managing [Conversations][google.cloud.dialogflow.v2beta1.Conversation].
  36. service Conversations {
  37. option (google.api.default_host) = "dialogflow.googleapis.com";
  38. option (google.api.oauth_scopes) =
  39. "https://www.googleapis.com/auth/cloud-platform,"
  40. "https://www.googleapis.com/auth/dialogflow";
  41. // Creates a new conversation. Conversations are auto-completed after 24
  42. // hours.
  43. //
  44. // Conversation Lifecycle:
  45. // There are two stages during a conversation: Automated Agent Stage and
  46. // Assist Stage.
  47. //
  48. // For Automated Agent Stage, there will be a dialogflow agent responding to
  49. // user queries.
  50. //
  51. // For Assist Stage, there's no dialogflow agent responding to user queries.
  52. // But we will provide suggestions which are generated from conversation.
  53. //
  54. // If [Conversation.conversation_profile][google.cloud.dialogflow.v2beta1.Conversation.conversation_profile] is configured for a dialogflow
  55. // agent, conversation will start from `Automated Agent Stage`, otherwise, it
  56. // will start from `Assist Stage`. And during `Automated Agent Stage`, once an
  57. // [Intent][google.cloud.dialogflow.v2beta1.Intent] with [Intent.live_agent_handoff][google.cloud.dialogflow.v2beta1.Intent.live_agent_handoff] is triggered, conversation
  58. // will transfer to Assist Stage.
  59. rpc CreateConversation(CreateConversationRequest) returns (Conversation) {
  60. option (google.api.http) = {
  61. post: "/v2beta1/{parent=projects/*}/conversations"
  62. body: "conversation"
  63. additional_bindings {
  64. post: "/v2beta1/{parent=projects/*/locations/*}/conversations"
  65. body: "conversation"
  66. }
  67. };
  68. option (google.api.method_signature) = "parent,conversation";
  69. }
  70. // Returns the list of all conversations in the specified project.
  71. rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) {
  72. option (google.api.http) = {
  73. get: "/v2beta1/{parent=projects/*}/conversations"
  74. additional_bindings {
  75. get: "/v2beta1/{parent=projects/*/locations/*}/conversations"
  76. }
  77. };
  78. option (google.api.method_signature) = "parent";
  79. }
  80. // Retrieves the specific conversation.
  81. rpc GetConversation(GetConversationRequest) returns (Conversation) {
  82. option (google.api.http) = {
  83. get: "/v2beta1/{name=projects/*/conversations/*}"
  84. additional_bindings {
  85. get: "/v2beta1/{name=projects/*/locations/*/conversations/*}"
  86. }
  87. };
  88. option (google.api.method_signature) = "name";
  89. }
  90. // Completes the specified conversation. Finished conversations are purged
  91. // from the database after 30 days.
  92. rpc CompleteConversation(CompleteConversationRequest) returns (Conversation) {
  93. option (google.api.http) = {
  94. post: "/v2beta1/{name=projects/*/conversations/*}:complete"
  95. body: "*"
  96. additional_bindings {
  97. post: "/v2beta1/{name=projects/*/locations/*/conversations/*}:complete"
  98. body: "*"
  99. }
  100. };
  101. option (google.api.method_signature) = "name";
  102. }
  103. // Batch ingests messages to conversation. Customers can use this RPC to
  104. // ingest historical messages to conversation.
  105. rpc BatchCreateMessages(BatchCreateMessagesRequest) returns (BatchCreateMessagesResponse) {
  106. option (google.api.http) = {
  107. post: "/v2beta1/{parent=projects/*/conversations/*}/messages:batchCreate"
  108. body: "*"
  109. additional_bindings {
  110. post: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages:batchCreate"
  111. body: "*"
  112. }
  113. };
  114. option (google.api.method_signature) = "parent";
  115. }
  116. // Lists messages that belong to a given conversation.
  117. // `messages` are ordered by `create_time` in descending order. To fetch
  118. // updates without duplication, send request with filter
  119. // `create_time_epoch_microseconds >
  120. // [first item's create_time of previous request]` and empty page_token.
  121. rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse) {
  122. option (google.api.http) = {
  123. get: "/v2beta1/{parent=projects/*/conversations/*}/messages"
  124. additional_bindings {
  125. get: "/v2beta1/{parent=projects/*/locations/*/conversations/*}/messages"
  126. }
  127. };
  128. option (google.api.method_signature) = "parent";
  129. }
  130. }
  131. // Represents a conversation.
  132. // A conversation is an interaction between an agent, including live agents
  133. // and Dialogflow agents, and a support customer. Conversations can
  134. // include phone calls and text-based chat sessions.
  135. message Conversation {
  136. option (google.api.resource) = {
  137. type: "dialogflow.googleapis.com/Conversation"
  138. pattern: "projects/{project}/conversations/{conversation}"
  139. pattern: "projects/{project}/locations/{location}/conversations/{conversation}"
  140. };
  141. // Enumeration of the completion status of the conversation.
  142. enum LifecycleState {
  143. // Unknown.
  144. LIFECYCLE_STATE_UNSPECIFIED = 0;
  145. // Conversation is currently open for media analysis.
  146. IN_PROGRESS = 1;
  147. // Conversation has been completed.
  148. COMPLETED = 2;
  149. }
  150. // Enumeration of the different conversation stages a conversation can be in.
  151. // Reference:
  152. // https://cloud.google.com/dialogflow/priv/docs/contact-center/basics#stages
  153. enum ConversationStage {
  154. // Unknown. Should never be used after a conversation is successfully
  155. // created.
  156. CONVERSATION_STAGE_UNSPECIFIED = 0;
  157. // The conversation should return virtual agent responses into the
  158. // conversation.
  159. VIRTUAL_AGENT_STAGE = 1;
  160. // The conversation should not provide responses, just listen and provide
  161. // suggestions.
  162. HUMAN_ASSIST_STAGE = 2;
  163. }
  164. // Output only. The unique identifier of this conversation.
  165. // Format: `projects/<Project ID>/locations/<Location
  166. // ID>/conversations/<Conversation ID>`.
  167. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  168. // Output only. The current state of the Conversation.
  169. LifecycleState lifecycle_state = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  170. // Required. The Conversation Profile to be used to configure this
  171. // Conversation. This field cannot be updated.
  172. // Format: `projects/<Project ID>/locations/<Location
  173. // ID>/conversationProfiles/<Conversation Profile ID>`.
  174. string conversation_profile = 3 [
  175. (google.api.field_behavior) = REQUIRED,
  176. (google.api.resource_reference) = {
  177. type: "dialogflow.googleapis.com/ConversationProfile"
  178. }
  179. ];
  180. // Output only. Required if the conversation is to be connected over
  181. // telephony.
  182. ConversationPhoneNumber phone_number = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  183. // The stage of a conversation. It indicates whether the virtual agent or a
  184. // human agent is handling the conversation.
  185. //
  186. // If the conversation is created with the conversation profile that has
  187. // Dialogflow config set, defaults to
  188. // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE]; Otherwise, defaults to
  189. // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE].
  190. //
  191. // If the conversation is created with the conversation profile that has
  192. // Dialogflow config set but explicitly sets conversation_stage to
  193. // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE], it skips
  194. // [ConversationStage.VIRTUAL_AGENT_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.VIRTUAL_AGENT_STAGE] stage and directly goes to
  195. // [ConversationStage.HUMAN_ASSIST_STAGE][google.cloud.dialogflow.v2beta1.Conversation.ConversationStage.HUMAN_ASSIST_STAGE].
  196. ConversationStage conversation_stage = 7;
  197. // Output only. The time the conversation was started.
  198. google.protobuf.Timestamp start_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  199. // Output only. The time the conversation was finished.
  200. google.protobuf.Timestamp end_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  201. }
  202. // Represents a phone number for telephony integration. It allows for connecting
  203. // a particular conversation over telephony.
  204. message ConversationPhoneNumber {
  205. // Output only. The phone number to connect to this conversation.
  206. string phone_number = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  207. }
  208. // The request message for [Conversations.CreateConversation][google.cloud.dialogflow.v2beta1.Conversations.CreateConversation].
  209. message CreateConversationRequest {
  210. // Required. Resource identifier of the project creating the conversation.
  211. // Format: `projects/<Project ID>/locations/<Location ID>`.
  212. string parent = 1 [
  213. (google.api.field_behavior) = REQUIRED,
  214. (google.api.resource_reference) = {
  215. child_type: "dialogflow.googleapis.com/Conversation"
  216. }
  217. ];
  218. // Required. The conversation to create.
  219. Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED];
  220. // Optional. Identifier of the conversation. Generally it's auto generated by Google.
  221. // Only set it if you cannot wait for the response to return a
  222. // auto-generated one to you.
  223. //
  224. // The conversation ID must be compliant with the regression fomula
  225. // "[a-zA-Z][a-zA-Z0-9_-]*" with the characters length in range of [3,64].
  226. // If the field is provided, the caller is resposible for
  227. // 1. the uniqueness of the ID, otherwise the request will be rejected.
  228. // 2. the consistency for whether to use custom ID or not under a project to
  229. // better ensure uniqueness.
  230. string conversation_id = 3 [(google.api.field_behavior) = OPTIONAL];
  231. }
  232. // The request message for [Conversations.ListConversations][google.cloud.dialogflow.v2beta1.Conversations.ListConversations].
  233. message ListConversationsRequest {
  234. // Required. The project from which to list all conversation.
  235. // Format: `projects/<Project ID>/locations/<Location ID>`.
  236. string parent = 1 [
  237. (google.api.field_behavior) = REQUIRED,
  238. (google.api.resource_reference) = {
  239. child_type: "dialogflow.googleapis.com/Conversation"
  240. }
  241. ];
  242. // Optional. The maximum number of items to return in a single page. By
  243. // default 100 and at most 1000.
  244. int32 page_size = 2;
  245. // Optional. The next_page_token value returned from a previous list request.
  246. string page_token = 3;
  247. // A filter expression that filters conversations listed in the response. In
  248. // general, the expression must specify the field name, a comparison operator,
  249. // and the value to use for filtering:
  250. // <ul>
  251. // <li>The value must be a string, a number, or a boolean.</li>
  252. // <li>The comparison operator must be either `=`,`!=`, `>`, or `<`.</li>
  253. // <li>To filter on multiple expressions, separate the
  254. // expressions with `AND` or `OR` (omitting both implies `AND`).</li>
  255. // <li>For clarity, expressions can be enclosed in parentheses.</li>
  256. // </ul>
  257. // Only `lifecycle_state` can be filtered on in this way. For example,
  258. // the following expression only returns `COMPLETED` conversations:
  259. //
  260. // `lifecycle_state = "COMPLETED"`
  261. //
  262. // For more information about filtering, see
  263. // [API Filtering](https://aip.dev/160).
  264. string filter = 4;
  265. }
  266. // The response message for [Conversations.ListConversations][google.cloud.dialogflow.v2beta1.Conversations.ListConversations].
  267. message ListConversationsResponse {
  268. // The list of conversations. There will be a maximum number of items
  269. // returned based on the page_size field in the request.
  270. repeated Conversation conversations = 1;
  271. // Token to retrieve the next page of results, or empty if there are no
  272. // more results in the list.
  273. string next_page_token = 2;
  274. }
  275. // The request message for [Conversations.GetConversation][google.cloud.dialogflow.v2beta1.Conversations.GetConversation].
  276. message GetConversationRequest {
  277. // Required. The name of the conversation. Format:
  278. // `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation
  279. // ID>`.
  280. string name = 1 [
  281. (google.api.field_behavior) = REQUIRED,
  282. (google.api.resource_reference) = {
  283. type: "dialogflow.googleapis.com/Conversation"
  284. }
  285. ];
  286. }
  287. // The request message for [Conversations.CompleteConversation][google.cloud.dialogflow.v2beta1.Conversations.CompleteConversation].
  288. message CompleteConversationRequest {
  289. // Required. Resource identifier of the conversation to close.
  290. // Format: `projects/<Project ID>/locations/<Location
  291. // ID>/conversations/<Conversation ID>`.
  292. string name = 1 [
  293. (google.api.field_behavior) = REQUIRED,
  294. (google.api.resource_reference) = {
  295. type: "dialogflow.googleapis.com/Conversation"
  296. }
  297. ];
  298. }
  299. // The request message to create one Message. Currently it is only used in
  300. // BatchCreateMessagesRequest.
  301. message CreateMessageRequest {
  302. // Required. Resource identifier of the conversation to create message.
  303. // Format: `projects/<Project ID>/locations/<Location
  304. // ID>/conversations/<Conversation ID>`.
  305. string parent = 1 [
  306. (google.api.field_behavior) = REQUIRED,
  307. (google.api.resource_reference) = {
  308. type: "dialogflow.googleapis.com/Conversation"
  309. }
  310. ];
  311. // Required. The message to create.
  312. // [Message.participant][google.cloud.dialogflow.v2beta1.Message.participant] is required.
  313. Message message = 2 [(google.api.field_behavior) = REQUIRED];
  314. }
  315. // The request message for [Conversations.BatchCreateMessagesRequest][].
  316. message BatchCreateMessagesRequest {
  317. // Required. Resource identifier of the conversation to create message.
  318. // Format: `projects/<Project ID>/locations/<Location
  319. // ID>/conversations/<Conversation ID>`.
  320. string parent = 1 [
  321. (google.api.field_behavior) = REQUIRED,
  322. (google.api.resource_reference) = {
  323. type: "dialogflow.googleapis.com/Conversation"
  324. }
  325. ];
  326. // Required. A maximum of 1000 Messages can be created in a batch.
  327. // [CreateMessageRequest.message.send_time][] is required. All created
  328. // messages will have identical [Message.create_time][google.cloud.dialogflow.v2beta1.Message.create_time].
  329. repeated CreateMessageRequest requests = 2 [(google.api.field_behavior) = REQUIRED];
  330. }
  331. // The request message for [Conversations.BatchCreateMessagesResponse][].
  332. message BatchCreateMessagesResponse {
  333. // Messages created.
  334. repeated Message messages = 1;
  335. }
  336. // The request message for [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages].
  337. message ListMessagesRequest {
  338. // Required. The name of the conversation to list messages for.
  339. // Format: `projects/<Project ID>/locations/<Location
  340. // ID>/conversations/<Conversation ID>`
  341. string parent = 1 [
  342. (google.api.field_behavior) = REQUIRED,
  343. (google.api.resource_reference) = {
  344. child_type: "dialogflow.googleapis.com/Message"
  345. }
  346. ];
  347. // Optional. Filter on message fields. Currently predicates on `create_time`
  348. // and `create_time_epoch_microseconds` are supported. `create_time` only
  349. // support milliseconds accuracy. E.g.,
  350. // `create_time_epoch_microseconds > 1551790877964485` or
  351. // `create_time > "2017-01-15T01:30:15.01Z"`.
  352. //
  353. // For more information about filtering, see
  354. // [API Filtering](https://aip.dev/160).
  355. string filter = 4;
  356. // Optional. The maximum number of items to return in a single page. By
  357. // default 100 and at most 1000.
  358. int32 page_size = 2;
  359. // Optional. The next_page_token value returned from a previous list request.
  360. string page_token = 3;
  361. }
  362. // The response message for [Conversations.ListMessages][google.cloud.dialogflow.v2beta1.Conversations.ListMessages].
  363. message ListMessagesResponse {
  364. // Required. The list of messages. There will be a maximum number of items
  365. // returned based on the page_size field in the request.
  366. // `messages` is sorted by `create_time` in descending order.
  367. repeated Message messages = 1;
  368. // Optional. Token to retrieve the next page of results, or empty if there are
  369. // no more results in the list.
  370. string next_page_token = 2;
  371. }