@google-cloud/discoveryengine 1.9.0 → 1.11.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 (160) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +32 -0
  3. package/build/protos/google/cloud/discoveryengine/v1/answer.proto +13 -0
  4. package/build/protos/google/cloud/discoveryengine/v1/chunk.proto +119 -0
  5. package/build/protos/google/cloud/discoveryengine/v1/common.proto +0 -5
  6. package/build/protos/google/cloud/discoveryengine/v1/completion.proto +31 -0
  7. package/build/protos/google/cloud/discoveryengine/v1/completion_service.proto +38 -0
  8. package/build/protos/google/cloud/discoveryengine/v1/conversational_search_service.proto +35 -0
  9. package/build/protos/google/cloud/discoveryengine/v1/document.proto +1 -1
  10. package/build/protos/google/cloud/discoveryengine/v1/document_processing_config.proto +37 -2
  11. package/build/protos/google/cloud/discoveryengine/v1/import_config.proto +108 -0
  12. package/build/protos/google/cloud/discoveryengine/v1/purge_config.proto +38 -0
  13. package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +200 -4
  14. package/build/protos/google/cloud/discoveryengine/v1/user_event_service.proto +3 -0
  15. package/build/protos/google/cloud/discoveryengine/v1alpha/evaluation.proto +232 -0
  16. package/build/protos/google/cloud/discoveryengine/v1alpha/evaluation_service.proto +252 -0
  17. package/build/protos/google/cloud/discoveryengine/v1alpha/import_config.proto +83 -0
  18. package/build/protos/google/cloud/discoveryengine/v1alpha/sample_query.proto +86 -0
  19. package/build/protos/google/cloud/discoveryengine/v1alpha/sample_query_service.proto +264 -0
  20. package/build/protos/google/cloud/discoveryengine/v1alpha/sample_query_set.proto +64 -0
  21. package/build/protos/google/cloud/discoveryengine/v1alpha/sample_query_set_service.proto +258 -0
  22. package/build/protos/google/cloud/discoveryengine/v1beta/chunk.proto +119 -0
  23. package/build/protos/google/cloud/discoveryengine/v1beta/common.proto +0 -5
  24. package/build/protos/google/cloud/discoveryengine/v1beta/conversational_search_service.proto +10 -2
  25. package/build/protos/google/cloud/discoveryengine/v1beta/document.proto +1 -1
  26. package/build/protos/google/cloud/discoveryengine/v1beta/document_processing_config.proto +37 -2
  27. package/build/protos/google/cloud/discoveryengine/v1beta/evaluation.proto +231 -0
  28. package/build/protos/google/cloud/discoveryengine/v1beta/evaluation_service.proto +252 -0
  29. package/build/protos/google/cloud/discoveryengine/v1beta/import_config.proto +83 -0
  30. package/build/protos/google/cloud/discoveryengine/v1beta/sample_query.proto +86 -0
  31. package/build/protos/google/cloud/discoveryengine/v1beta/sample_query_service.proto +264 -0
  32. package/build/protos/google/cloud/discoveryengine/v1beta/sample_query_set.proto +64 -0
  33. package/build/protos/google/cloud/discoveryengine/v1beta/sample_query_set_service.proto +256 -0
  34. package/build/protos/google/cloud/discoveryengine/v1beta/search_service.proto +67 -8
  35. package/build/protos/google/cloud/discoveryengine/v1beta/serving_config.proto +11 -5
  36. package/build/protos/protos.d.ts +31310 -20211
  37. package/build/protos/protos.js +86710 -60571
  38. package/build/protos/protos.json +7720 -5011
  39. package/build/src/v1/completion_service_client.d.ts +220 -0
  40. package/build/src/v1/completion_service_client.js +260 -0
  41. package/build/src/v1/completion_service_client_config.json +10 -0
  42. package/build/src/v1/control_service_client.d.ts +129 -1
  43. package/build/src/v1/control_service_client.js +176 -0
  44. package/build/src/v1/conversational_search_service_client.d.ts +147 -1
  45. package/build/src/v1/conversational_search_service_client.js +176 -0
  46. package/build/src/v1/data_store_service_client.d.ts +129 -1
  47. package/build/src/v1/data_store_service_client.js +176 -0
  48. package/build/src/v1/document_service_client.d.ts +131 -1
  49. package/build/src/v1/document_service_client.js +176 -0
  50. package/build/src/v1/engine_service_client.d.ts +129 -1
  51. package/build/src/v1/engine_service_client.js +176 -0
  52. package/build/src/v1/grounded_generation_service_client.d.ts +129 -0
  53. package/build/src/v1/grounded_generation_service_client.js +176 -0
  54. package/build/src/v1/project_service_client.d.ts +129 -0
  55. package/build/src/v1/project_service_client.js +176 -0
  56. package/build/src/v1/rank_service_client.d.ts +129 -0
  57. package/build/src/v1/rank_service_client.js +176 -0
  58. package/build/src/v1/recommendation_service_client.d.ts +129 -0
  59. package/build/src/v1/recommendation_service_client.js +176 -0
  60. package/build/src/v1/schema_service_client.d.ts +129 -1
  61. package/build/src/v1/schema_service_client.js +176 -0
  62. package/build/src/v1/search_service_client.d.ts +252 -1
  63. package/build/src/v1/search_service_client.js +258 -0
  64. package/build/src/v1/site_search_engine_service_client.d.ts +129 -1
  65. package/build/src/v1/site_search_engine_service_client.js +176 -0
  66. package/build/src/v1/user_event_service_client.d.ts +129 -0
  67. package/build/src/v1/user_event_service_client.js +176 -0
  68. package/build/src/v1alpha/acl_config_service_client.d.ts +108 -0
  69. package/build/src/v1alpha/acl_config_service_client.js +157 -0
  70. package/build/src/v1alpha/chunk_service_client.d.ts +108 -1
  71. package/build/src/v1alpha/chunk_service_client.js +157 -0
  72. package/build/src/v1alpha/completion_service_client.d.ts +108 -0
  73. package/build/src/v1alpha/completion_service_client.js +157 -0
  74. package/build/src/v1alpha/control_service_client.d.ts +108 -1
  75. package/build/src/v1alpha/control_service_client.js +157 -0
  76. package/build/src/v1alpha/conversational_search_service_client.d.ts +108 -1
  77. package/build/src/v1alpha/conversational_search_service_client.js +157 -0
  78. package/build/src/v1alpha/data_store_service_client.d.ts +108 -1
  79. package/build/src/v1alpha/data_store_service_client.js +157 -0
  80. package/build/src/v1alpha/document_service_client.d.ts +108 -1
  81. package/build/src/v1alpha/document_service_client.js +157 -0
  82. package/build/src/v1alpha/engine_service_client.d.ts +108 -1
  83. package/build/src/v1alpha/engine_service_client.js +157 -0
  84. package/build/src/v1alpha/estimate_billing_service_client.d.ts +108 -0
  85. package/build/src/v1alpha/estimate_billing_service_client.js +157 -0
  86. package/build/src/v1alpha/evaluation_service_client.d.ts +2349 -0
  87. package/build/src/v1alpha/evaluation_service_client.js +3288 -0
  88. package/build/src/v1alpha/evaluation_service_client_config.json +58 -0
  89. package/build/src/v1alpha/grounded_generation_service_client.d.ts +108 -0
  90. package/build/src/v1alpha/grounded_generation_service_client.js +157 -0
  91. package/build/src/v1alpha/index.d.ts +3 -0
  92. package/build/src/v1alpha/index.js +7 -1
  93. package/build/src/v1alpha/project_service_client.d.ts +108 -0
  94. package/build/src/v1alpha/project_service_client.js +157 -0
  95. package/build/src/v1alpha/rank_service_client.d.ts +108 -0
  96. package/build/src/v1alpha/rank_service_client.js +157 -0
  97. package/build/src/v1alpha/recommendation_service_client.d.ts +108 -0
  98. package/build/src/v1alpha/recommendation_service_client.js +157 -0
  99. package/build/src/v1alpha/sample_query_service_client.d.ts +2317 -0
  100. package/build/src/v1alpha/sample_query_service_client.js +3186 -0
  101. package/build/src/v1alpha/sample_query_service_client_config.json +68 -0
  102. package/build/src/v1alpha/sample_query_set_service_client.d.ts +2176 -0
  103. package/build/src/v1alpha/sample_query_set_service_client.js +2931 -0
  104. package/build/src/v1alpha/sample_query_set_service_client_config.json +63 -0
  105. package/build/src/v1alpha/schema_service_client.d.ts +108 -1
  106. package/build/src/v1alpha/schema_service_client.js +157 -0
  107. package/build/src/v1alpha/search_service_client.d.ts +108 -1
  108. package/build/src/v1alpha/search_service_client.js +157 -0
  109. package/build/src/v1alpha/search_tuning_service_client.d.ts +108 -0
  110. package/build/src/v1alpha/search_tuning_service_client.js +157 -0
  111. package/build/src/v1alpha/serving_config_service_client.d.ts +108 -1
  112. package/build/src/v1alpha/serving_config_service_client.js +157 -0
  113. package/build/src/v1alpha/site_search_engine_service_client.d.ts +108 -1
  114. package/build/src/v1alpha/site_search_engine_service_client.js +157 -0
  115. package/build/src/v1alpha/user_event_service_client.d.ts +108 -0
  116. package/build/src/v1alpha/user_event_service_client.js +157 -0
  117. package/build/src/v1beta/completion_service_client.d.ts +237 -0
  118. package/build/src/v1beta/completion_service_client.js +339 -0
  119. package/build/src/v1beta/control_service_client.d.ts +237 -1
  120. package/build/src/v1beta/control_service_client.js +333 -0
  121. package/build/src/v1beta/conversational_search_service_client.d.ts +237 -1
  122. package/build/src/v1beta/conversational_search_service_client.js +333 -0
  123. package/build/src/v1beta/data_store_service_client.d.ts +237 -1
  124. package/build/src/v1beta/data_store_service_client.js +339 -0
  125. package/build/src/v1beta/document_service_client.d.ts +237 -1
  126. package/build/src/v1beta/document_service_client.js +339 -0
  127. package/build/src/v1beta/engine_service_client.d.ts +237 -1
  128. package/build/src/v1beta/engine_service_client.js +339 -0
  129. package/build/src/v1beta/evaluation_service_client.d.ts +2325 -0
  130. package/build/src/v1beta/evaluation_service_client.js +3252 -0
  131. package/build/src/v1beta/evaluation_service_client_config.json +58 -0
  132. package/build/src/v1beta/grounded_generation_service_client.d.ts +237 -0
  133. package/build/src/v1beta/grounded_generation_service_client.js +333 -0
  134. package/build/src/v1beta/index.d.ts +3 -0
  135. package/build/src/v1beta/index.js +7 -1
  136. package/build/src/v1beta/project_service_client.d.ts +237 -0
  137. package/build/src/v1beta/project_service_client.js +339 -0
  138. package/build/src/v1beta/rank_service_client.d.ts +237 -0
  139. package/build/src/v1beta/rank_service_client.js +333 -0
  140. package/build/src/v1beta/recommendation_service_client.d.ts +237 -0
  141. package/build/src/v1beta/recommendation_service_client.js +333 -0
  142. package/build/src/v1beta/sample_query_service_client.d.ts +2293 -0
  143. package/build/src/v1beta/sample_query_service_client.js +3150 -0
  144. package/build/src/v1beta/sample_query_service_client_config.json +68 -0
  145. package/build/src/v1beta/sample_query_set_service_client.d.ts +2150 -0
  146. package/build/src/v1beta/sample_query_set_service_client.js +2895 -0
  147. package/build/src/v1beta/sample_query_set_service_client_config.json +63 -0
  148. package/build/src/v1beta/schema_service_client.d.ts +237 -1
  149. package/build/src/v1beta/schema_service_client.js +339 -0
  150. package/build/src/v1beta/search_service_client.d.ts +267 -13
  151. package/build/src/v1beta/search_service_client.js +353 -8
  152. package/build/src/v1beta/search_tuning_service_client.d.ts +237 -0
  153. package/build/src/v1beta/search_tuning_service_client.js +339 -0
  154. package/build/src/v1beta/serving_config_service_client.d.ts +237 -1
  155. package/build/src/v1beta/serving_config_service_client.js +333 -0
  156. package/build/src/v1beta/site_search_engine_service_client.d.ts +237 -1
  157. package/build/src/v1beta/site_search_engine_service_client.js +339 -0
  158. package/build/src/v1beta/user_event_service_client.d.ts +237 -0
  159. package/build/src/v1beta/user_event_service_client.js +339 -0
  160. package/package.json +1 -1
@@ -325,6 +325,38 @@ message CloudSqlSource {
325
325
  bool offload = 6;
326
326
  }
327
327
 
328
+ // AlloyDB source import data from.
329
+ message AlloyDbSource {
330
+ // The project ID that the AlloyDB source is in
331
+ // with a length limit of 128 characters. If not specified, inherits the
332
+ // project ID from the parent request.
333
+ string project_id = 1;
334
+
335
+ // Required. The AlloyDB location to copy the data from with a length limit of
336
+ // 256 characters.
337
+ string location_id = 2 [(google.api.field_behavior) = REQUIRED];
338
+
339
+ // Required. The AlloyDB cluster to copy the data from with a length limit of
340
+ // 256 characters.
341
+ string cluster_id = 3 [(google.api.field_behavior) = REQUIRED];
342
+
343
+ // Required. The AlloyDB database to copy the data from with a length limit of
344
+ // 256 characters.
345
+ string database_id = 4 [(google.api.field_behavior) = REQUIRED];
346
+
347
+ // Required. The AlloyDB table to copy the data from with a length limit of
348
+ // 256 characters.
349
+ string table_id = 5 [(google.api.field_behavior) = REQUIRED];
350
+
351
+ // Intermediate Cloud Storage directory used for the import with a length
352
+ // limit of 2,000 characters. Can be specified if one wants to have the
353
+ // AlloyDB export to a specific Cloud Storage directory.
354
+ //
355
+ // Ensure that the AlloyDB service account has the necessary Cloud
356
+ // Storage Admin permissions to access the specified Cloud Storage directory.
357
+ string gcs_staging_dir = 6;
358
+ }
359
+
328
360
  // Firestore source import data from.
329
361
  message FirestoreSource {
330
362
  // The project ID that the Cloud SQL source is in with a length limit of 128
@@ -498,6 +530,9 @@ message ImportDocumentsRequest {
498
530
  // Firestore input source.
499
531
  FirestoreSource firestore_source = 13;
500
532
 
533
+ // AlloyDB input source.
534
+ AlloyDbSource alloy_db_source = 14;
535
+
501
536
  // Cloud Bigtable input source.
502
537
  BigtableSource bigtable_source = 15;
503
538
  }
@@ -662,3 +697,76 @@ message ImportSuggestionDenyListEntriesMetadata {
662
697
  // finish time.
663
698
  google.protobuf.Timestamp update_time = 2;
664
699
  }
700
+
701
+ // Request message for
702
+ // [CompletionService.ImportCompletionSuggestions][google.cloud.discoveryengine.v1.CompletionService.ImportCompletionSuggestions]
703
+ // method.
704
+ message ImportCompletionSuggestionsRequest {
705
+ // The inline source for CompletionSuggestions.
706
+ message InlineSource {
707
+ // Required. A list of all denylist entries to import. Max of 1000 items.
708
+ repeated CompletionSuggestion suggestions = 1
709
+ [(google.api.field_behavior) = REQUIRED];
710
+ }
711
+
712
+ // The source of the autocomplete suggestions.
713
+ oneof source {
714
+ // The Inline source for suggestion entries.
715
+ InlineSource inline_source = 2;
716
+
717
+ // Cloud Storage location for the input content.
718
+ GcsSource gcs_source = 3;
719
+
720
+ // BigQuery input source.
721
+ BigQuerySource bigquery_source = 4;
722
+ }
723
+
724
+ // Required. The parent data store resource name for which to import customer
725
+ // autocomplete suggestions.
726
+ //
727
+ // Follows pattern `projects/*/locations/*/collections/*/dataStores/*`
728
+ string parent = 1 [
729
+ (google.api.field_behavior) = REQUIRED,
730
+ (google.api.resource_reference) = {
731
+ type: "discoveryengine.googleapis.com/DataStore"
732
+ }
733
+ ];
734
+
735
+ // The desired location of errors incurred during the Import.
736
+ ImportErrorConfig error_config = 5;
737
+ }
738
+
739
+ // Response of the
740
+ // [CompletionService.ImportCompletionSuggestions][google.cloud.discoveryengine.v1.CompletionService.ImportCompletionSuggestions]
741
+ // method. If the long running operation is done, this message is returned by
742
+ // the google.longrunning.Operations.response field if the operation is
743
+ // successful.
744
+ message ImportCompletionSuggestionsResponse {
745
+ // A sample of errors encountered while processing the request.
746
+ repeated google.rpc.Status error_samples = 1;
747
+
748
+ // The desired location of errors incurred during the Import.
749
+ ImportErrorConfig error_config = 2;
750
+ }
751
+
752
+ // Metadata related to the progress of the ImportCompletionSuggestions
753
+ // operation. This will be returned by the google.longrunning.Operation.metadata
754
+ // field.
755
+ message ImportCompletionSuggestionsMetadata {
756
+ // Operation create time.
757
+ google.protobuf.Timestamp create_time = 1;
758
+
759
+ // Operation last update time. If the operation is done, this is also the
760
+ // finish time.
761
+ google.protobuf.Timestamp update_time = 2;
762
+
763
+ // Count of
764
+ // [CompletionSuggestion][google.cloud.discoveryengine.v1.CompletionSuggestion]s
765
+ // successfully imported.
766
+ int64 success_count = 3;
767
+
768
+ // Count of
769
+ // [CompletionSuggestion][google.cloud.discoveryengine.v1.CompletionSuggestion]s
770
+ // that failed to be imported.
771
+ int64 failure_count = 4;
772
+ }
@@ -125,3 +125,41 @@ message PurgeSuggestionDenyListEntriesMetadata {
125
125
  // finish time.
126
126
  google.protobuf.Timestamp update_time = 2;
127
127
  }
128
+
129
+ // Request message for
130
+ // [CompletionService.PurgeCompletionSuggestions][google.cloud.discoveryengine.v1.CompletionService.PurgeCompletionSuggestions]
131
+ // method.
132
+ message PurgeCompletionSuggestionsRequest {
133
+ // Required. The parent data store resource name for which to purge completion
134
+ // suggestions. Follows pattern
135
+ // projects/*/locations/*/collections/*/dataStores/*.
136
+ string parent = 1 [
137
+ (google.api.field_behavior) = REQUIRED,
138
+ (google.api.resource_reference) = {
139
+ type: "discoveryengine.googleapis.com/DataStore"
140
+ }
141
+ ];
142
+ }
143
+
144
+ // Response message for
145
+ // [CompletionService.PurgeCompletionSuggestions][google.cloud.discoveryengine.v1.CompletionService.PurgeCompletionSuggestions]
146
+ // method.
147
+ message PurgeCompletionSuggestionsResponse {
148
+ // Whether the completion suggestions were successfully purged.
149
+ bool purge_succeeded = 1;
150
+
151
+ // A sample of errors encountered while processing the request.
152
+ repeated google.rpc.Status error_samples = 2;
153
+ }
154
+
155
+ // Metadata related to the progress of the PurgeCompletionSuggestions
156
+ // operation. This is returned by the google.longrunning.Operation.metadata
157
+ // field.
158
+ message PurgeCompletionSuggestionsMetadata {
159
+ // Operation create time.
160
+ google.protobuf.Timestamp create_time = 1;
161
+
162
+ // Operation last update time. If the operation is done, this is also the
163
+ // finish time.
164
+ google.protobuf.Timestamp update_time = 2;
165
+ }
@@ -20,6 +20,7 @@ import "google/api/annotations.proto";
20
20
  import "google/api/client.proto";
21
21
  import "google/api/field_behavior.proto";
22
22
  import "google/api/resource.proto";
23
+ import "google/cloud/discoveryengine/v1/chunk.proto";
23
24
  import "google/cloud/discoveryengine/v1/common.proto";
24
25
  import "google/cloud/discoveryengine/v1/document.proto";
25
26
  import "google/protobuf/struct.proto";
@@ -70,8 +71,8 @@ message SearchRequest {
70
71
  }
71
72
 
72
73
  // A struct to define data stores to filter on in a search call and
73
- // configurations for those data stores. A maximum of 1 DataStoreSpec per
74
- // data_store is allowed. Otherwise, an `INVALID_ARGUMENT` error is returned.
74
+ // configurations for those data stores. Otherwise, an `INVALID_ARGUMENT`
75
+ // error is returned.
75
76
  message DataStoreSpec {
76
77
  // Required. Full resource name of
77
78
  // [DataStore][google.cloud.discoveryengine.v1.DataStore], such as
@@ -150,6 +151,9 @@ message SearchRequest {
150
151
  // Maximum facet values that are returned for this facet. If
151
152
  // unspecified, defaults to 20. The maximum allowed value is 300. Values
152
153
  // above 300 are coerced to 300.
154
+ // For aggregation in healthcare search, when the [FacetKey.key] is
155
+ // "healthcare_aggregation_key", the limit will be overridden to
156
+ // 10,000 internally, regardless of the value set here.
153
157
  //
154
158
  // If this field is negative, an `INVALID_ARGUMENT` is returned.
155
159
  int32 limit = 2;
@@ -367,8 +371,9 @@ message SearchRequest {
367
371
  //
368
372
  // At most 10 results for documents mode, or 50 for chunks mode, can be
369
373
  // used to generate a summary. The chunks mode is used when
370
- // [SearchRequest.ContentSearchSpec.search_result_mode][] is set to
371
- // [CHUNKS][SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS].
374
+ // [SearchRequest.ContentSearchSpec.search_result_mode][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.search_result_mode]
375
+ // is set to
376
+ // [CHUNKS][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS].
372
377
  int32 summary_result_count = 1;
373
378
 
374
379
  // Specifies whether to include citations in the summary. The default
@@ -491,6 +496,41 @@ message SearchRequest {
491
496
  int32 num_next_segments = 5;
492
497
  }
493
498
 
499
+ // Specifies the chunk spec to be returned from the search response.
500
+ // Only available if the
501
+ // [SearchRequest.ContentSearchSpec.search_result_mode][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.search_result_mode]
502
+ // is set to
503
+ // [CHUNKS][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS]
504
+ message ChunkSpec {
505
+ // The number of previous chunks to be returned of the current chunk. The
506
+ // maximum allowed value is 3.
507
+ // If not specified, no previous chunks will be returned.
508
+ int32 num_previous_chunks = 1;
509
+
510
+ // The number of next chunks to be returned of the current chunk. The
511
+ // maximum allowed value is 3.
512
+ // If not specified, no next chunks will be returned.
513
+ int32 num_next_chunks = 2;
514
+ }
515
+
516
+ // Specifies the search result mode. If unspecified, the
517
+ // search result mode is based on
518
+ // [DataStore.DocumentProcessingConfig.chunking_config][]:
519
+ // * If [DataStore.DocumentProcessingConfig.chunking_config][] is specified,
520
+ // it defaults to `CHUNKS`.
521
+ // * Otherwise, it defaults to `DOCUMENTS`.
522
+ enum SearchResultMode {
523
+ // Default value.
524
+ SEARCH_RESULT_MODE_UNSPECIFIED = 0;
525
+
526
+ // Returns documents in the search result.
527
+ DOCUMENTS = 1;
528
+
529
+ // Returns chunks in the search result. Only available if the
530
+ // [DataStore.DocumentProcessingConfig.chunking_config][] is specified.
531
+ CHUNKS = 2;
532
+ }
533
+
494
534
  // If `snippetSpec` is not specified, snippets are not included in the
495
535
  // search response.
496
536
  SnippetSpec snippet_spec = 1;
@@ -502,6 +542,85 @@ message SearchRequest {
502
542
  // If there is no extractive_content_spec provided, there will be no
503
543
  // extractive answer in the search response.
504
544
  ExtractiveContentSpec extractive_content_spec = 3;
545
+
546
+ // Specifies the search result mode. If unspecified, the
547
+ // search result mode is based on
548
+ // [DataStore.DocumentProcessingConfig.chunking_config][]:
549
+ // * If [DataStore.DocumentProcessingConfig.chunking_config][] is specified,
550
+ // it defaults to `CHUNKS`.
551
+ // * Otherwise, it defaults to `DOCUMENTS`.
552
+ SearchResultMode search_result_mode = 4;
553
+
554
+ // Specifies the chunk spec to be returned from the search response.
555
+ // Only available if the
556
+ // [SearchRequest.ContentSearchSpec.search_result_mode][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.search_result_mode]
557
+ // is set to
558
+ // [CHUNKS][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS]
559
+ ChunkSpec chunk_spec = 5;
560
+ }
561
+
562
+ // Specification for search as you type in search requests.
563
+ message SearchAsYouTypeSpec {
564
+ // Enum describing under which condition search as you type should occur.
565
+ enum Condition {
566
+ // Server behavior defaults to
567
+ // [Condition.DISABLED][google.cloud.discoveryengine.v1.SearchRequest.SearchAsYouTypeSpec.Condition.DISABLED].
568
+ CONDITION_UNSPECIFIED = 0;
569
+
570
+ // Disables Search As You Type.
571
+ DISABLED = 1;
572
+
573
+ // Enables Search As You Type.
574
+ ENABLED = 2;
575
+ }
576
+
577
+ // The condition under which search as you type should occur.
578
+ // Default to
579
+ // [Condition.DISABLED][google.cloud.discoveryengine.v1.SearchRequest.SearchAsYouTypeSpec.Condition.DISABLED].
580
+ Condition condition = 1;
581
+ }
582
+
583
+ // Session specification.
584
+ //
585
+ // Multi-turn Search feature is currently at private GA stage. Please use
586
+ // v1alpha or v1beta version instead before we launch this feature to public
587
+ // GA. Or ask for allowlisting through Google Support team.
588
+ message SessionSpec {
589
+ // If set, the search result gets stored to the "turn" specified by this
590
+ // query ID.
591
+ //
592
+ // Example: Let's say the session looks like this:
593
+ // session {
594
+ // name: ".../sessions/xxx"
595
+ // turns {
596
+ // query { text: "What is foo?" query_id: ".../questions/yyy" }
597
+ // answer: "Foo is ..."
598
+ // }
599
+ // turns {
600
+ // query { text: "How about bar then?" query_id: ".../questions/zzz" }
601
+ // }
602
+ // }
603
+ //
604
+ // The user can call /search API with a request like this:
605
+ //
606
+ // session: ".../sessions/xxx"
607
+ // session_spec { query_id: ".../questions/zzz" }
608
+ //
609
+ // Then, the API stores the search result, associated with the last turn.
610
+ // The stored search result can be used by a subsequent /answer API call
611
+ // (with the session ID and the query ID specified). Also, it is possible
612
+ // to call /search and /answer in parallel with the same session ID & query
613
+ // ID.
614
+ string query_id = 1;
615
+
616
+ // The number of top search results to persist. The persisted search results
617
+ // can be used for the subsequent /answer api call.
618
+ //
619
+ // This field is simliar to the `summary_result_count` field in
620
+ // [SearchRequest.ContentSearchSpec.SummarySpec.summary_result_count][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SummarySpec.summary_result_count].
621
+ //
622
+ // At most 10 results for documents mode, or 50 for chunks mode.
623
+ optional int32 search_result_persistence_count = 2;
505
624
  }
506
625
 
507
626
  // Required. The resource name of the Search serving config, such as
@@ -617,6 +736,13 @@ message SearchRequest {
617
736
  // is used to deduce `device_type` for analytics.
618
737
  UserInfo user_info = 21;
619
738
 
739
+ // The BCP-47 language code, such as "en-US" or "sr-Latn". For more
740
+ // information, see [Standard
741
+ // fields](https://cloud.google.com/apis/design/standard_fields). This field
742
+ // helps to better interpret the query. If a value isn't specified, the query
743
+ // language code is automatically detected, which may not be accurate.
744
+ string language_code = 35;
745
+
620
746
  // Facet specifications for faceted search. If empty, no facets are returned.
621
747
  //
622
748
  // A maximum of 100 values are allowed. Otherwise, an `INVALID_ARGUMENT`
@@ -694,6 +820,46 @@ message SearchRequest {
694
820
  // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
695
821
  // for more details.
696
822
  map<string, string> user_labels = 22;
823
+
824
+ // Search as you type configuration. Only supported for the
825
+ // [IndustryVertical.MEDIA][google.cloud.discoveryengine.v1.IndustryVertical.MEDIA]
826
+ // vertical.
827
+ SearchAsYouTypeSpec search_as_you_type_spec = 31;
828
+
829
+ // The session resource name. Optional.
830
+ //
831
+ // Session allows users to do multi-turn /search API calls or coordination
832
+ // between /search API calls and /answer API calls.
833
+ //
834
+ // Example #1 (multi-turn /search API calls):
835
+ // 1. Call /search API with the auto-session mode (see below).
836
+ // 2. Call /search API with the session ID generated in the first call.
837
+ // Here, the previous search query gets considered in query
838
+ // standing. I.e., if the first query is "How did Alphabet do in 2022?"
839
+ // and the current query is "How about 2023?", the current query will
840
+ // be interpreted as "How did Alphabet do in 2023?".
841
+ //
842
+ // Example #2 (coordination between /search API calls and /answer API calls):
843
+ // 1. Call /search API with the auto-session mode (see below).
844
+ // 2. Call /answer API with the session ID generated in the first call.
845
+ // Here, the answer generation happens in the context of the search
846
+ // results from the first search call.
847
+ //
848
+ // Auto-session mode: when `projects/.../sessions/-` is used, a new session
849
+ // gets automatically created. Otherwise, users can use the create-session API
850
+ // to create a session manually.
851
+ //
852
+ // Multi-turn Search feature is currently at private GA stage. Please use
853
+ // v1alpha or v1beta version instead before we launch this feature to public
854
+ // GA. Or ask for allowlisting through Google Support team.
855
+ string session = 41 [(google.api.resource_reference) = {
856
+ type: "discoveryengine.googleapis.com/Session"
857
+ }];
858
+
859
+ // Session specification.
860
+ //
861
+ // Can be used only when `session` is set.
862
+ SessionSpec session_spec = 42;
697
863
  }
698
864
 
699
865
  // Response message for
@@ -709,6 +875,12 @@ message SearchResponse {
709
875
  // The document data snippet in the search response. Only fields that are
710
876
  // marked as `retrievable` are populated.
711
877
  Document document = 2;
878
+
879
+ // The chunk data in the search response if the
880
+ // [SearchRequest.ContentSearchSpec.search_result_mode][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.search_result_mode]
881
+ // is set to
882
+ // [CHUNKS][google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS].
883
+ Chunk chunk = 18;
712
884
  }
713
885
 
714
886
  // A facet result.
@@ -890,6 +1062,23 @@ message SearchResponse {
890
1062
  int64 pinned_result_count = 2;
891
1063
  }
892
1064
 
1065
+ // Information about the session.
1066
+ message SessionInfo {
1067
+ // Name of the session.
1068
+ // If the auto-session mode is used (when
1069
+ // [SearchRequest.session][google.cloud.discoveryengine.v1.SearchRequest.session]
1070
+ // ends with "-"), this field holds the newly generated session name.
1071
+ string name = 1;
1072
+
1073
+ // Query ID that corresponds to this search API call.
1074
+ // One session can have multiple turns, each with a unique query ID.
1075
+ //
1076
+ // By specifying the session name and this query ID in the Answer API call,
1077
+ // the answer generation happens in the context of the search results from
1078
+ // this search call.
1079
+ string query_id = 2;
1080
+ }
1081
+
893
1082
  // A list of matched documents. The order represents the ranking.
894
1083
  repeated SearchResult results = 1;
895
1084
 
@@ -936,4 +1125,11 @@ message SearchResponse {
936
1125
 
937
1126
  // Query expansion information for the returned results.
938
1127
  QueryExpansionInfo query_expansion_info = 14;
1128
+
1129
+ // Session information.
1130
+ //
1131
+ // Only set if
1132
+ // [SearchRequest.session][google.cloud.discoveryengine.v1.SearchRequest.session]
1133
+ // is provided. See its description for more details.
1134
+ SessionInfo session_info = 19;
939
1135
  }
@@ -67,6 +67,9 @@ service UserEventService {
67
67
  additional_bindings {
68
68
  get: "/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:collect"
69
69
  }
70
+ additional_bindings {
71
+ get: "/v1/{parent=projects/*/locations/*}/userEvents:collect"
72
+ }
70
73
  };
71
74
  }
72
75
 
@@ -0,0 +1,232 @@
1
+ // Copyright 2024 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/field_behavior.proto";
20
+ import "google/api/resource.proto";
21
+ import "google/cloud/discoveryengine/v1alpha/search_service.proto";
22
+ import "google/protobuf/timestamp.proto";
23
+ import "google/rpc/status.proto";
24
+
25
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Alpha";
26
+ option go_package = "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb;discoveryenginepb";
27
+ option java_multiple_files = true;
28
+ option java_outer_classname = "EvaluationProto";
29
+ option java_package = "com.google.cloud.discoveryengine.v1alpha";
30
+ option objc_class_prefix = "DISCOVERYENGINE";
31
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha";
32
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha";
33
+
34
+ // An evaluation is a single execution (or run) of an evaluation process. It
35
+ // encapsulates the state of the evaluation and the resulting data.
36
+ message Evaluation {
37
+ option (google.api.resource) = {
38
+ type: "discoveryengine.googleapis.com/Evaluation"
39
+ pattern: "projects/{project}/locations/{location}/evaluations/{evaluation}"
40
+ };
41
+
42
+ // Describes the specification of the evaluation.
43
+ message EvaluationSpec {
44
+ // Describes the specification of the query set.
45
+ message QuerySetSpec {
46
+ // Required. The full resource name of the
47
+ // [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet]
48
+ // used for the evaluation, in the format of
49
+ // `projects/{project}/locations/{location}/sampleQuerySets/{sampleQuerySet}`.
50
+ string sample_query_set = 1 [
51
+ (google.api.field_behavior) = REQUIRED,
52
+ (google.api.resource_reference) = {
53
+ type: "discoveryengine.googleapis.com/SampleQuerySet"
54
+ }
55
+ ];
56
+ }
57
+
58
+ // The search specification.
59
+ oneof search_spec {
60
+ // Required. The search request that is used to perform the evaluation.
61
+ //
62
+ // Only the following fields within SearchRequest are supported; if any
63
+ // other fields are provided, an UNSUPPORTED error will be returned:
64
+ //
65
+ // * [SearchRequest.serving_config][google.cloud.discoveryengine.v1alpha.SearchRequest.serving_config]
66
+ // * [SearchRequest.branch][google.cloud.discoveryengine.v1alpha.SearchRequest.branch]
67
+ // * [SearchRequest.canonical_filter][google.cloud.discoveryengine.v1alpha.SearchRequest.canonical_filter]
68
+ // * [SearchRequest.query_expansion_spec][google.cloud.discoveryengine.v1alpha.SearchRequest.query_expansion_spec]
69
+ // * [SearchRequest.spell_correction_spec][google.cloud.discoveryengine.v1alpha.SearchRequest.spell_correction_spec]
70
+ // * [SearchRequest.content_search_spec][google.cloud.discoveryengine.v1alpha.SearchRequest.content_search_spec]
71
+ // * [SearchRequest.user_pseudo_id][google.cloud.discoveryengine.v1alpha.SearchRequest.user_pseudo_id]
72
+ SearchRequest search_request = 2 [(google.api.field_behavior) = REQUIRED];
73
+ }
74
+
75
+ // Required. The specification of the query set.
76
+ QuerySetSpec query_set_spec = 1 [(google.api.field_behavior) = REQUIRED];
77
+ }
78
+
79
+ // Describes the state of an evaluation.
80
+ enum State {
81
+ // The evaluation is unspecified.
82
+ STATE_UNSPECIFIED = 0;
83
+
84
+ // The service is preparing to run the evaluation.
85
+ PENDING = 1;
86
+
87
+ // The evaluation is in progress.
88
+ RUNNING = 2;
89
+
90
+ // The evaluation completed successfully.
91
+ SUCCEEDED = 3;
92
+
93
+ // The evaluation failed.
94
+ FAILED = 4;
95
+ }
96
+
97
+ // Identifier. The full resource name of the
98
+ // [Evaluation][google.cloud.discoveryengine.v1alpha.Evaluation], in the
99
+ // format of
100
+ // `projects/{project}/locations/{location}/evaluations/{evaluation}`.
101
+ //
102
+ // This field must be a UTF-8 encoded string with a length limit of 1024
103
+ // characters.
104
+ string name = 1 [(google.api.field_behavior) = IDENTIFIER];
105
+
106
+ // Required. The specification of the evaluation.
107
+ EvaluationSpec evaluation_spec = 2 [(google.api.field_behavior) = REQUIRED];
108
+
109
+ // Output only. The metrics produced by the evaluation, averaged across all
110
+ // [SampleQuery][google.cloud.discoveryengine.v1alpha.SampleQuery]s in the
111
+ // [SampleQuerySet][google.cloud.discoveryengine.v1alpha.SampleQuerySet].
112
+ //
113
+ // Only populated when the evaluation's state is SUCCEEDED.
114
+ QualityMetrics quality_metrics = 3
115
+ [(google.api.field_behavior) = OUTPUT_ONLY];
116
+
117
+ // Output only. The state of the evaluation.
118
+ State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
119
+
120
+ // Output only. The error that occurred during evaluation. Only populated when
121
+ // the evaluation's state is FAILED.
122
+ google.rpc.Status error = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
123
+
124
+ // Output only. Timestamp the
125
+ // [Evaluation][google.cloud.discoveryengine.v1alpha.Evaluation] was created
126
+ // at.
127
+ google.protobuf.Timestamp create_time = 6
128
+ [(google.api.field_behavior) = OUTPUT_ONLY];
129
+
130
+ // Output only. Timestamp the
131
+ // [Evaluation][google.cloud.discoveryengine.v1alpha.Evaluation] was completed
132
+ // at.
133
+ google.protobuf.Timestamp end_time = 7
134
+ [(google.api.field_behavior) = OUTPUT_ONLY];
135
+
136
+ // Output only. A sample of errors encountered while processing the request.
137
+ repeated google.rpc.Status error_samples = 8
138
+ [(google.api.field_behavior) = OUTPUT_ONLY];
139
+ }
140
+
141
+ // Describes the metrics produced by the evaluation.
142
+ message QualityMetrics {
143
+ // Stores the metric values at specific top-k levels.
144
+ message TopkMetrics {
145
+ // The top-1 value.
146
+ double top_1 = 1;
147
+
148
+ // The top-3 value.
149
+ double top_3 = 2;
150
+
151
+ // The top-5 value.
152
+ double top_5 = 3;
153
+
154
+ // The top-10 value.
155
+ double top_10 = 4;
156
+ }
157
+
158
+ // Recall per document, at various top-k cutoff levels.
159
+ //
160
+ // Recall is the fraction of relevant documents retrieved out of all
161
+ // relevant documents.
162
+ //
163
+ // Example (top-5):
164
+ // * For a single
165
+ // [SampleQuery][google.cloud.discoveryengine.v1alpha.SampleQuery], If 3 out
166
+ // of 5 relevant documents are retrieved in the top-5, recall@5 = 3/5 = 0.6
167
+ TopkMetrics doc_recall = 1;
168
+
169
+ // Precision per document, at various top-k cutoff levels.
170
+ //
171
+ // Precision is the fraction of retrieved documents that are relevant.
172
+ //
173
+ // Example (top-5):
174
+ // * For a single
175
+ // [SampleQuery][google.cloud.discoveryengine.v1alpha.SampleQuery], If 4 out
176
+ // of 5 retrieved documents in the top-5 are relevant, precision@5 = 4/5 =
177
+ // 0.8
178
+ TopkMetrics doc_precision = 2;
179
+
180
+ // Normalized discounted cumulative gain (NDCG) per document, at various top-k
181
+ // cutoff levels.
182
+ //
183
+ // NDCG measures the ranking quality, giving higher relevance to top
184
+ // results.
185
+ //
186
+ // Example (top-3):
187
+ // Suppose [SampleQuery][google.cloud.discoveryengine.v1alpha.SampleQuery]
188
+ // with three retrieved documents (D1, D2, D3) and binary relevance
189
+ // judgements (1 for relevant, 0 for not relevant):
190
+ //
191
+ // Retrieved: [D3 (0), D1 (1), D2 (1)]
192
+ // Ideal: [D1 (1), D2 (1), D3 (0)]
193
+ //
194
+ // Calculate NDCG@3 for each
195
+ // [SampleQuery][google.cloud.discoveryengine.v1alpha.SampleQuery]:
196
+ // * DCG@3: 0/log2(1+1) + 1/log2(2+1) + 1/log2(3+1) = 1.13
197
+ // * Ideal DCG@3: 1/log2(1+1) + 1/log2(2+1) + 0/log2(3+1) = 1.63
198
+ // * NDCG@3: 1.13/1.63 = 0.693
199
+ TopkMetrics doc_ndcg = 3;
200
+
201
+ // Recall per page, at various top-k cutoff levels.
202
+ //
203
+ // Recall is the fraction of relevant pages retrieved out of all relevant
204
+ // pages.
205
+ //
206
+ // Example (top-5):
207
+ // * For a single
208
+ // [SampleQuery][google.cloud.discoveryengine.v1alpha.SampleQuery], if 3 out
209
+ // of 5 relevant pages are retrieved in the top-5, recall@5 = 3/5 = 0.6
210
+ TopkMetrics page_recall = 4;
211
+
212
+ // Normalized discounted cumulative gain (NDCG) per page, at various top-k
213
+ // cutoff levels.
214
+ //
215
+ // NDCG measures the ranking quality, giving higher relevance to top
216
+ // results.
217
+ //
218
+ // Example (top-3):
219
+ // Suppose [SampleQuery][google.cloud.discoveryengine.v1alpha.SampleQuery]
220
+ // with three retrieved pages (P1, P2, P3) and binary relevance judgements (1
221
+ // for relevant, 0 for not relevant):
222
+ //
223
+ // Retrieved: [P3 (0), P1 (1), P2 (1)]
224
+ // Ideal: [P1 (1), P2 (1), P3 (0)]
225
+ //
226
+ // Calculate NDCG@3 for
227
+ // [SampleQuery][google.cloud.discoveryengine.v1alpha.SampleQuery]:
228
+ // * DCG@3: 0/log2(1+1) + 1/log2(2+1) + 1/log2(3+1) = 1.13
229
+ // * Ideal DCG@3: 1/log2(1+1) + 1/log2(2+1) + 0/log2(3+1) = 1.63
230
+ // * NDCG@3: 1.13/1.63 = 0.693
231
+ TopkMetrics page_ndcg = 5;
232
+ }