xref: /aosp_15_r20/external/googleapis/google/cloud/discoveryengine/v1/conversational_search_service.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.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/discoveryengine/v1/conversation.proto";
24import "google/cloud/discoveryengine/v1/search_service.proto";
25import "google/protobuf/empty.proto";
26import "google/protobuf/field_mask.proto";
27
28option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1";
29option go_package = "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb";
30option java_multiple_files = true;
31option java_outer_classname = "ConversationalSearchServiceProto";
32option java_package = "com.google.cloud.discoveryengine.v1";
33option objc_class_prefix = "DISCOVERYENGINE";
34option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1";
35option ruby_package = "Google::Cloud::DiscoveryEngine::V1";
36
37// Service for conversational search.
38service ConversationalSearchService {
39  option (google.api.default_host) = "discoveryengine.googleapis.com";
40  option (google.api.oauth_scopes) =
41      "https://www.googleapis.com/auth/cloud-platform";
42
43  // Converses a conversation.
44  rpc ConverseConversation(ConverseConversationRequest)
45      returns (ConverseConversationResponse) {
46    option (google.api.http) = {
47      post: "/v1/{name=projects/*/locations/*/dataStores/*/conversations/*}:converse"
48      body: "*"
49      additional_bindings {
50        post: "/v1/{name=projects/*/locations/*/collections/*/dataStores/*/conversations/*}:converse"
51        body: "*"
52      }
53      additional_bindings {
54        post: "/v1/{name=projects/*/locations/*/collections/*/engines/*/conversations/*}:converse"
55        body: "*"
56      }
57    };
58    option (google.api.method_signature) = "name,query";
59  }
60
61  // Creates a Conversation.
62  //
63  // If the [Conversation][google.cloud.discoveryengine.v1.Conversation] to
64  // create already exists, an ALREADY_EXISTS error is returned.
65  rpc CreateConversation(CreateConversationRequest) returns (Conversation) {
66    option (google.api.http) = {
67      post: "/v1/{parent=projects/*/locations/*/dataStores/*}/conversations"
68      body: "conversation"
69      additional_bindings {
70        post: "/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/conversations"
71        body: "conversation"
72      }
73      additional_bindings {
74        post: "/v1/{parent=projects/*/locations/*/collections/*/engines/*}/conversations"
75        body: "conversation"
76      }
77    };
78    option (google.api.method_signature) = "parent,conversation";
79  }
80
81  // Deletes a Conversation.
82  //
83  // If the [Conversation][google.cloud.discoveryengine.v1.Conversation] to
84  // delete does not exist, a NOT_FOUND error is returned.
85  rpc DeleteConversation(DeleteConversationRequest)
86      returns (google.protobuf.Empty) {
87    option (google.api.http) = {
88      delete: "/v1/{name=projects/*/locations/*/dataStores/*/conversations/*}"
89      additional_bindings {
90        delete: "/v1/{name=projects/*/locations/*/collections/*/dataStores/*/conversations/*}"
91      }
92      additional_bindings {
93        delete: "/v1/{name=projects/*/locations/*/collections/*/engines/*/conversations/*}"
94      }
95    };
96    option (google.api.method_signature) = "name";
97  }
98
99  // Updates a Conversation.
100  //
101  // [Conversation][google.cloud.discoveryengine.v1.Conversation] action type
102  // cannot be changed. If the
103  // [Conversation][google.cloud.discoveryengine.v1.Conversation] to update does
104  // not exist, a NOT_FOUND error is returned.
105  rpc UpdateConversation(UpdateConversationRequest) returns (Conversation) {
106    option (google.api.http) = {
107      patch: "/v1/{conversation.name=projects/*/locations/*/dataStores/*/conversations/*}"
108      body: "conversation"
109      additional_bindings {
110        patch: "/v1/{conversation.name=projects/*/locations/*/collections/*/dataStores/*/conversations/*}"
111        body: "conversation"
112      }
113      additional_bindings {
114        patch: "/v1/{conversation.name=projects/*/locations/*/collections/*/engines/*/conversations/*}"
115        body: "conversation"
116      }
117    };
118    option (google.api.method_signature) = "conversation,update_mask";
119  }
120
121  // Gets a Conversation.
122  rpc GetConversation(GetConversationRequest) returns (Conversation) {
123    option (google.api.http) = {
124      get: "/v1/{name=projects/*/locations/*/dataStores/*/conversations/*}"
125      additional_bindings {
126        get: "/v1/{name=projects/*/locations/*/collections/*/dataStores/*/conversations/*}"
127      }
128      additional_bindings {
129        get: "/v1/{name=projects/*/locations/*/collections/*/engines/*/conversations/*}"
130      }
131    };
132    option (google.api.method_signature) = "name";
133  }
134
135  // Lists all Conversations by their parent
136  // [DataStore][google.cloud.discoveryengine.v1.DataStore].
137  rpc ListConversations(ListConversationsRequest)
138      returns (ListConversationsResponse) {
139    option (google.api.http) = {
140      get: "/v1/{parent=projects/*/locations/*/dataStores/*}/conversations"
141      additional_bindings {
142        get: "/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/conversations"
143      }
144      additional_bindings {
145        get: "/v1/{parent=projects/*/locations/*/collections/*/engines/*}/conversations"
146      }
147    };
148    option (google.api.method_signature) = "parent";
149  }
150}
151
152// Request message for
153// [ConversationalSearchService.ConverseConversation][google.cloud.discoveryengine.v1.ConversationalSearchService.ConverseConversation]
154// method.
155message ConverseConversationRequest {
156  // Required. The resource name of the Conversation to get. Format:
157  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`.
158  // Use
159  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/-`
160  // to activate auto session mode, which automatically creates a new
161  // conversation inside a ConverseConversation session.
162  string name = 1 [
163    (google.api.field_behavior) = REQUIRED,
164    (google.api.resource_reference) = {
165      type: "discoveryengine.googleapis.com/Conversation"
166    }
167  ];
168
169  // Required. Current user input.
170  TextInput query = 2 [(google.api.field_behavior) = REQUIRED];
171
172  // The resource name of the Serving Config to use. Format:
173  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/servingConfigs/{serving_config_id}`
174  // If this is not set, the default serving config will be used.
175  string serving_config = 3 [(google.api.resource_reference) = {
176    type: "discoveryengine.googleapis.com/ServingConfig"
177  }];
178
179  // The conversation to be used by auto session only. The name field will be
180  // ignored as we automatically assign new name for the conversation in auto
181  // session.
182  Conversation conversation = 5;
183
184  // Whether to turn on safe search.
185  bool safe_search = 6;
186
187  // The user labels applied to a resource must meet the following requirements:
188  //
189  // * Each resource can have multiple labels, up to a maximum of 64.
190  // * Each label must be a key-value pair.
191  // * Keys have a minimum length of 1 character and a maximum length of 63
192  //   characters and cannot be empty. Values can be empty and have a maximum
193  //   length of 63 characters.
194  // * Keys and values can contain only lowercase letters, numeric characters,
195  //   underscores, and dashes. All characters must use UTF-8 encoding, and
196  //   international characters are allowed.
197  // * The key portion of a label must be unique. However, you can use the same
198  //   key with multiple resources.
199  // * Keys must start with a lowercase letter or international character.
200  //
201  // See [Google Cloud
202  // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
203  // for more details.
204  map<string, string> user_labels = 7;
205
206  // A specification for configuring the summary returned in the response.
207  SearchRequest.ContentSearchSpec.SummarySpec summary_spec = 8;
208
209  // The filter syntax consists of an expression language for constructing a
210  // predicate from one or more fields of the documents being filtered. Filter
211  // expression is case-sensitive. This will be used to filter search results
212  // which may affect the summary response.
213  //
214  // If this field is unrecognizable, an  `INVALID_ARGUMENT`  is returned.
215  //
216  // Filtering in Vertex AI Search is done by mapping the LHS filter key to a
217  // key property defined in the Vertex AI Search backend -- this mapping is
218  // defined by the customer in their schema. For example a media customer might
219  // have a field 'name' in their schema. In this case the filter would look
220  // like this: filter --> name:'ANY("king kong")'
221  //
222  // For more information about filtering including syntax and filter
223  // operators, see
224  // [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
225  string filter = 9;
226
227  // Boost specification to boost certain documents in search results which may
228  // affect the converse response. For more information on boosting, see
229  // [Boosting](https://cloud.google.com/retail/docs/boosting#boost)
230  SearchRequest.BoostSpec boost_spec = 10;
231}
232
233// Response message for
234// [ConversationalSearchService.ConverseConversation][google.cloud.discoveryengine.v1.ConversationalSearchService.ConverseConversation]
235// method.
236message ConverseConversationResponse {
237  // Answer to the current query.
238  Reply reply = 1;
239
240  // Updated conversation including the answer.
241  Conversation conversation = 2;
242
243  // Search Results.
244  repeated SearchResponse.SearchResult search_results = 3;
245}
246
247// Request for CreateConversation method.
248message CreateConversationRequest {
249  // Required. Full resource name of parent data store. Format:
250  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
251  string parent = 1 [
252    (google.api.field_behavior) = REQUIRED,
253    (google.api.resource_reference) = {
254      type: "discoveryengine.googleapis.com/DataStore"
255    }
256  ];
257
258  // Required. The conversation to create.
259  Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED];
260}
261
262// Request for UpdateConversation method.
263message UpdateConversationRequest {
264  // Required. The Conversation to update.
265  Conversation conversation = 1 [(google.api.field_behavior) = REQUIRED];
266
267  // Indicates which fields in the provided
268  // [Conversation][google.cloud.discoveryengine.v1.Conversation] to update. The
269  // following are NOT supported:
270  //
271  // * [Conversation.name][google.cloud.discoveryengine.v1.Conversation.name]
272  //
273  // If not set or empty, all supported fields are updated.
274  google.protobuf.FieldMask update_mask = 2;
275}
276
277// Request for DeleteConversation method.
278message DeleteConversationRequest {
279  // Required. The resource name of the Conversation to delete. Format:
280  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
281  string name = 1 [
282    (google.api.field_behavior) = REQUIRED,
283    (google.api.resource_reference) = {
284      type: "discoveryengine.googleapis.com/Conversation"
285    }
286  ];
287}
288
289// Request for GetConversation method.
290message GetConversationRequest {
291  // Required. The resource name of the Conversation to get. Format:
292  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/conversations/{conversation_id}`
293  string name = 1 [
294    (google.api.field_behavior) = REQUIRED,
295    (google.api.resource_reference) = {
296      type: "discoveryengine.googleapis.com/Conversation"
297    }
298  ];
299}
300
301// Request for ListConversations method.
302message ListConversationsRequest {
303  // Required. The data store resource name. Format:
304  // `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}`
305  string parent = 1 [
306    (google.api.field_behavior) = REQUIRED,
307    (google.api.resource_reference) = {
308      type: "discoveryengine.googleapis.com/DataStore"
309    }
310  ];
311
312  // Maximum number of results to return. If unspecified, defaults
313  // to 50. Max allowed value is 1000.
314  int32 page_size = 2;
315
316  // A page token, received from a previous `ListConversations` call.
317  // Provide this to retrieve the subsequent page.
318  string page_token = 3;
319
320  // A filter to apply on the list results. The supported features are:
321  // user_pseudo_id, state.
322  //
323  // Example:
324  // "user_pseudo_id = some_id"
325  string filter = 4;
326
327  // A comma-separated list of fields to order by, sorted in ascending order.
328  // Use "desc" after a field name for descending.
329  // Supported fields:
330  //   * `update_time`
331  //   * `create_time`
332  //   * `conversation_name`
333  //
334  // Example:
335  // "update_time desc"
336  // "create_time"
337  string order_by = 5;
338}
339
340// Response for ListConversations method.
341message ListConversationsResponse {
342  // All the Conversations for a given data store.
343  repeated Conversation conversations = 1;
344
345  // Pagination token, if not returned indicates the last page.
346  string next_page_token = 2;
347}
348