@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
@@ -0,0 +1,119 @@
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.v1beta;
18
+
19
+ import "google/api/field_behavior.proto";
20
+ import "google/api/resource.proto";
21
+ import "google/protobuf/struct.proto";
22
+
23
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
24
+ option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb";
25
+ option java_multiple_files = true;
26
+ option java_outer_classname = "ChunkProto";
27
+ option java_package = "com.google.cloud.discoveryengine.v1beta";
28
+ option objc_class_prefix = "DISCOVERYENGINE";
29
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
30
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
31
+
32
+ // Chunk captures all raw metadata information of items to be recommended or
33
+ // searched in the chunk mode.
34
+ message Chunk {
35
+ option (google.api.resource) = {
36
+ type: "discoveryengine.googleapis.com/Chunk"
37
+ pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}"
38
+ pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}"
39
+ };
40
+
41
+ // Document metadata contains the information of the document of the current
42
+ // chunk.
43
+ message DocumentMetadata {
44
+ // Uri of the document.
45
+ string uri = 1;
46
+
47
+ // Title of the document.
48
+ string title = 2;
49
+
50
+ // Data representation.
51
+ // The structured JSON data for the document. It should conform to the
52
+ // registered [Schema][google.cloud.discoveryengine.v1beta.Schema] or an
53
+ // `INVALID_ARGUMENT` error is thrown.
54
+ google.protobuf.Struct struct_data = 3;
55
+ }
56
+
57
+ // Page span of the chunk.
58
+ message PageSpan {
59
+ // The start page of the chunk.
60
+ int32 page_start = 1;
61
+
62
+ // The end page of the chunk.
63
+ int32 page_end = 2;
64
+ }
65
+
66
+ // Metadata of the current chunk. This field is only populated on
67
+ // [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
68
+ // API.
69
+ message ChunkMetadata {
70
+ // The previous chunks of the current chunk. The number is controlled by
71
+ // [SearchRequest.ContentSearchSpec.ChunkSpec.num_previous_chunks][google.cloud.discoveryengine.v1beta.SearchRequest.ContentSearchSpec.ChunkSpec.num_previous_chunks].
72
+ // This field is only populated on
73
+ // [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
74
+ // API.
75
+ repeated Chunk previous_chunks = 1;
76
+
77
+ // The next chunks of the current chunk. The number is controlled by
78
+ // [SearchRequest.ContentSearchSpec.ChunkSpec.num_next_chunks][google.cloud.discoveryengine.v1beta.SearchRequest.ContentSearchSpec.ChunkSpec.num_next_chunks].
79
+ // This field is only populated on
80
+ // [SearchService.Search][google.cloud.discoveryengine.v1beta.SearchService.Search]
81
+ // API.
82
+ repeated Chunk next_chunks = 2;
83
+ }
84
+
85
+ // The full resource name of the chunk.
86
+ // Format:
87
+ // `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`.
88
+ //
89
+ // This field must be a UTF-8 encoded string with a length limit of 1024
90
+ // characters.
91
+ string name = 1;
92
+
93
+ // Unique chunk ID of the current chunk.
94
+ string id = 2;
95
+
96
+ // Content is a string from a document (parsed content).
97
+ string content = 3;
98
+
99
+ // Output only. Represents the relevance score based on similarity.
100
+ // Higher score indicates higher chunk relevance.
101
+ // The score is in range [-1.0, 1.0].
102
+ // Only populated on [SearchService.SearchResponse][].
103
+ optional double relevance_score = 8
104
+ [(google.api.field_behavior) = OUTPUT_ONLY];
105
+
106
+ // Metadata of the document from the current chunk.
107
+ DocumentMetadata document_metadata = 5;
108
+
109
+ // Output only. This field is OUTPUT_ONLY.
110
+ // It contains derived data that are not in the original input document.
111
+ google.protobuf.Struct derived_struct_data = 4
112
+ [(google.api.field_behavior) = OUTPUT_ONLY];
113
+
114
+ // Page span of the chunk.
115
+ PageSpan page_span = 6;
116
+
117
+ // Output only. Metadata of the current chunk.
118
+ ChunkMetadata chunk_metadata = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
119
+ }
@@ -51,11 +51,6 @@ option (google.api.resource_definition) = {
51
51
  type: "healthcare.googleapis.com/FhirStore"
52
52
  pattern: "projects/{project}/locations/{location}/datasets/{dataset}/fhirStores/{fhir_store}"
53
53
  };
54
- option (google.api.resource_definition) = {
55
- type: "discoveryengine.googleapis.com/Chunk"
56
- pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}"
57
- pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}"
58
- };
59
54
 
60
55
  // The industry vertical associated with the
61
56
  // [DataStore][google.cloud.discoveryengine.v1beta.DataStore].
@@ -587,6 +587,12 @@ message AnswerQueryRequest {
587
587
  // If this field is unrecognizable, an `INVALID_ARGUMENT` is returned.
588
588
  string order_by = 4;
589
589
 
590
+ // Specifies the search result mode. If unspecified, the
591
+ // search result mode defaults to `DOCUMENTS`.
592
+ // See [parse and chunk
593
+ // documents](https://cloud.google.com/generative-ai-app-builder/docs/parse-chunk-documents)
594
+ SearchRequest.ContentSearchSpec.SearchResultMode search_result_mode = 5;
595
+
590
596
  // Specs defining dataStores to filter on in a search call and
591
597
  // configurations for those dataStores. This is only considered for
592
598
  // engines with multiple dataStores use case. For single dataStore within
@@ -793,8 +799,10 @@ message AnswerQueryRequest {
793
799
  // method.
794
800
  message AnswerQueryResponse {
795
801
  // Answer resource object.
796
- // If [AnswerQueryRequest.StepSpec.max_step_count][] is greater than 1,
797
- // use [Answer.name][google.cloud.discoveryengine.v1beta.Answer.name] to fetch
802
+ // If
803
+ // [AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec.max_rephrase_steps][google.cloud.discoveryengine.v1beta.AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec.max_rephrase_steps]
804
+ // is greater than 1, use
805
+ // [Answer.name][google.cloud.discoveryengine.v1beta.Answer.name] to fetch
798
806
  // answer information using
799
807
  // [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1beta.ConversationalSearchService.GetAnswer]
800
808
  // API.
@@ -54,7 +54,7 @@ message Document {
54
54
 
55
55
  // The URI of the content. Only Cloud Storage URIs (e.g.
56
56
  // `gs://bucket-name/path/to/file`) are supported. The maximum file size
57
- // is 2.5 MB for text-based formats, 100 MB for other formats.
57
+ // is 2.5 MB for text-based formats, 200 MB for other formats.
58
58
  string uri = 3;
59
59
  }
60
60
 
@@ -41,6 +41,30 @@ message DocumentProcessingConfig {
41
41
  pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/documentProcessingConfig"
42
42
  };
43
43
 
44
+ // Configuration for chunking config.
45
+ message ChunkingConfig {
46
+ // Configuration for the layout based chunking.
47
+ message LayoutBasedChunkingConfig {
48
+ // The token size limit for each chunk.
49
+ //
50
+ // Supported values: 100-500 (inclusive).
51
+ // Default value: 500.
52
+ int32 chunk_size = 1;
53
+
54
+ // Whether to include appending different levels of headings to chunks
55
+ // from the middle of the document to prevent context loss.
56
+ //
57
+ // Default value: False.
58
+ bool include_ancestor_headings = 2;
59
+ }
60
+
61
+ // Additional configs that defines the behavior of the chunking.
62
+ oneof chunk_mode {
63
+ // Configuration for the layout based chunking.
64
+ LayoutBasedChunkingConfig layout_based_chunking_config = 1;
65
+ }
66
+ }
67
+
44
68
  // Related configurations applied to a specific type of document parser.
45
69
  message ParsingConfig {
46
70
  // The digital parsing configurations for documents.
@@ -57,6 +81,9 @@ message DocumentProcessingConfig {
57
81
  bool use_native_text = 2;
58
82
  }
59
83
 
84
+ // The layout parsing configurations for documents.
85
+ message LayoutParsingConfig {}
86
+
60
87
  // Configs for document processing types.
61
88
  oneof type_dedicated_config {
62
89
  // Configurations applied to digital parser.
@@ -65,6 +92,9 @@ message DocumentProcessingConfig {
65
92
  // Configurations applied to OCR parser. Currently it only applies to
66
93
  // PDFs.
67
94
  OcrParsingConfig ocr_parsing_config = 2;
95
+
96
+ // Configurations applied to layout parser.
97
+ LayoutParsingConfig layout_parsing_config = 3;
68
98
  }
69
99
  }
70
100
 
@@ -73,6 +103,9 @@ message DocumentProcessingConfig {
73
103
  // `projects/*/locations/*/collections/*/dataStores/*/documentProcessingConfig`.
74
104
  string name = 1;
75
105
 
106
+ // Whether chunking mode is enabled.
107
+ ChunkingConfig chunking_config = 3;
108
+
76
109
  // Configurations for default Document parser.
77
110
  // If not specified, we will configure it as default DigitalParsingConfig, and
78
111
  // the default parsing config will be applied to all file types for Document
@@ -85,8 +118,10 @@ message DocumentProcessingConfig {
85
118
  // * `pdf`: Override parsing config for PDF files, either digital parsing, ocr
86
119
  // parsing or layout parsing is supported.
87
120
  // * `html`: Override parsing config for HTML files, only digital parsing and
88
- // or layout parsing are supported.
121
+ // layout parsing are supported.
89
122
  // * `docx`: Override parsing config for DOCX files, only digital parsing and
90
- // or layout parsing are supported.
123
+ // layout parsing are supported.
124
+ // * `pptx`: Override parsing config for PPTX files, only digital parsing and
125
+ // layout parsing are supported.
91
126
  map<string, ParsingConfig> parsing_config_overrides = 5;
92
127
  }
@@ -0,0 +1,231 @@
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.v1beta;
18
+
19
+ import "google/api/field_behavior.proto";
20
+ import "google/api/resource.proto";
21
+ import "google/cloud/discoveryengine/v1beta/search_service.proto";
22
+ import "google/protobuf/timestamp.proto";
23
+ import "google/rpc/status.proto";
24
+
25
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
26
+ option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb";
27
+ option java_multiple_files = true;
28
+ option java_outer_classname = "EvaluationProto";
29
+ option java_package = "com.google.cloud.discoveryengine.v1beta";
30
+ option objc_class_prefix = "DISCOVERYENGINE";
31
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
32
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
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.v1beta.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.v1beta.SearchRequest.serving_config]
66
+ // * [SearchRequest.branch][google.cloud.discoveryengine.v1beta.SearchRequest.branch]
67
+ // * [SearchRequest.canonical_filter][google.cloud.discoveryengine.v1beta.SearchRequest.canonical_filter]
68
+ // * [SearchRequest.query_expansion_spec][google.cloud.discoveryengine.v1beta.SearchRequest.query_expansion_spec]
69
+ // * [SearchRequest.spell_correction_spec][google.cloud.discoveryengine.v1beta.SearchRequest.spell_correction_spec]
70
+ // * [SearchRequest.content_search_spec][google.cloud.discoveryengine.v1beta.SearchRequest.content_search_spec]
71
+ // * [SearchRequest.user_pseudo_id][google.cloud.discoveryengine.v1beta.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.v1beta.Evaluation], in the format
99
+ // of `projects/{project}/locations/{location}/evaluations/{evaluation}`.
100
+ //
101
+ // This field must be a UTF-8 encoded string with a length limit of 1024
102
+ // characters.
103
+ string name = 1 [(google.api.field_behavior) = IDENTIFIER];
104
+
105
+ // Required. The specification of the evaluation.
106
+ EvaluationSpec evaluation_spec = 2 [(google.api.field_behavior) = REQUIRED];
107
+
108
+ // Output only. The metrics produced by the evaluation, averaged across all
109
+ // [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]s in the
110
+ // [SampleQuerySet][google.cloud.discoveryengine.v1beta.SampleQuerySet].
111
+ //
112
+ // Only populated when the evaluation's state is SUCCEEDED.
113
+ QualityMetrics quality_metrics = 3
114
+ [(google.api.field_behavior) = OUTPUT_ONLY];
115
+
116
+ // Output only. The state of the evaluation.
117
+ State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
118
+
119
+ // Output only. The error that occurred during evaluation. Only populated when
120
+ // the evaluation's state is FAILED.
121
+ google.rpc.Status error = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
122
+
123
+ // Output only. Timestamp the
124
+ // [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation] was created
125
+ // at.
126
+ google.protobuf.Timestamp create_time = 6
127
+ [(google.api.field_behavior) = OUTPUT_ONLY];
128
+
129
+ // Output only. Timestamp the
130
+ // [Evaluation][google.cloud.discoveryengine.v1beta.Evaluation] was completed
131
+ // at.
132
+ google.protobuf.Timestamp end_time = 7
133
+ [(google.api.field_behavior) = OUTPUT_ONLY];
134
+
135
+ // Output only. A sample of errors encountered while processing the request.
136
+ repeated google.rpc.Status error_samples = 8
137
+ [(google.api.field_behavior) = OUTPUT_ONLY];
138
+ }
139
+
140
+ // Describes the metrics produced by the evaluation.
141
+ message QualityMetrics {
142
+ // Stores the metric values at specific top-k levels.
143
+ message TopkMetrics {
144
+ // The top-1 value.
145
+ double top_1 = 1;
146
+
147
+ // The top-3 value.
148
+ double top_3 = 2;
149
+
150
+ // The top-5 value.
151
+ double top_5 = 3;
152
+
153
+ // The top-10 value.
154
+ double top_10 = 4;
155
+ }
156
+
157
+ // Recall per document, at various top-k cutoff levels.
158
+ //
159
+ // Recall is the fraction of relevant documents retrieved out of all
160
+ // relevant documents.
161
+ //
162
+ // Example (top-5):
163
+ // * For a single
164
+ // [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery], If 3 out
165
+ // of 5 relevant documents are retrieved in the top-5, recall@5 = 3/5 = 0.6
166
+ TopkMetrics doc_recall = 1;
167
+
168
+ // Precision per document, at various top-k cutoff levels.
169
+ //
170
+ // Precision is the fraction of retrieved documents that are relevant.
171
+ //
172
+ // Example (top-5):
173
+ // * For a single
174
+ // [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery], If 4 out
175
+ // of 5 retrieved documents in the top-5 are relevant, precision@5 = 4/5 =
176
+ // 0.8
177
+ TopkMetrics doc_precision = 2;
178
+
179
+ // Normalized discounted cumulative gain (NDCG) per document, at various top-k
180
+ // cutoff levels.
181
+ //
182
+ // NDCG measures the ranking quality, giving higher relevance to top
183
+ // results.
184
+ //
185
+ // Example (top-3):
186
+ // Suppose [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]
187
+ // with three retrieved documents (D1, D2, D3) and binary relevance
188
+ // judgements (1 for relevant, 0 for not relevant):
189
+ //
190
+ // Retrieved: [D3 (0), D1 (1), D2 (1)]
191
+ // Ideal: [D1 (1), D2 (1), D3 (0)]
192
+ //
193
+ // Calculate NDCG@3 for each
194
+ // [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]:
195
+ // * DCG@3: 0/log2(1+1) + 1/log2(2+1) + 1/log2(3+1) = 1.13
196
+ // * Ideal DCG@3: 1/log2(1+1) + 1/log2(2+1) + 0/log2(3+1) = 1.63
197
+ // * NDCG@3: 1.13/1.63 = 0.693
198
+ TopkMetrics doc_ndcg = 3;
199
+
200
+ // Recall per page, at various top-k cutoff levels.
201
+ //
202
+ // Recall is the fraction of relevant pages retrieved out of all relevant
203
+ // pages.
204
+ //
205
+ // Example (top-5):
206
+ // * For a single
207
+ // [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery], if 3 out
208
+ // of 5 relevant pages are retrieved in the top-5, recall@5 = 3/5 = 0.6
209
+ TopkMetrics page_recall = 4;
210
+
211
+ // Normalized discounted cumulative gain (NDCG) per page, at various top-k
212
+ // cutoff levels.
213
+ //
214
+ // NDCG measures the ranking quality, giving higher relevance to top
215
+ // results.
216
+ //
217
+ // Example (top-3):
218
+ // Suppose [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]
219
+ // with three retrieved pages (P1, P2, P3) and binary relevance judgements (1
220
+ // for relevant, 0 for not relevant):
221
+ //
222
+ // Retrieved: [P3 (0), P1 (1), P2 (1)]
223
+ // Ideal: [P1 (1), P2 (1), P3 (0)]
224
+ //
225
+ // Calculate NDCG@3 for
226
+ // [SampleQuery][google.cloud.discoveryengine.v1beta.SampleQuery]:
227
+ // * DCG@3: 0/log2(1+1) + 1/log2(2+1) + 1/log2(3+1) = 1.13
228
+ // * Ideal DCG@3: 1/log2(1+1) + 1/log2(2+1) + 0/log2(3+1) = 1.63
229
+ // * NDCG@3: 1.13/1.63 = 0.693
230
+ TopkMetrics page_ndcg = 5;
231
+ }