xref: /aosp_15_r20/external/googleapis/google/cloud/discoveryengine/v1beta/conversation.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
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
15syntax = "proto3";
16
17package google.cloud.discoveryengine.v1beta;
18
19import "google/api/field_behavior.proto";
20import "google/api/resource.proto";
21import "google/cloud/discoveryengine/v1beta/search_service.proto";
22import "google/protobuf/timestamp.proto";
23
24option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
25option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb";
26option java_multiple_files = true;
27option java_outer_classname = "ConversationProto";
28option java_package = "com.google.cloud.discoveryengine.v1beta";
29option objc_class_prefix = "DISCOVERYENGINE";
30option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
31option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
32
33// External conversation proto definition.
34message Conversation {
35  option (google.api.resource) = {
36    type: "discoveryengine.googleapis.com/Conversation"
37    pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/conversations/{conversation}"
38    pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/conversations/{conversation}"
39    pattern: "projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/conversations/{conversation}"
40  };
41
42  // Enumeration of the state of the conversation.
43  enum State {
44    // Unknown.
45    STATE_UNSPECIFIED = 0;
46
47    // Conversation is currently open.
48    IN_PROGRESS = 1;
49
50    // Conversation has been completed.
51    COMPLETED = 2;
52  }
53
54  // Immutable. Fully qualified name
55  // `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*`
56  // or
57  // `project/*/locations/global/collections/{collection}/engines/*/conversations/*`.
58  string name = 1 [(google.api.field_behavior) = IMMUTABLE];
59
60  // The state of the Conversation.
61  State state = 2;
62
63  // A unique identifier for tracking users.
64  string user_pseudo_id = 3;
65
66  // Conversation messages.
67  repeated ConversationMessage messages = 4;
68
69  // Output only. The time the conversation started.
70  google.protobuf.Timestamp start_time = 5
71      [(google.api.field_behavior) = OUTPUT_ONLY];
72
73  // Output only. The time the conversation finished.
74  google.protobuf.Timestamp end_time = 6
75      [(google.api.field_behavior) = OUTPUT_ONLY];
76}
77
78// Defines a reply message to user.
79message Reply {
80  // Defines reference in reply.
81  message Reference {
82    option deprecated = true;
83
84    // URI link reference.
85    string uri = 1;
86
87    // Anchor text.
88    string anchor_text = 2;
89
90    // Anchor text start index.
91    int32 start = 3;
92
93    // Anchor text end index.
94    int32 end = 4;
95  }
96
97  // DEPRECATED: use `summary` instead.
98  // Text reply.
99  string reply = 1 [deprecated = true];
100
101  // References in the reply.
102  repeated Reference references = 2 [deprecated = true];
103
104  // Summary based on search results.
105  SearchResponse.Summary summary = 3;
106}
107
108// Defines context of the conversation
109message ConversationContext {
110  // The current list of documents the user is seeing.
111  // It contains the document resource references.
112  repeated string context_documents = 1;
113
114  // The current active document the user opened.
115  // It contains the document resource reference.
116  string active_document = 2;
117}
118
119// Defines text input.
120message TextInput {
121  // Text input.
122  string input = 1;
123
124  // Conversation context of the input.
125  ConversationContext context = 2;
126}
127
128// Defines a conversation message.
129message ConversationMessage {
130  oneof message {
131    // User text input.
132    TextInput user_input = 1;
133
134    // Search reply.
135    Reply reply = 2;
136  }
137
138  // Output only. Message creation timestamp.
139  google.protobuf.Timestamp create_time = 3
140      [(google.api.field_behavior) = OUTPUT_ONLY];
141}
142