conversation.proto 20 KB

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