@google-cloud/discoveryengine 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +2 -0
  3. package/build/protos/google/cloud/discoveryengine/v1alpha/chunk.proto +35 -1
  4. package/build/protos/google/cloud/discoveryengine/v1alpha/common.proto +20 -0
  5. package/build/protos/google/cloud/discoveryengine/v1alpha/document.proto +19 -0
  6. package/build/protos/google/cloud/discoveryengine/v1alpha/document_service.proto +64 -0
  7. package/build/protos/google/cloud/discoveryengine/v1alpha/import_config.proto +312 -21
  8. package/build/protos/google/cloud/discoveryengine/v1alpha/rank_service.proto +115 -0
  9. package/build/protos/google/cloud/discoveryengine/v1alpha/search_service.proto +153 -23
  10. package/build/protos/google/cloud/discoveryengine/v1alpha/search_tuning_service.proto +5 -2
  11. package/build/protos/google/cloud/discoveryengine/v1alpha/serving_config_service.proto +2 -1
  12. package/build/protos/protos.d.ts +2743 -221
  13. package/build/protos/protos.js +10286 -3762
  14. package/build/protos/protos.json +595 -5
  15. package/build/src/v1/completion_service_client.js +10 -7
  16. package/build/src/v1/conversational_search_service_client.js +10 -7
  17. package/build/src/v1/data_store_service_client.js +10 -7
  18. package/build/src/v1/document_service_client.js +10 -7
  19. package/build/src/v1/engine_service_client.js +10 -7
  20. package/build/src/v1/schema_service_client.js +10 -7
  21. package/build/src/v1/search_service_client.js +10 -7
  22. package/build/src/v1/site_search_engine_service_client.js +10 -7
  23. package/build/src/v1/user_event_service_client.js +10 -7
  24. package/build/src/v1alpha/acl_config_service_client.js +10 -7
  25. package/build/src/v1alpha/chunk_service_client.js +10 -7
  26. package/build/src/v1alpha/completion_service_client.js +13 -7
  27. package/build/src/v1alpha/conversational_search_service_client.js +10 -7
  28. package/build/src/v1alpha/data_store_service_client.js +13 -7
  29. package/build/src/v1alpha/document_service_client.d.ts +80 -21
  30. package/build/src/v1alpha/document_service_client.js +35 -7
  31. package/build/src/v1alpha/document_service_client_config.json +5 -0
  32. package/build/src/v1alpha/engine_service_client.js +13 -7
  33. package/build/src/v1alpha/estimate_billing_service_client.js +13 -7
  34. package/build/src/v1alpha/index.d.ts +1 -0
  35. package/build/src/v1alpha/index.js +3 -1
  36. package/build/src/v1alpha/rank_service_client.d.ts +1254 -0
  37. package/build/src/v1alpha/rank_service_client.js +1796 -0
  38. package/build/src/v1alpha/rank_service_client_config.json +30 -0
  39. package/build/src/v1alpha/recommendation_service_client.js +10 -7
  40. package/build/src/v1alpha/schema_service_client.js +13 -7
  41. package/build/src/v1alpha/search_service_client.d.ts +30 -15
  42. package/build/src/v1alpha/search_service_client.js +30 -17
  43. package/build/src/v1alpha/search_tuning_service_client.js +13 -7
  44. package/build/src/v1alpha/serving_config_service_client.d.ts +2 -1
  45. package/build/src/v1alpha/serving_config_service_client.js +12 -8
  46. package/build/src/v1alpha/site_search_engine_service_client.js +13 -7
  47. package/build/src/v1alpha/user_event_service_client.js +13 -7
  48. package/build/src/v1beta/completion_service_client.js +10 -7
  49. package/build/src/v1beta/conversational_search_service_client.js +10 -7
  50. package/build/src/v1beta/data_store_service_client.js +10 -7
  51. package/build/src/v1beta/document_service_client.js +10 -7
  52. package/build/src/v1beta/engine_service_client.js +10 -7
  53. package/build/src/v1beta/recommendation_service_client.js +10 -7
  54. package/build/src/v1beta/schema_service_client.js +10 -7
  55. package/build/src/v1beta/search_service_client.js +10 -7
  56. package/build/src/v1beta/search_tuning_service_client.js +10 -7
  57. package/build/src/v1beta/serving_config_service_client.js +10 -7
  58. package/build/src/v1beta/site_search_engine_service_client.js +10 -7
  59. package/build/src/v1beta/user_event_service_client.js +10 -7
  60. package/package.json +1 -1
@@ -0,0 +1,115 @@
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
+
15
+ syntax = "proto3";
16
+
17
+ package google.cloud.discoveryengine.v1alpha;
18
+
19
+ import "google/api/annotations.proto";
20
+ import "google/api/client.proto";
21
+ import "google/api/field_behavior.proto";
22
+ import "google/api/resource.proto";
23
+
24
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Alpha";
25
+ option go_package = "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb;discoveryenginepb";
26
+ option java_multiple_files = true;
27
+ option java_outer_classname = "RankServiceProto";
28
+ option java_package = "com.google.cloud.discoveryengine.v1alpha";
29
+ option objc_class_prefix = "DISCOVERYENGINE";
30
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha";
31
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha";
32
+
33
+ // Service for ranking text records.
34
+ service RankService {
35
+ option (google.api.default_host) = "discoveryengine.googleapis.com";
36
+ option (google.api.oauth_scopes) =
37
+ "https://www.googleapis.com/auth/cloud-platform";
38
+
39
+ // Ranks a list of text records based on the given input query.
40
+ rpc Rank(RankRequest) returns (RankResponse) {
41
+ option (google.api.http) = {
42
+ post: "/v1alpha/{ranking_config=projects/*/locations/*/rankingConfigs/*}:rank"
43
+ body: "*"
44
+ };
45
+ }
46
+ }
47
+
48
+ // Record message for
49
+ // [RankService.Rank][google.cloud.discoveryengine.v1alpha.RankService.Rank]
50
+ // method.
51
+ message RankingRecord {
52
+ // The unique ID to represent the record.
53
+ string id = 1;
54
+
55
+ // The title of the record. Empty by default.
56
+ // At least one of
57
+ // [title][google.cloud.discoveryengine.v1alpha.RankingRecord.title] or
58
+ // [content][google.cloud.discoveryengine.v1alpha.RankingRecord.content]
59
+ // should be set otherwise an INVALID_ARGUMENT error is thrown.
60
+ string title = 2;
61
+
62
+ // The content of the record. Empty by default.
63
+ // At least one of
64
+ // [title][google.cloud.discoveryengine.v1alpha.RankingRecord.title] or
65
+ // [content][google.cloud.discoveryengine.v1alpha.RankingRecord.content]
66
+ // should be set otherwise an INVALID_ARGUMENT error is thrown.
67
+ string content = 3;
68
+
69
+ // The score of this record based on the given query and selected model.
70
+ float score = 4;
71
+ }
72
+
73
+ // Request message for
74
+ // [RankService.Rank][google.cloud.discoveryengine.v1alpha.RankService.Rank]
75
+ // method.
76
+ message RankRequest {
77
+ // Required. The resource name of the rank service config, such as
78
+ // `projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config`.
79
+ string ranking_config = 1 [
80
+ (google.api.field_behavior) = REQUIRED,
81
+ (google.api.resource_reference) = {
82
+ type: "discoveryengine.googleapis.com/RankingConfig"
83
+ }
84
+ ];
85
+
86
+ // The identifier of the model to use. It is one of:
87
+ //
88
+ // * `semantic-ranker-512@latest`: Semantic ranking model with maxiumn input
89
+ // token size 512.
90
+ //
91
+ // It is set to `semantic-ranker-512@latest` by default if unspecified.
92
+ string model = 2;
93
+
94
+ // The number of results to return. If this is unset or no bigger than zero,
95
+ // returns all results.
96
+ int32 top_n = 3;
97
+
98
+ // The query to use.
99
+ string query = 4;
100
+
101
+ // Required. A list of records to rank. At most 200 records to rank.
102
+ repeated RankingRecord records = 5 [(google.api.field_behavior) = REQUIRED];
103
+
104
+ // If true, the response will contain only record ID and score. By default, it
105
+ // is false, the response will contain record details.
106
+ bool ignore_record_details_in_response = 6;
107
+ }
108
+
109
+ // Response message for
110
+ // [RankService.Rank][google.cloud.discoveryengine.v1alpha.RankService.Rank]
111
+ // method.
112
+ message RankResponse {
113
+ // A list of records sorted by descending score.
114
+ repeated RankingRecord records = 5;
115
+ }
@@ -218,6 +218,80 @@ message SearchRequest {
218
218
  message BoostSpec {
219
219
  // Boost applies to documents which match a condition.
220
220
  message ConditionBoostSpec {
221
+ // Specification for custom ranking based on customer specified attribute
222
+ // value. It provides more controls for customized ranking than the simple
223
+ // (condition, boost) combination above.
224
+ message BoostControlSpec {
225
+ // The control points used to define the curve. The curve defined
226
+ // through these control points can only be monotonically increasing
227
+ // or decreasing(constant values are acceptable).
228
+ message ControlPoint {
229
+ // Can be one of:
230
+ // 1. The numerical field value.
231
+ // 2. The duration spec for freshness:
232
+ // The value must be formatted as an XSD `dayTimeDuration` value (a
233
+ // restricted subset of an ISO 8601 duration value). The pattern for
234
+ // this is: `[nD][T[nH][nM][nS]]`.
235
+ string attribute_value = 1;
236
+
237
+ // The value between -1 to 1 by which to boost the score if the
238
+ // attribute_value evaluates to the value specified above.
239
+ float boost_amount = 2;
240
+ }
241
+
242
+ // The attribute(or function) for which the custom ranking is to be
243
+ // applied.
244
+ enum AttributeType {
245
+ // Unspecified AttributeType.
246
+ ATTRIBUTE_TYPE_UNSPECIFIED = 0;
247
+
248
+ // The value of the numerical field will be used to dynamically update
249
+ // the boost amount. In this case, the attribute_value (the x value)
250
+ // of the control point will be the actual value of the numerical
251
+ // field for which the boost_amount is specified.
252
+ NUMERICAL = 1;
253
+
254
+ // For the freshness use case the attribute value will be the duration
255
+ // between the current time and the date in the datetime field
256
+ // specified. The value must be formatted as an XSD `dayTimeDuration`
257
+ // value (a restricted subset of an ISO 8601 duration value). The
258
+ // pattern for this is: `[nD][T[nH][nM][nS]]`.
259
+ // E.g. `5D`, `3DT12H30M`, `T24H`.
260
+ FRESHNESS = 2;
261
+ }
262
+
263
+ // The interpolation type to be applied. Default will be linear
264
+ // (Piecewise Linear).
265
+ enum InterpolationType {
266
+ // Interpolation type is unspecified. In this case, it defaults to
267
+ // Linear.
268
+ INTERPOLATION_TYPE_UNSPECIFIED = 0;
269
+
270
+ // Piecewise linear interpolation will be applied.
271
+ LINEAR = 1;
272
+ }
273
+
274
+ // The name of the field whose value will be used to determine the
275
+ // boost amount.
276
+ string field_name = 1;
277
+
278
+ // The attribute type to be used to determine the boost amount. The
279
+ // attribute value can be derived from the field value of the specified
280
+ // field_name. In the case of numerical it is straightforward i.e.
281
+ // attribute_value = numerical_field_value. In the case of freshness
282
+ // however, attribute_value = (time.now() - datetime_field_value).
283
+ AttributeType attribute_type = 2;
284
+
285
+ // The interpolation type to be applied to connect the control points
286
+ // listed below.
287
+ InterpolationType interpolation_type = 3;
288
+
289
+ // The control points used to define the curve. The monotonic function
290
+ // (defined through the interpolation_type above) passes through the
291
+ // control points listed here.
292
+ repeated ControlPoint control_points = 4;
293
+ }
294
+
221
295
  // An expression which specifies a boost condition. The syntax and
222
296
  // supported fields are the same as a filter expression. See
223
297
  // [SearchRequest.filter][google.cloud.discoveryengine.v1alpha.SearchRequest.filter]
@@ -233,21 +307,27 @@ message SearchRequest {
233
307
  // Strength of the condition boost, which should be in [-1, 1]. Negative
234
308
  // boost means demotion. Default is 0.0.
235
309
  //
236
- // Setting to 1.0 gives the document a big promotion. However, it does not
237
- // necessarily mean that the boosted document will be the top result at
238
- // all times, nor that other documents will be excluded. Results could
239
- // still be shown even when none of them matches the condition. And
240
- // results that are significantly more relevant to the search query can
241
- // still trump your heavily favored but irrelevant documents.
310
+ // Setting to 1.0 gives the document a big promotion. However, it does
311
+ // not necessarily mean that the boosted document will be the top result
312
+ // at all times, nor that other documents will be excluded. Results
313
+ // could still be shown even when none of them matches the condition.
314
+ // And results that are significantly more relevant to the search query
315
+ // can still trump your heavily favored but irrelevant documents.
242
316
  //
243
317
  // Setting to -1.0 gives the document a big demotion. However, results
244
318
  // that are deeply relevant might still be shown. The document will have
245
- // an upstream battle to get a fairly high ranking, but it is not blocked
246
- // out completely.
319
+ // an upstream battle to get a fairly high ranking, but it is not
320
+ // blocked out completely.
247
321
  //
248
322
  // Setting to 0.0 means no boost applied. The boosting condition is
249
- // ignored.
323
+ // ignored. Only one of the (condition, boost) combination or the
324
+ // boost_control_spec below are set. If both are set then the global boost
325
+ // is ignored and the more fine-grained boost_control_spec is applied.
250
326
  float boost = 2;
327
+
328
+ // Complex specification for custom ranking based on customer defined
329
+ // attribute value.
330
+ BoostControlSpec boost_control_spec = 3;
251
331
  }
252
332
 
253
333
  // Condition boost specifications. If a document matches multiple conditions
@@ -348,11 +428,13 @@ message SearchRequest {
348
428
  // Supported values are:
349
429
  //
350
430
  // * `stable`: string. Default value when no value is specified. Uses a
351
- // generally available, fine-tuned version of the text-bison@001
352
- // model.
353
- // * `preview`: string. (Public preview) Uses a fine-tuned version of
354
- // the text-bison@002 model. This model works only for summaries in
355
- // English.
431
+ // generally available, fine-tuned model. For more information, see
432
+ // [Answer generation model versions and
433
+ // lifecycle](https://cloud.google.com/generative-ai-app-builder/docs/answer-generation-models).
434
+ // * `preview`: string. (Public preview) Uses a preview model. For more
435
+ // information, see
436
+ // [Answer generation model versions and
437
+ // lifecycle](https://cloud.google.com/generative-ai-app-builder/docs/answer-generation-models).
356
438
  string version = 1;
357
439
  }
358
440
 
@@ -419,6 +501,14 @@ message SearchRequest {
419
501
  // If specified, the spec will be used to modify the model specification
420
502
  // provided to the LLM.
421
503
  ModelSpec model_spec = 7;
504
+
505
+ // If true, answer will be generated from most relevant chunks from top
506
+ // search results. This feature will improve summary quality.
507
+ // Please note that with this feature enabled, not all top search results
508
+ // will be referenced and included in the reference list, so the citation
509
+ // source index only points to the search results listed in the reference
510
+ // list.
511
+ bool use_semantic_chunks = 8;
422
512
  }
423
513
 
424
514
  // A specification for configuring the extractive content in a search
@@ -459,10 +549,9 @@ message SearchRequest {
459
549
  int32 max_extractive_segment_count = 2;
460
550
 
461
551
  // Specifies whether to return the confidence score from the extractive
462
- // segments in each search result. The default value is `false`.
463
- //
464
- // Note: this is a priavte preview feature and only works for allowlisted
465
- // users, please reach out to Cloud Support team if you want to use it.
552
+ // segments in each search result. This feature is available only for new
553
+ // or allowlisted data stores. To allowlist your data store, please
554
+ // contact your Customer Engineer. The default value is `false`.
466
555
  bool return_extractive_segment_score = 3;
467
556
 
468
557
  // Specifies whether to also include the adjacent from each selected
@@ -476,6 +565,23 @@ message SearchRequest {
476
565
  int32 num_next_segments = 5;
477
566
  }
478
567
 
568
+ // Specifies the chunk spec to be returned from the search response.
569
+ // Only available if the
570
+ // [SearchRequest.ContentSearchSpec.search_result_mode][google.cloud.discoveryengine.v1alpha.SearchRequest.ContentSearchSpec.search_result_mode]
571
+ // is set to
572
+ // [CHUNKS][google.cloud.discoveryengine.v1alpha.SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS]
573
+ message ChunkSpec {
574
+ // The number of previous chunks to be returned of the current chunk. The
575
+ // maximum allowed value is 3.
576
+ // If not specified, no previous chunks will be returned.
577
+ int32 num_previous_chunks = 1;
578
+
579
+ // The number of next chunks to be returned of the current chunk. The
580
+ // maximum allowed value is 3.
581
+ // If not specified, no next chunks will be returned.
582
+ int32 num_next_chunks = 2;
583
+ }
584
+
479
585
  // Specifies the search result mode. If unspecified, the
480
586
  // search result mode is based on
481
587
  // [DataStore.DocumentProcessingConfig.chunking_config][]:
@@ -513,6 +619,13 @@ message SearchRequest {
513
619
  // it defaults to `CHUNKS`.
514
620
  // * Otherwise, it defaults to `DOCUMENTS`.
515
621
  SearchResultMode search_result_mode = 4;
622
+
623
+ // Specifies the chunk spec to be returned from the search response.
624
+ // Only available if the
625
+ // [SearchRequest.ContentSearchSpec.search_result_mode][google.cloud.discoveryengine.v1alpha.SearchRequest.ContentSearchSpec.search_result_mode]
626
+ // is set to
627
+ // [CHUNKS][google.cloud.discoveryengine.v1alpha.SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS]
628
+ ChunkSpec chunk_spec = 5;
516
629
  }
517
630
 
518
631
  // The specification that uses customized query embedding vector to do
@@ -560,11 +673,15 @@ message SearchRequest {
560
673
  ImageQuery image_query = 19;
561
674
 
562
675
  // Maximum number of
563
- // [Document][google.cloud.discoveryengine.v1alpha.Document]s to return. If
564
- // unspecified, defaults to a reasonable value. The maximum allowed value is
565
- // 100. Values above 100 are coerced to 100.
676
+ // [Document][google.cloud.discoveryengine.v1alpha.Document]s to return. The
677
+ // maximum allowed value depends on the data type. Values above the maximum
678
+ // value are coerced to the maximum value.
566
679
  //
567
- // If this field is negative, an `INVALID_ARGUMENT` is returned.
680
+ // * Websites with basic indexing: Default `10`, Maximum `25`.
681
+ // * Websites with advanced indexing: Default `25`, Maximum `50`.
682
+ // * Other: Default `50`, Maximum `100`.
683
+ //
684
+ // If this field is negative, an `INVALID_ARGUMENT` is returned.
568
685
  int32 page_size = 4;
569
686
 
570
687
  // A page token received from a previous
@@ -701,7 +818,8 @@ message SearchRequest {
701
818
  //
702
819
  // If
703
820
  // [SearchRequest.EmbeddingSpec.EmbeddingVector.field_path][google.cloud.discoveryengine.v1alpha.SearchRequest.EmbeddingSpec.EmbeddingVector.field_path]
704
- // is not provided, it will use [ServingConfig.EmbeddingConfig.field_path][].
821
+ // is not provided, it will use
822
+ // [ServingConfig.EmbeddingConfig.field_path][google.cloud.discoveryengine.v1alpha.ServingConfig.embedding_config].
705
823
  EmbeddingSpec embedding_spec = 23;
706
824
 
707
825
  // The ranking expression controls the customized ranking on retrieval
@@ -867,6 +985,15 @@ message SearchResponse {
867
985
 
868
986
  // Document reference.
869
987
  message Reference {
988
+ // Chunk content.
989
+ message ChunkContent {
990
+ // Chunk textual content.
991
+ string content = 1;
992
+
993
+ // Page identifier.
994
+ string page_identifier = 2;
995
+ }
996
+
870
997
  // Title of the document.
871
998
  string title = 1;
872
999
 
@@ -884,6 +1011,9 @@ message SearchResponse {
884
1011
 
885
1012
  // Cloud Storage or HTTP uri for the document.
886
1013
  string uri = 3;
1014
+
1015
+ // List of cited chunk contents derived from document content.
1016
+ repeated ChunkContent chunk_contents = 4;
887
1017
  }
888
1018
 
889
1019
  // Summary with metadata information.
@@ -65,8 +65,8 @@ message TrainCustomModelRequest {
65
65
  // A newline delimited jsonl/ndjson file.
66
66
  //
67
67
  // For search-tuning model, each line should have the _id, title
68
- // and text. Example: {"_id": "doc1", title: "relevant doc", "text":
69
- // "relevant text"}
68
+ // and text. Example:
69
+ // `{"_id": "doc1", title: "relevant doc", "text": "relevant text"}`
70
70
  string corpus_data_path = 1;
71
71
 
72
72
  // The gcs query data which could be associated in train data.
@@ -137,6 +137,9 @@ message TrainCustomModelResponse {
137
137
  // * **in-progress**: Model training is in progress.
138
138
  // * **ready**: The model is ready for serving.
139
139
  string model_status = 3;
140
+
141
+ // The metrics of the trained model.
142
+ map<string, double> metrics = 4;
140
143
  }
141
144
 
142
145
  // Metadata related to the progress of the TrainCustomModel operation. This is
@@ -32,7 +32,8 @@ option objc_class_prefix = "DISCOVERYENGINE";
32
32
  option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha";
33
33
  option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha";
34
34
 
35
- // Service for operations related to [ServingConfig][].
35
+ // Service for operations related to
36
+ // [ServingConfig][google.cloud.discoveryengine.v1alpha.ServingConfig].
36
37
  service ServingConfigService {
37
38
  option (google.api.default_host) = "discoveryengine.googleapis.com";
38
39
  option (google.api.oauth_scopes) =