xref: /aosp_15_r20/external/googleapis/google/cloud/discoveryengine/v1beta/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.v1beta;
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/v1beta/common.proto";
24import "google/cloud/discoveryengine/v1beta/document.proto";
25import "google/protobuf/struct.proto";
26
27option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
28option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb";
29option java_multiple_files = true;
30option java_outer_classname = "SearchServiceProto";
31option java_package = "com.google.cloud.discoveryengine.v1beta";
32option objc_class_prefix = "DISCOVERYENGINE";
33option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
34option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
35
36// Service for search.
37service SearchService {
38  option (google.api.default_host) = "discoveryengine.googleapis.com";
39  option (google.api.oauth_scopes) =
40      "https://www.googleapis.com/auth/cloud-platform";
41
42  // Performs a search.
43  rpc Search(SearchRequest) returns (SearchResponse) {
44    option (google.api.http) = {
45      post: "/v1beta/{serving_config=projects/*/locations/*/dataStores/*/servingConfigs/*}:search"
46      body: "*"
47      additional_bindings {
48        post: "/v1beta/{serving_config=projects/*/locations/*/collections/*/dataStores/*/servingConfigs/*}:search"
49        body: "*"
50      }
51      additional_bindings {
52        post: "/v1beta/{serving_config=projects/*/locations/*/collections/*/engines/*/servingConfigs/*}:search"
53        body: "*"
54      }
55    };
56  }
57}
58
59// Request message for
60// [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
61// method.
62message SearchRequest {
63  // Specifies the image query input.
64  message ImageQuery {
65    oneof image {
66      // Base64 encoded image bytes. Supported image formats: JPEG, PNG, and
67      // BMP.
68      string image_bytes = 1;
69    }
70  }
71
72  // A struct to define data stores to filter on in a search call.
73  message DataStoreSpec {
74    // Required. Full resource name of
75    // [DataStore][google.cloud.discoveryengine.v1beta.DataStore], such as
76    // `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
77    string data_store = 1 [
78      (google.api.field_behavior) = REQUIRED,
79      (google.api.resource_reference) = {
80        type: "discoveryengine.googleapis.com/DataStore"
81      }
82    ];
83  }
84
85  // A facet specification to perform faceted search.
86  message FacetSpec {
87    // Specifies how a facet is computed.
88    message FacetKey {
89      // Required. Supported textual and numerical facet keys in
90      // [Document][google.cloud.discoveryengine.v1beta.Document] object, over
91      // which the facet values are computed. Facet key is case-sensitive.
92      string key = 1 [(google.api.field_behavior) = REQUIRED];
93
94      // Set only if values should be bucketed into intervals. Must be set
95      // for facets with numerical values. Must not be set for facet with text
96      // values. Maximum number of intervals is 30.
97      repeated Interval intervals = 2;
98
99      // Only get facet for the given restricted values. Only supported on
100      // textual fields. For example, suppose "category" has three values
101      // "Action > 2022", "Action > 2021" and "Sci-Fi > 2022". If set
102      // "restricted_values" to "Action > 2022", the "category" facet only
103      // contains "Action > 2022". Only supported on textual fields. Maximum
104      // is 10.
105      repeated string restricted_values = 3;
106
107      // Only get facet values that start with the given string prefix. For
108      // example, suppose "category" has three values "Action > 2022",
109      // "Action > 2021" and "Sci-Fi > 2022". If set "prefixes" to "Action", the
110      // "category" facet only contains "Action > 2022" and "Action > 2021".
111      // Only supported on textual fields. Maximum is 10.
112      repeated string prefixes = 4;
113
114      // Only get facet values that contains the given strings. For example,
115      // suppose "category" has three values "Action > 2022",
116      // "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the
117      // "category" facet only contains "Action > 2022" and "Sci-Fi > 2022".
118      // Only supported on textual fields. Maximum is 10.
119      repeated string contains = 5;
120
121      // True to make facet keys case insensitive when getting faceting
122      // values with prefixes or contains; false otherwise.
123      bool case_insensitive = 6;
124
125      // The order in which documents are returned.
126      //
127      // Allowed values are:
128      //
129      // * "count desc", which means order by
130      // [SearchResponse.Facet.values.count][google.cloud.discoveryengine.v1beta.SearchResponse.Facet.FacetValue.count]
131      // descending.
132      //
133      // * "value desc", which means order by
134      // [SearchResponse.Facet.values.value][google.cloud.discoveryengine.v1beta.SearchResponse.Facet.FacetValue.value]
135      // descending.
136      //   Only applies to textual facets.
137      //
138      // If not set, textual values are sorted in [natural
139      // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
140      // intervals are sorted in the order given by
141      // [FacetSpec.FacetKey.intervals][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.intervals].
142      string order_by = 7;
143    }
144
145    // Required. The facet key specification.
146    FacetKey facet_key = 1 [(google.api.field_behavior) = REQUIRED];
147
148    // Maximum of facet values that should be returned for this facet. If
149    // unspecified, defaults to 20. The maximum allowed value is 300. Values
150    // above 300 are coerced to 300.
151    //
152    // If this field is negative, an  `INVALID_ARGUMENT`  is returned.
153    int32 limit = 2;
154
155    // List of keys to exclude when faceting.
156    //
157    //
158    // By default,
159    // [FacetKey.key][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.key]
160    // is not excluded from the filter unless it is listed in this field.
161    //
162    // Listing a facet key in this field allows its values to appear as facet
163    // results, even when they are filtered out of search results. Using this
164    // field does not affect what search results are returned.
165    //
166    // For example, suppose there are 100 documents with the color facet "Red"
167    // and 200 documents with the color facet "Blue". A query containing the
168    // filter "color:ANY("Red")" and having "color" as
169    // [FacetKey.key][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.key]
170    // would by default return only "Red" documents in the search results, and
171    // also return "Red" with count 100 as the only color facet. Although there
172    // are also blue documents available, "Blue" would not be shown as an
173    // available facet value.
174    //
175    // If "color" is listed in "excludedFilterKeys", then the query returns the
176    // facet values "Red" with count 100 and "Blue" with count 200, because the
177    // "color" key is now excluded from the filter. Because this field doesn't
178    // affect search results, the search results are still correctly filtered to
179    // return only "Red" documents.
180    //
181    // A maximum of 100 values are allowed. Otherwise, an  `INVALID_ARGUMENT`
182    // error is returned.
183    repeated string excluded_filter_keys = 3;
184
185    // Enables dynamic position for this facet. If set to true, the position of
186    // this facet among all facets in the response is determined automatically.
187    // If dynamic facets are enabled, it is ordered together.
188    // If set to false, the position of this facet in the
189    // response is the same as in the request, and it is ranked before
190    // the facets with dynamic position enable and all dynamic facets.
191    //
192    // For example, you may always want to have rating facet returned in
193    // the response, but it's not necessarily to always display the rating facet
194    // at the top. In that case, you can set enable_dynamic_position to true so
195    // that the position of rating facet in response is determined
196    // automatically.
197    //
198    // Another example, assuming you have the following facets in the request:
199    //
200    // * "rating", enable_dynamic_position = true
201    //
202    // * "price", enable_dynamic_position = false
203    //
204    // * "brands", enable_dynamic_position = false
205    //
206    // And also you have a dynamic facets enabled, which generates a facet
207    // `gender`. Then the final order of the facets in the response can be
208    // ("price", "brands", "rating", "gender") or ("price", "brands", "gender",
209    // "rating") depends on how API orders "gender" and "rating" facets.
210    // However, notice that "price" and "brands" are always
211    // ranked at first and second position because their enable_dynamic_position
212    // is false.
213    bool enable_dynamic_position = 4;
214  }
215
216  // Boost specification to boost certain documents.
217  message BoostSpec {
218    // Boost applies to documents which match a condition.
219    message ConditionBoostSpec {
220      // Specification for custom ranking based on customer specified attribute
221      // value. It provides more controls for customized ranking than the simple
222      // (condition, boost) combination above.
223      message BoostControlSpec {
224        // The control points used to define the curve. The curve defined
225        // through these control points can only be monotonically increasing
226        // or decreasing(constant values are acceptable).
227        message ControlPoint {
228          // Can be one of:
229          // 1. The numerical field value.
230          // 2. The duration spec for freshness:
231          // The value must be formatted as an XSD `dayTimeDuration` value (a
232          // restricted subset of an ISO 8601 duration value). The pattern for
233          // this is: `[nD][T[nH][nM][nS]]`.
234          string attribute_value = 1;
235
236          // The value between -1 to 1 by which to boost the score if the
237          // attribute_value evaluates to the value specified above.
238          float boost_amount = 2;
239        }
240
241        // The attribute(or function) for which the custom ranking is to be
242        // applied.
243        enum AttributeType {
244          // Unspecified AttributeType.
245          ATTRIBUTE_TYPE_UNSPECIFIED = 0;
246
247          // The value of the numerical field will be used to dynamically update
248          // the boost amount. In this case, the attribute_value (the x value)
249          // of the control point will be the actual value of the numerical
250          // field for which the boost_amount is specified.
251          NUMERICAL = 1;
252
253          // For the freshness use case the attribute value will be the duration
254          // between the current time and the date in the datetime field
255          // specified. The value must be formatted as an XSD `dayTimeDuration`
256          // value (a restricted subset of an ISO 8601 duration value). The
257          // pattern for this is: `[nD][T[nH][nM][nS]]`.
258          // E.g. `5D`, `3DT12H30M`, `T24H`.
259          FRESHNESS = 2;
260        }
261
262        // The interpolation type to be applied. Default will be linear
263        // (Piecewise Linear).
264        enum InterpolationType {
265          // Interpolation type is unspecified. In this case, it defaults to
266          // Linear.
267          INTERPOLATION_TYPE_UNSPECIFIED = 0;
268
269          // Piecewise linear interpolation will be applied.
270          LINEAR = 1;
271        }
272
273        // The name of the field whose value will be used to determine the
274        // boost amount.
275        string field_name = 1;
276
277        // The attribute type to be used to determine the boost amount. The
278        // attribute value can be derived from the field value of the specified
279        // field_name. In the case of numerical it is straightforward i.e.
280        // attribute_value = numerical_field_value. In the case of freshness
281        // however, attribute_value = (time.now() - datetime_field_value).
282        AttributeType attribute_type = 2;
283
284        // The interpolation type to be applied to connect the control points
285        // listed below.
286        InterpolationType interpolation_type = 3;
287
288        // The control points used to define the curve. The monotonic function
289        // (defined through the interpolation_type above) passes through the
290        // control points listed here.
291        repeated ControlPoint control_points = 4;
292      }
293
294      // An expression which specifies a boost condition. The syntax and
295      // supported fields are the same as a filter expression. See
296      // [SearchRequest.filter][google.cloud.discoveryengine.v1beta.SearchRequest.filter]
297      // for detail syntax and limitations.
298      //
299      // Examples:
300      //
301      // * To boost documents with document ID "doc_1" or "doc_2", and
302      // color "Red" or "Blue":
303      // `(document_id: ANY("doc_1", "doc_2")) AND (color: ANY("Red", "Blue"))`
304      string condition = 1;
305
306      // Strength of the condition boost, which should be in [-1, 1]. Negative
307      // boost means demotion. Default is 0.0.
308      //
309      // Setting to 1.0 gives the document a big promotion. However, it does
310      // not necessarily mean that the boosted document will be the top result
311      // at all times, nor that other documents will be excluded. Results
312      // could still be shown even when none of them matches the condition.
313      // And results that are significantly more relevant to the search query
314      // can still trump your heavily favored but irrelevant documents.
315      //
316      // Setting to -1.0 gives the document a big demotion. However, results
317      // that are deeply relevant might still be shown. The document will have
318      // an upstream battle to get a fairly high ranking, but it is not
319      // blocked out completely.
320      //
321      // Setting to 0.0 means no boost applied. The boosting condition is
322      // ignored. Only one of the (condition, boost) combination or the
323      // boost_control_spec below are set. If both are set then the global boost
324      // is ignored and the more fine-grained boost_control_spec is applied.
325      float boost = 2;
326
327      // Complex specification for custom ranking based on customer defined
328      // attribute value.
329      BoostControlSpec boost_control_spec = 3;
330    }
331
332    // Condition boost specifications. If a document matches multiple conditions
333    // in the specifictions, boost scores from these specifications are all
334    // applied and combined in a non-linear way. Maximum number of
335    // specifications is 20.
336    repeated ConditionBoostSpec condition_boost_specs = 1;
337  }
338
339  // Specification to determine under which conditions query expansion should
340  // occur.
341  message QueryExpansionSpec {
342    // Enum describing under which condition query expansion should occur.
343    enum Condition {
344      // Unspecified query expansion condition. In this case, server behavior
345      // defaults to
346      // [Condition.DISABLED][google.cloud.discoveryengine.v1beta.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
347      CONDITION_UNSPECIFIED = 0;
348
349      // Disabled query expansion. Only the exact search query is used, even if
350      // [SearchResponse.total_size][google.cloud.discoveryengine.v1beta.SearchResponse.total_size]
351      // is zero.
352      DISABLED = 1;
353
354      // Automatic query expansion built by the Search API.
355      AUTO = 2;
356    }
357
358    // The condition under which query expansion should occur. Default to
359    // [Condition.DISABLED][google.cloud.discoveryengine.v1beta.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
360    Condition condition = 1;
361
362    // Whether to pin unexpanded results. If this field is set to true,
363    // unexpanded products are always at the top of the search results, followed
364    // by the expanded results.
365    bool pin_unexpanded_results = 2;
366  }
367
368  // The specification for query spell correction.
369  message SpellCorrectionSpec {
370    // Enum describing under which mode spell correction should occur.
371    enum Mode {
372      // Unspecified spell correction mode. In this case, server behavior
373      // defaults to
374      // [Mode.AUTO][google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
375      MODE_UNSPECIFIED = 0;
376
377      // Search API will try to find a spell suggestion if there
378      // is any and put in the
379      // [SearchResponse.corrected_query][google.cloud.discoveryengine.v1beta.SearchResponse.corrected_query].
380      // The spell suggestion will not be used as the search query.
381      SUGGESTION_ONLY = 1;
382
383      // Automatic spell correction built by the Search API. Search will
384      // be based on the corrected query if found.
385      AUTO = 2;
386    }
387
388    // The mode under which spell correction should take effect to
389    // replace the original search query. Default to
390    // [Mode.AUTO][google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
391    Mode mode = 1;
392  }
393
394  // A specification for configuring the behavior of content search.
395  message ContentSearchSpec {
396    // A specification for configuring snippets in a search response.
397    message SnippetSpec {
398      // [DEPRECATED] This field is deprecated. To control snippet return, use
399      // `return_snippet` field. For backwards compatibility, we will return
400      // snippet if max_snippet_count > 0.
401      int32 max_snippet_count = 1 [deprecated = true];
402
403      // [DEPRECATED] This field is deprecated and will have no affect on the
404      // snippet.
405      bool reference_only = 2 [deprecated = true];
406
407      // If `true`, then return snippet. If no snippet can be generated, we
408      // return "No snippet is available for this page." A `snippet_status` with
409      // `SUCCESS` or `NO_SNIPPET_AVAILABLE` will also be returned.
410      bool return_snippet = 3;
411    }
412
413    // A specification for configuring a summary returned in a search
414    // response.
415    message SummarySpec {
416      // Specification of the prompt to use with the model.
417      message ModelPromptSpec {
418        // Text at the beginning of the prompt that instructs the assistant.
419        // Examples are available in the user guide.
420        string preamble = 1;
421      }
422
423      // Specification of the model.
424      message ModelSpec {
425        // The model version used to generate the summary.
426        //
427        // Supported values are:
428        //
429        // * `stable`: string. Default value when no value is specified. Uses a
430        //    generally available, fine-tuned model. For more information, see
431        //    [Answer generation model versions and
432        //    lifecycle](https://cloud.google.com/generative-ai-app-builder/docs/answer-generation-models).
433        // * `preview`: string. (Public preview) Uses a preview model. For more
434        //    information, see
435        //    [Answer generation model versions and
436        //    lifecycle](https://cloud.google.com/generative-ai-app-builder/docs/answer-generation-models).
437        string version = 1;
438      }
439
440      // The number of top results to generate the summary from. If the number
441      // of results returned is less than `summaryResultCount`, the summary is
442      // generated from all of the results.
443      //
444      // At most 10 results can be used to generate a summary.
445      int32 summary_result_count = 1;
446
447      // Specifies whether to include citations in the summary. The default
448      // value is `false`.
449      //
450      // When this field is set to `true`, summaries include in-line citation
451      // numbers.
452      //
453      // Example summary including citations:
454      //
455      // BigQuery is Google Cloud's fully managed and completely serverless
456      // enterprise data warehouse [1]. BigQuery supports all data types, works
457      // across clouds, and has built-in machine learning and business
458      // intelligence, all within a unified platform [2, 3].
459      //
460      // The citation numbers refer to the returned search results and are
461      // 1-indexed. For example, [1] means that the sentence is attributed to
462      // the first search result. [2, 3] means that the sentence is attributed
463      // to both the second and third search results.
464      bool include_citations = 2;
465
466      // Specifies whether to filter out adversarial queries. The default value
467      // is `false`.
468      //
469      // Google employs search-query classification to detect adversarial
470      // queries. No summary is returned if the search query is classified as an
471      // adversarial query. For example, a user might ask a question regarding
472      // negative comments about the company or submit a query designed to
473      // generate unsafe, policy-violating output. If this field is set to
474      // `true`, we skip generating summaries for adversarial queries and return
475      // fallback messages instead.
476      bool ignore_adversarial_query = 3;
477
478      // Specifies whether to filter out queries that are not summary-seeking.
479      // The default value is `false`.
480      //
481      // Google employs search-query classification to detect summary-seeking
482      // queries. No summary is returned if the search query is classified as a
483      // non-summary seeking query. For example, `why is the sky blue` and `Who
484      // is the best soccer player in the world?` are summary-seeking queries,
485      // but `SFO airport` and `world cup 2026` are not. They are most likely
486      // navigational queries. If this field is set to `true`, we skip
487      // generating summaries for non-summary seeking queries and return
488      // fallback messages instead.
489      bool ignore_non_summary_seeking_query = 4;
490
491      // If specified, the spec will be used to modify the prompt provided to
492      // the LLM.
493      ModelPromptSpec model_prompt_spec = 5;
494
495      // Language code for Summary. Use language tags defined by
496      // [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
497      // Note: This is an experimental feature.
498      string language_code = 6;
499
500      // If specified, the spec will be used to modify the model specification
501      // provided to the LLM.
502      ModelSpec model_spec = 7;
503
504      // If true, answer will be generated from most relevant chunks from top
505      // search results. This feature will improve summary quality.
506      // Note that with this feature enabled, not all top search results
507      // will be referenced and included in the reference list, so the citation
508      // source index only points to the search results listed in the reference
509      // list.
510      bool use_semantic_chunks = 8;
511    }
512
513    // A specification for configuring the extractive content in a search
514    // response.
515    message ExtractiveContentSpec {
516      // The maximum number of extractive answers returned in each search
517      // result.
518      //
519      // An extractive answer is a verbatim answer extracted from the original
520      // document, which provides a precise and contextually relevant answer to
521      // the search query.
522      //
523      // If the number of matching answers is less than the
524      // `max_extractive_answer_count`, return all of the answers. Otherwise,
525      // return the `max_extractive_answer_count`.
526      //
527      // At most five answers are returned for each
528      // [SearchResult][google.cloud.discoveryengine.v1beta.SearchResponse.SearchResult].
529      int32 max_extractive_answer_count = 1;
530
531      // The max number of extractive segments returned in each search result.
532      // Only applied if the
533      // [DataStore][google.cloud.discoveryengine.v1beta.DataStore] is set to
534      // [DataStore.ContentConfig.CONTENT_REQUIRED][google.cloud.discoveryengine.v1beta.DataStore.ContentConfig.CONTENT_REQUIRED]
535      // or
536      // [DataStore.solution_types][google.cloud.discoveryengine.v1beta.DataStore.solution_types]
537      // is
538      // [SOLUTION_TYPE_CHAT][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_CHAT].
539      //
540      // An extractive segment is a text segment extracted from the original
541      // document that is relevant to the search query, and, in general, more
542      // verbose than an extractive answer. The segment could then be used as
543      // input for LLMs to generate summaries and answers.
544      //
545      // If the number of matching segments is less than
546      // `max_extractive_segment_count`, return all of the segments. Otherwise,
547      // return the `max_extractive_segment_count`.
548      int32 max_extractive_segment_count = 2;
549
550      // Specifies whether to return the confidence score from the extractive
551      // segments in each search result. This feature is available only for new
552      // or allowlisted data stores. To allowlist your data store,
553      // contact your Customer Engineer. The default value is `false`.
554      bool return_extractive_segment_score = 3;
555
556      // Specifies whether to also include the adjacent from each selected
557      // segments.
558      // Return at most `num_previous_segments` segments before each selected
559      // segments.
560      int32 num_previous_segments = 4;
561
562      // Return at most `num_next_segments` segments after each selected
563      // segments.
564      int32 num_next_segments = 5;
565    }
566
567    // If `snippetSpec` is not specified, snippets are not included in the
568    // search response.
569    SnippetSpec snippet_spec = 1;
570
571    // If `summarySpec` is not specified, summaries are not included in the
572    // search response.
573    SummarySpec summary_spec = 2;
574
575    // If there is no extractive_content_spec provided, there will be no
576    // extractive answer in the search response.
577    ExtractiveContentSpec extractive_content_spec = 3;
578  }
579
580  // The specification that uses customized query embedding vector to do
581  // semantic document retrieval.
582  message EmbeddingSpec {
583    // Embedding vector.
584    message EmbeddingVector {
585      // Embedding field path in schema.
586      string field_path = 1;
587
588      // Query embedding vector.
589      repeated float vector = 2;
590    }
591
592    // The embedding vector used for retrieval. Limit to 1.
593    repeated EmbeddingVector embedding_vectors = 1;
594  }
595
596  // Required. The resource name of the Search serving config, such as
597  // `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`,
598  // or
599  // `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
600  // This field is used to identify the serving configuration name, set
601  // of models used to make the search.
602  string serving_config = 1 [
603    (google.api.field_behavior) = REQUIRED,
604    (google.api.resource_reference) = {
605      type: "discoveryengine.googleapis.com/ServingConfig"
606    }
607  ];
608
609  // The branch resource name, such as
610  // `projects/*/locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
611  //
612  // Use `default_branch` as the branch ID or leave this field empty, to search
613  // documents under the default branch.
614  string branch = 2 [(google.api.resource_reference) = {
615    type: "discoveryengine.googleapis.com/Branch"
616  }];
617
618  // Raw search query.
619  string query = 3;
620
621  // Raw image query.
622  ImageQuery image_query = 19;
623
624  // Maximum number of [Document][google.cloud.discoveryengine.v1beta.Document]s
625  // to return. The maximum allowed value depends on the data type. Values above
626  // the maximum value are coerced to the maximum value.
627  //
628  // * Websites with basic indexing: Default `10`, Maximum `25`.
629  // * Websites with advanced indexing: Default `25`, Maximum `50`.
630  // * Other: Default `50`, Maximum `100`.
631  //
632  // If this field is negative, an  `INVALID_ARGUMENT` is returned.
633  int32 page_size = 4;
634
635  // A page token received from a previous
636  // [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
637  // call. Provide this to retrieve the subsequent page.
638  //
639  // When paginating, all other parameters provided to
640  // [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
641  // must match the call that provided the page token. Otherwise, an
642  //  `INVALID_ARGUMENT`  error is returned.
643  string page_token = 5;
644
645  // A 0-indexed integer that specifies the current offset (that is, starting
646  // result location, amongst the
647  // [Document][google.cloud.discoveryengine.v1beta.Document]s deemed by the API
648  // as relevant) in search results. This field is only considered if
649  // [page_token][google.cloud.discoveryengine.v1beta.SearchRequest.page_token]
650  // is unset.
651  //
652  // If this field is negative, an  `INVALID_ARGUMENT`  is returned.
653  int32 offset = 6;
654
655  // A list of data store specs to apply on a search call.
656  repeated DataStoreSpec data_store_specs = 32;
657
658  // The filter syntax consists of an expression language for constructing a
659  // predicate from one or more fields of the documents being filtered. Filter
660  // expression is case-sensitive.
661  //
662  // If this field is unrecognizable, an  `INVALID_ARGUMENT`  is returned.
663  //
664  // Filtering in Vertex AI Search is done by mapping the LHS filter key to a
665  // key property defined in the Vertex AI Search backend -- this mapping is
666  // defined by the customer in their schema. For example a media customer might
667  // have a field 'name' in their schema. In this case the filter would look
668  // like this: filter --> name:'ANY("king kong")'
669  //
670  // For more information about filtering including syntax and filter
671  // operators, see
672  // [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata)
673  string filter = 7;
674
675  // The default filter that is applied when a user performs a search without
676  // checking any filters on the search page.
677  //
678  // The filter applied to every search request when quality improvement such as
679  // query expansion is needed. In the case a query does not have a sufficient
680  // amount of results this filter will be used to determine whether or not to
681  // enable the query expansion flow. The original filter will still be used for
682  // the query expanded search.
683  // This field is strongly recommended to achieve high search quality.
684  //
685  // For more information about filter syntax, see
686  // [SearchRequest.filter][google.cloud.discoveryengine.v1beta.SearchRequest.filter].
687  string canonical_filter = 29;
688
689  // The order in which documents are returned. Documents can be ordered by
690  // a field in an [Document][google.cloud.discoveryengine.v1beta.Document]
691  // object. Leave it unset if ordered by relevance. `order_by` expression is
692  // case-sensitive. For more information on ordering, see
693  // [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order)
694  //
695  // If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
696  string order_by = 8;
697
698  // Information about the end user.
699  // Highly recommended for analytics.
700  // [UserInfo.user_agent][google.cloud.discoveryengine.v1beta.UserInfo.user_agent]
701  // is used to deduce `device_type` for analytics.
702  UserInfo user_info = 21;
703
704  // Facet specifications for faceted search. If empty, no facets are returned.
705  //
706  // A maximum of 100 values are allowed. Otherwise, an  `INVALID_ARGUMENT`
707  // error is returned.
708  repeated FacetSpec facet_specs = 9;
709
710  // Boost specification to boost certain documents.
711  // For more information on boosting, see
712  // [Boosting](https://cloud.google.com/retail/docs/boosting#boost)
713  BoostSpec boost_spec = 10;
714
715  // Additional search parameters.
716  //
717  // For public website search only, supported values are:
718  //
719  // * `user_country_code`: string. Default empty. If set to non-empty, results
720  //    are restricted or boosted based on the location provided.
721  //    Example:
722  //    user_country_code: "au"
723  //
724  //    For available codes see [Country
725  //    Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes)
726  //
727  // * `search_type`: double. Default empty. Enables non-webpage searching
728  //    depending on the value. The only valid non-default value is 1,
729  //    which enables image searching.
730  //    Example:
731  //    search_type: 1
732  map<string, google.protobuf.Value> params = 11;
733
734  // The query expansion specification that specifies the conditions under which
735  // query expansion occurs.
736  QueryExpansionSpec query_expansion_spec = 13;
737
738  // The spell correction specification that specifies the mode under
739  // which spell correction takes effect.
740  SpellCorrectionSpec spell_correction_spec = 14;
741
742  // A unique identifier for tracking visitors. For example, this could be
743  // implemented with an HTTP cookie, which should be able to uniquely identify
744  // a visitor on a single device. This unique identifier should not change if
745  // the visitor logs in or out of the website.
746  //
747  // This field should NOT have a fixed value such as `unknown_visitor`.
748  //
749  // This should be the same identifier as
750  // [UserEvent.user_pseudo_id][google.cloud.discoveryengine.v1beta.UserEvent.user_pseudo_id]
751  // and
752  // [CompleteQueryRequest.user_pseudo_id][google.cloud.discoveryengine.v1beta.CompleteQueryRequest.user_pseudo_id]
753  //
754  // The field must be a UTF-8 encoded string with a length limit of 128
755  // characters. Otherwise, an  `INVALID_ARGUMENT`  error is returned.
756  string user_pseudo_id = 15;
757
758  // A specification for configuring the behavior of content search.
759  ContentSearchSpec content_search_spec = 24;
760
761  // Uses the provided embedding to do additional semantic document retrieval.
762  // The retrieval is based on the dot product of
763  // [SearchRequest.EmbeddingSpec.EmbeddingVector.vector][google.cloud.discoveryengine.v1beta.SearchRequest.EmbeddingSpec.EmbeddingVector.vector]
764  // and the document embedding that is provided in
765  // [SearchRequest.EmbeddingSpec.EmbeddingVector.field_path][google.cloud.discoveryengine.v1beta.SearchRequest.EmbeddingSpec.EmbeddingVector.field_path].
766  //
767  // If
768  // [SearchRequest.EmbeddingSpec.EmbeddingVector.field_path][google.cloud.discoveryengine.v1beta.SearchRequest.EmbeddingSpec.EmbeddingVector.field_path]
769  // is not provided, it will use
770  // [ServingConfig.EmbeddingConfig.field_path][google.cloud.discoveryengine.v1beta.ServingConfig.embedding_config].
771  EmbeddingSpec embedding_spec = 23;
772
773  // The ranking expression controls the customized ranking on retrieval
774  // documents. This overrides
775  // [ServingConfig.ranking_expression][google.cloud.discoveryengine.v1beta.ServingConfig.ranking_expression].
776  // The ranking expression is a single function or multiple functions that are
777  // joint by "+".
778  //   * ranking_expression = function, { " + ", function };
779  // Supported functions:
780  //   * double * relevance_score
781  //   * double * dotProduct(embedding_field_path)
782  // Function variables:
783  //   `relevance_score`: pre-defined keywords, used for measure relevance
784  //   between query and document.
785  //   `embedding_field_path`: the document embedding field
786  //   used with query embedding vector.
787  //   `dotProduct`: embedding function between embedding_field_path and query
788  //   embedding vector.
789  //
790  //  Example ranking expression:
791  //    If document has an embedding field doc_embedding, the ranking expression
792  //    could be `0.5 * relevance_score + 0.3 * dotProduct(doc_embedding)`.
793  string ranking_expression = 26;
794
795  // Whether to turn on safe search. This is only supported for
796  // website search.
797  bool safe_search = 20;
798
799  // The user labels applied to a resource must meet the following requirements:
800  //
801  // * Each resource can have multiple labels, up to a maximum of 64.
802  // * Each label must be a key-value pair.
803  // * Keys have a minimum length of 1 character and a maximum length of 63
804  //   characters and cannot be empty. Values can be empty and have a maximum
805  //   length of 63 characters.
806  // * Keys and values can contain only lowercase letters, numeric characters,
807  //   underscores, and dashes. All characters must use UTF-8 encoding, and
808  //   international characters are allowed.
809  // * The key portion of a label must be unique. However, you can use the same
810  //   key with multiple resources.
811  // * Keys must start with a lowercase letter or international character.
812  //
813  // See [Google Cloud
814  // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
815  // for more details.
816  map<string, string> user_labels = 22;
817}
818
819// Response message for
820// [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
821// method.
822message SearchResponse {
823  // Represents the search results.
824  message SearchResult {
825    // [Document.id][google.cloud.discoveryengine.v1beta.Document.id] of the
826    // searched [Document][google.cloud.discoveryengine.v1beta.Document].
827    string id = 1;
828
829    // The document data snippet in the search response. Only fields that are
830    // marked as retrievable are populated.
831    Document document = 2;
832
833    // Google provided available scores.
834    map<string, DoubleList> model_scores = 4;
835  }
836
837  // A facet result.
838  message Facet {
839    // A facet value which contains value names and their count.
840    message FacetValue {
841      // A facet value which contains values.
842      oneof facet_value {
843        // Text value of a facet, such as "Black" for facet "colors".
844        string value = 1;
845
846        // Interval value for a facet, such as [10, 20) for facet "price". It
847        // matches
848        // [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.intervals].
849        Interval interval = 2;
850      }
851
852      // Number of items that have this facet value.
853      int64 count = 3;
854    }
855
856    // The key for this facet. E.g., "colors" or "price". It matches
857    // [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.key].
858    string key = 1;
859
860    // The facet values for this field.
861    repeated FacetValue values = 2;
862
863    // Whether the facet is dynamically generated.
864    bool dynamic_facet = 3;
865  }
866
867  // Guided search result. The guided search helps user to refine the search
868  // results and narrow down to the real needs from a broaded search results.
869  message GuidedSearchResult {
870    // Useful attribute for search result refinements.
871    message RefinementAttribute {
872      // Attribute key used to refine the results e.g. 'movie_type'.
873      string attribute_key = 1;
874
875      // Attribute value used to refine the results e.g. 'drama'.
876      string attribute_value = 2;
877    }
878
879    // A list of ranked refinement attributes.
880    repeated RefinementAttribute refinement_attributes = 1;
881
882    // Suggested follow-up questions.
883    repeated string follow_up_questions = 2;
884  }
885
886  // Summary of the top N search result specified by the summary spec.
887  message Summary {
888    // Safety Attribute categories and their associated confidence scores.
889    message SafetyAttributes {
890      // The display names of Safety Attribute categories associated with the
891      // generated content. Order matches the Scores.
892      repeated string categories = 1;
893
894      // The confidence scores of the each category, higher
895      // value means higher confidence. Order matches the Categories.
896      repeated float scores = 2;
897    }
898
899    // Citation metadata.
900    message CitationMetadata {
901      // Citations for segments.
902      repeated Citation citations = 1;
903    }
904
905    // Citation info for a segment.
906    message Citation {
907      // Index indicates the start of the segment, measured in bytes/unicode.
908      int64 start_index = 1;
909
910      // End of the attributed segment, exclusive.
911      int64 end_index = 2;
912
913      // Citation sources for the attributed segment.
914      repeated CitationSource sources = 3;
915    }
916
917    // Citation source.
918    message CitationSource {
919      // Document reference index from SummaryWithMetadata.references.
920      // It is 0-indexed and the value will be zero if the reference_index is
921      // not set explicitly.
922      int64 reference_index = 4;
923    }
924
925    // Document reference.
926    message Reference {
927      // Chunk content.
928      message ChunkContent {
929        // Chunk textual content.
930        string content = 1;
931
932        // Page identifier.
933        string page_identifier = 2;
934      }
935
936      // Title of the document.
937      string title = 1;
938
939      // Required.
940      // [Document.name][google.cloud.discoveryengine.v1beta.Document.name] of
941      // the document. Full resource name of the referenced document, in the
942      // format
943      // `projects/*/locations/*/collections/*/dataStores/*/branches/*/documents/*`.
944      string document = 2 [
945        (google.api.field_behavior) = REQUIRED,
946        (google.api.resource_reference) = {
947          type: "discoveryengine.googleapis.com/Document"
948        }
949      ];
950
951      // Cloud Storage or HTTP uri for the document.
952      string uri = 3;
953
954      // List of cited chunk contents derived from document content.
955      repeated ChunkContent chunk_contents = 4;
956    }
957
958    // Summary with metadata information.
959    message SummaryWithMetadata {
960      // Summary text with no citation information.
961      string summary = 1;
962
963      // Citation metadata for given summary.
964      CitationMetadata citation_metadata = 2;
965
966      // Document References.
967      repeated Reference references = 3;
968    }
969
970    // An Enum for summary-skipped reasons.
971    enum SummarySkippedReason {
972      // Default value. The summary skipped reason is not specified.
973      SUMMARY_SKIPPED_REASON_UNSPECIFIED = 0;
974
975      // The adversarial query ignored case.
976      //
977      // Only populated when
978      // [SummarySpec.ignore_adversarial_query][google.cloud.discoveryengine.v1beta.SearchRequest.ContentSearchSpec.SummarySpec.ignore_adversarial_query]
979      // is set to `true`.
980      ADVERSARIAL_QUERY_IGNORED = 1;
981
982      // The non-summary seeking query ignored case.
983      //
984      // Only populated when
985      // [SummarySpec.ignore_non_summary_seeking_query][google.cloud.discoveryengine.v1beta.SearchRequest.ContentSearchSpec.SummarySpec.ignore_non_summary_seeking_query]
986      // is set to `true`.
987      NON_SUMMARY_SEEKING_QUERY_IGNORED = 2;
988
989      // The out-of-domain query ignored case.
990      //
991      // Google skips the summary if there are no high-relevance search results.
992      // For example, the data store contains facts about company A but the
993      // user query is asking questions about company B.
994      OUT_OF_DOMAIN_QUERY_IGNORED = 3;
995
996      // The potential policy violation case.
997      //
998      // Google skips the summary if there is a potential policy violation
999      // detected. This includes content that may be violent or toxic.
1000      POTENTIAL_POLICY_VIOLATION = 4;
1001
1002      // The LLM addon not enabled case.
1003      //
1004      // Google skips the summary if the LLM addon is not enabled.
1005      LLM_ADDON_NOT_ENABLED = 5;
1006    }
1007
1008    // The summary content.
1009    string summary_text = 1;
1010
1011    // Additional summary-skipped reasons. This provides the reason for ignored
1012    // cases. If nothing is skipped, this field is not set.
1013    repeated SummarySkippedReason summary_skipped_reasons = 2;
1014
1015    // A collection of Safety Attribute categories and their associated
1016    // confidence scores.
1017    SafetyAttributes safety_attributes = 3;
1018
1019    // Summary with metadata information.
1020    SummaryWithMetadata summary_with_metadata = 4;
1021  }
1022
1023  // Debug information specifically related to forward geocoding issues arising
1024  // from Geolocation Search.
1025  message GeoSearchDebugInfo {
1026    // The address from which forward geocoding ingestion produced issues.
1027    string original_address_query = 1;
1028
1029    // The error produced.
1030    string error_message = 2;
1031  }
1032
1033  // Information describing query expansion including whether expansion has
1034  // occurred.
1035  message QueryExpansionInfo {
1036    // Bool describing whether query expansion has occurred.
1037    bool expanded_query = 1;
1038
1039    // Number of pinned results. This field will only be set when expansion
1040    // happens and
1041    // [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.discoveryengine.v1beta.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]
1042    // is set to true.
1043    int64 pinned_result_count = 2;
1044  }
1045
1046  // A list of matched documents. The order represents the ranking.
1047  repeated SearchResult results = 1;
1048
1049  // Results of facets requested by user.
1050  repeated Facet facets = 2;
1051
1052  // Guided search result.
1053  GuidedSearchResult guided_search_result = 8;
1054
1055  // The estimated total count of matched items irrespective of pagination. The
1056  // count of
1057  // [results][google.cloud.discoveryengine.v1beta.SearchResponse.results]
1058  // returned by pagination may be less than the
1059  // [total_size][google.cloud.discoveryengine.v1beta.SearchResponse.total_size]
1060  // that matches.
1061  int32 total_size = 3;
1062
1063  // A unique search token. This should be included in the
1064  // [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] logs resulting
1065  // from this search, which enables accurate attribution of search model
1066  // performance.
1067  string attribution_token = 4;
1068
1069  // The URI of a customer-defined redirect page. If redirect action is
1070  // triggered, no search is performed, and only
1071  // [redirect_uri][google.cloud.discoveryengine.v1beta.SearchResponse.redirect_uri]
1072  // and
1073  // [attribution_token][google.cloud.discoveryengine.v1beta.SearchResponse.attribution_token]
1074  // are set in the response.
1075  string redirect_uri = 12;
1076
1077  // A token that can be sent as
1078  // [SearchRequest.page_token][google.cloud.discoveryengine.v1beta.SearchRequest.page_token]
1079  // to retrieve the next page. If this field is omitted, there are no
1080  // subsequent pages.
1081  string next_page_token = 5;
1082
1083  // Contains the spell corrected query, if found. If the spell correction type
1084  // is AUTOMATIC, then the search results are based on corrected_query.
1085  // Otherwise the original query is used for search.
1086  string corrected_query = 7;
1087
1088  // A summary as part of the search results.
1089  // This field is only returned if
1090  // [SearchRequest.ContentSearchSpec.summary_spec][google.cloud.discoveryengine.v1beta.SearchRequest.ContentSearchSpec.summary_spec]
1091  // is set.
1092  Summary summary = 9;
1093
1094  // Controls applied as part of the Control service.
1095  repeated string applied_controls = 10;
1096
1097  // Debug information specifically related to forward geocoding issues arising
1098  // from Geolocation Search.
1099  repeated GeoSearchDebugInfo geo_search_debug_info = 16;
1100
1101  // Query expansion information for the returned results.
1102  QueryExpansionInfo query_expansion_info = 14;
1103}
1104