@@ -20,9 +20,12 @@ import "google/api/annotations.proto";
2020import "google/api/client.proto" ;
2121import "google/api/field_behavior.proto" ;
2222import "google/api/resource.proto" ;
23+ import "google/cloud/discoveryengine/v1beta/common.proto" ;
24+ import "google/cloud/discoveryengine/v1beta/document.proto" ;
2325import "google/cloud/discoveryengine/v1beta/import_config.proto" ;
2426import "google/cloud/discoveryengine/v1beta/purge_config.proto" ;
2527import "google/longrunning/operations.proto" ;
28+ import "google/protobuf/timestamp.proto" ;
2629
2730option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta" ;
2831option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb" ;
@@ -49,6 +52,23 @@ service CompletionService {
4952 };
5053 }
5154
55+ // Completes the user input with advanced keyword suggestions.
56+ rpc AdvancedCompleteQuery (AdvancedCompleteQueryRequest )
57+ returns (AdvancedCompleteQueryResponse ) {
58+ option (google.api.http ) = {
59+ post : "/v1beta/{completion_config=projects/*/locations/*/dataStores/*/completionConfig}:completeQuery"
60+ body : "*"
61+ additional_bindings {
62+ post : "/v1beta/{completion_config=projects/*/locations/*/collections/*/dataStores/*/completionConfig}:completeQuery"
63+ body : "*"
64+ }
65+ additional_bindings {
66+ post : "/v1beta/{completion_config=projects/*/locations/*/collections/*/engines/*/completionConfig}:completeQuery"
67+ body : "*"
68+ }
69+ };
70+ }
71+
5272 // Imports all
5373 // [SuggestionDenyListEntry][google.cloud.discoveryengine.v1beta.SuggestionDenyListEntry]
5474 // for a DataStore.
@@ -212,3 +232,257 @@ message CompleteQueryResponse {
212232 // must be true and there must be no suggestions that match the full query.
213233 bool tail_match_triggered = 2 ;
214234}
235+
236+ // Request message for
237+ // [CompletionService.AdvancedCompleteQuery][google.cloud.discoveryengine.v1beta.CompletionService.AdvancedCompleteQuery]
238+ // method.
239+ // .
240+ message AdvancedCompleteQueryRequest {
241+ // Specification to boost suggestions based on the condtion of the suggestion.
242+ message BoostSpec {
243+ // Boost applies to suggestions which match a condition.
244+ message ConditionBoostSpec {
245+ // An expression which specifies a boost condition. The syntax is the same
246+ // as [filter expression
247+ // syntax](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata#filter-expression-syntax).
248+ // Currently, the only supported condition is a list of BCP-47 lang codes.
249+ //
250+ // Example:
251+ //
252+ // * To boost suggestions in languages `en` or `fr`:
253+ // `(lang_code: ANY("en", "fr"))`
254+ string condition = 1 ;
255+
256+ // Strength of the boost, which should be in [-1, 1].
257+ // Negative boost means demotion. Default is 0.0.
258+ //
259+ // Setting to 1.0 gives the suggestions a big promotion. However, it does
260+ // not necessarily mean that the top result will be a boosted suggestion.
261+ //
262+ // Setting to -1.0 gives the suggestions a big demotion. However, other
263+ // suggestions that are relevant might still be shown.
264+ //
265+ // Setting to 0.0 means no boost applied. The boosting condition is
266+ // ignored.
267+ float boost = 2 ;
268+ }
269+
270+ // Condition boost specifications. If a suggestion matches multiple
271+ // conditions in the specifictions, boost values from these specifications
272+ // are all applied and combined in a non-linear way. Maximum number of
273+ // specifications is 20.
274+ //
275+ // Note: Currently only support language condition boost.
276+ repeated ConditionBoostSpec condition_boost_specs = 1 ;
277+ }
278+
279+ // Suggestion type to return.
280+ enum SuggestionType {
281+ // Default value.
282+ SUGGESTION_TYPE_UNSPECIFIED = 0 ;
283+
284+ // Returns query suggestions.
285+ QUERY = 1 ;
286+
287+ // Returns people suggestions.
288+ PEOPLE = 2 ;
289+
290+ // Returns content suggestions.
291+ CONTENT = 3 ;
292+
293+ // Returns recent search suggestions.
294+ RECENT_SEARCH = 4 ;
295+
296+ // Returns Google Workspace suggestions.
297+ GOOGLE_WORKSPACE = 5 ;
298+ }
299+
300+ // Required. The completion_config of the parent dataStore or engine resource
301+ // name for which the completion is performed, such as
302+ // `projects/*/locations/global/collections/default_collection/dataStores/*/completionConfig`
303+ // `projects/*/locations/global/collections/default_collection/engines/*/completionConfig`.
304+ string completion_config = 1 [
305+ (google.api.field_behavior ) = REQUIRED ,
306+ (google.api.resource_reference ) = {
307+ type : "discoveryengine.googleapis.com/CompletionConfig"
308+ }
309+ ];
310+
311+ // Required. The typeahead input used to fetch suggestions. Maximum length is
312+ // 128 characters.
313+ //
314+ // The query can not be empty for most of the suggestion types. If it is
315+ // empty, an `INVALID_ARGUMENT` error is returned. The exception is when the
316+ // suggestion_types contains only the type `RECENT_SEARCH`, the query can
317+ // be an empty string. The is called "zero prefix" feature, which returns
318+ // user's recently searched queries given the empty query.
319+ string query = 2 [(google.api.field_behavior ) = REQUIRED ];
320+
321+ // Specifies the autocomplete data model. This overrides any model specified
322+ // in the Configuration > Autocomplete section of the Cloud console. Currently
323+ // supported values:
324+ //
325+ // * `document` - Using suggestions generated from user-imported documents.
326+ // * `search-history` - Using suggestions generated from the past history of
327+ // [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
328+ // API calls. Do not use it when there is no traffic for Search API.
329+ // * `user-event` - Using suggestions generated from user-imported search
330+ // events.
331+ // * `document-completable` - Using suggestions taken directly from
332+ // user-imported document fields marked as completable.
333+ //
334+ // Default values:
335+ //
336+ // * `document` is the default model for regular dataStores.
337+ // * `search-history` is the default model for site search dataStores.
338+ string query_model = 3 ;
339+
340+ // A unique identifier for tracking visitors. For example, this could be
341+ // implemented with an HTTP cookie, which should be able to uniquely identify
342+ // a visitor on a single device. This unique identifier should not change if
343+ // the visitor logs in or out of the website.
344+ //
345+ // This field should NOT have a fixed value such as `unknown_visitor`.
346+ //
347+ // This should be the same identifier as
348+ // [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id]
349+ // and
350+ // [SearchRequest.user_pseudo_id][google.cloud.discoveryengine.v1beta.SearchRequest.user_pseudo_id].
351+ //
352+ // The field must be a UTF-8 encoded string with a length limit of 128
353+ string user_pseudo_id = 4 ;
354+
355+ // Optional. Information about the end user.
356+ //
357+ // This should be the same identifier information as
358+ // [UserEvent.user_info][google.cloud.discoveryengine.v1beta.UserEvent.user_info]
359+ // and
360+ // [SearchRequest.user_info][google.cloud.discoveryengine.v1beta.SearchRequest.user_info].
361+ UserInfo user_info = 9 [(google.api.field_behavior ) = OPTIONAL ];
362+
363+ // Indicates if tail suggestions should be returned if there are no
364+ // suggestions that match the full query. Even if set to true, if there are
365+ // suggestions that match the full query, those are returned and no
366+ // tail suggestions are returned.
367+ bool include_tail_suggestions = 5 ;
368+
369+ // Optional. Specification to boost suggestions matching the condition.
370+ BoostSpec boost_spec = 6 [(google.api.field_behavior ) = OPTIONAL ];
371+
372+ // Optional. Suggestion types to return. If empty or unspecified, query
373+ // suggestions are returned. Only one suggestion type is supported at the
374+ // moment.
375+ repeated SuggestionType suggestion_types = 7
376+ [(google.api.field_behavior ) = OPTIONAL ];
377+ }
378+
379+ // Response message for
380+ // [CompletionService.AdvancedCompleteQuery][google.cloud.discoveryengine.v1beta.CompletionService.AdvancedCompleteQuery]
381+ // method.
382+ message AdvancedCompleteQueryResponse {
383+ // Suggestions as search queries.
384+ message QuerySuggestion {
385+ // The suggestion for the query.
386+ string suggestion = 1 ;
387+
388+ // The unique document field paths that serve as the source of this
389+ // suggestion if it was generated from completable fields.
390+ //
391+ // This field is only populated for the document-completable model.
392+ repeated string completable_field_paths = 2 ;
393+
394+ // The name of the dataStore that this suggestion belongs to.
395+ repeated string data_store = 3 ;
396+ }
397+
398+ // Suggestions as people.
399+ message PersonSuggestion {
400+ // The type of the person based on the source.
401+ enum PersonType {
402+ // Default value.
403+ PERSON_TYPE_UNSPECIFIED = 0 ;
404+
405+ // The suggestion is from a GOOGLE_IDENTITY source.
406+ CLOUD_IDENTITY = 1 ;
407+
408+ // The suggestion is from a THIRD_PARTY_IDENTITY source.
409+ THIRD_PARTY_IDENTITY = 2 ;
410+ }
411+
412+ // The suggestion for the query.
413+ string suggestion = 1 ;
414+
415+ // The type of the person.
416+ PersonType person_type = 2 ;
417+
418+ // The document data snippet in the suggestion. Only a subset of fields is
419+ // populated.
420+ Document document = 4 ;
421+
422+ // The name of the dataStore that this suggestion belongs to.
423+ string data_store = 5 [(google.api.resource_reference ) = {
424+ type : "discoveryengine.googleapis.com/DataStore"
425+ }];
426+ }
427+
428+ // Suggestions as content.
429+ message ContentSuggestion {
430+ // The type of the content returned for content suggestions.
431+ enum ContentType {
432+ // Default value.
433+ CONTENT_TYPE_UNSPECIFIED = 0 ;
434+
435+ // The suggestion is from a Google Workspace source.
436+ GOOGLE_WORKSPACE = 1 ;
437+
438+ // The suggestion is from a third party source.
439+ THIRD_PARTY = 2 ;
440+ }
441+
442+ // The suggestion for the query.
443+ string suggestion = 1 ;
444+
445+ // The type of the content suggestion.
446+ ContentType content_type = 2 ;
447+
448+ // The document data snippet in the suggestion. Only a subset of fields will
449+ // be populated.
450+ Document document = 4 ;
451+
452+ // The name of the dataStore that this suggestion belongs to.
453+ string data_store = 5 [(google.api.resource_reference ) = {
454+ type : "discoveryengine.googleapis.com/DataStore"
455+ }];
456+ }
457+
458+ // Suggestions from recent search history.
459+ message RecentSearchSuggestion {
460+ // The suggestion for the query.
461+ string suggestion = 1 ;
462+
463+ // The time when this recent rearch happened.
464+ google.protobuf.Timestamp recent_search_time = 2 ;
465+ }
466+
467+ // Results of the matched query suggestions. The result list is ordered and
468+ // the first result is a top suggestion.
469+ repeated QuerySuggestion query_suggestions = 1 ;
470+
471+ // True if the returned suggestions are all tail suggestions.
472+ //
473+ // For tail matching to be triggered, include_tail_suggestions in the request
474+ // must be true and there must be no suggestions that match the full query.
475+ bool tail_match_triggered = 2 ;
476+
477+ // Results of the matched people suggestions. The result list is ordered and
478+ // the first result is the top suggestion.
479+ repeated PersonSuggestion people_suggestions = 3 ;
480+
481+ // Results of the matched content suggestions. The result list is ordered and
482+ // the first result is the top suggestion.
483+ repeated ContentSuggestion content_suggestions = 4 ;
484+
485+ // Results of the matched "recent search" suggestions. The result list is
486+ // ordered and the first result is the top suggestion.
487+ repeated RecentSearchSuggestion recent_search_suggestions = 5 ;
488+ }
0 commit comments