@google-cloud/discoveryengine 1.6.0 → 1.7.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 (142) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +24 -0
  3. package/build/protos/google/cloud/discoveryengine/v1/common.proto +13 -1
  4. package/build/protos/google/cloud/discoveryengine/v1/conversational_search_service.proto +5 -0
  5. package/build/protos/google/cloud/discoveryengine/v1/data_store.proto +17 -0
  6. package/build/protos/google/cloud/discoveryengine/v1/document.proto +9 -0
  7. package/build/protos/google/cloud/discoveryengine/v1/document_service.proto +6 -0
  8. package/build/protos/google/cloud/discoveryengine/v1/engine.proto +2 -2
  9. package/build/protos/google/cloud/discoveryengine/v1/import_config.proto +284 -22
  10. package/build/protos/google/cloud/discoveryengine/v1/purge_config.proto +3 -0
  11. package/build/protos/google/cloud/discoveryengine/v1/recommendation_service.proto +228 -0
  12. package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +125 -21
  13. package/build/protos/google/cloud/discoveryengine/v1/user_event.proto +16 -11
  14. package/build/protos/google/cloud/discoveryengine/v1alpha/answer.proto +328 -0
  15. package/build/protos/google/cloud/discoveryengine/v1alpha/chunk.proto +41 -1
  16. package/build/protos/google/cloud/discoveryengine/v1alpha/common.proto +21 -1
  17. package/build/protos/google/cloud/discoveryengine/v1alpha/conversational_search_service.proto +574 -0
  18. package/build/protos/google/cloud/discoveryengine/v1alpha/document.proto +19 -0
  19. package/build/protos/google/cloud/discoveryengine/v1alpha/document_processing_config.proto +3 -6
  20. package/build/protos/google/cloud/discoveryengine/v1alpha/document_service.proto +64 -0
  21. package/build/protos/google/cloud/discoveryengine/v1alpha/engine.proto +2 -2
  22. package/build/protos/google/cloud/discoveryengine/v1alpha/grounded_generation_service.proto +120 -0
  23. package/build/protos/google/cloud/discoveryengine/v1alpha/grounding.proto +55 -0
  24. package/build/protos/google/cloud/discoveryengine/v1alpha/import_config.proto +283 -24
  25. package/build/protos/google/cloud/discoveryengine/v1alpha/project.proto +102 -0
  26. package/build/protos/google/cloud/discoveryengine/v1alpha/project_service.proto +171 -0
  27. package/build/protos/google/cloud/discoveryengine/v1alpha/schema.proto +21 -0
  28. package/build/protos/google/cloud/discoveryengine/v1alpha/search_service.proto +158 -24
  29. package/build/protos/google/cloud/discoveryengine/v1alpha/search_tuning_service.proto +9 -3
  30. package/build/protos/google/cloud/discoveryengine/v1alpha/serving_config_service.proto +2 -1
  31. package/build/protos/google/cloud/discoveryengine/v1alpha/session.proto +94 -0
  32. package/build/protos/google/cloud/discoveryengine/v1alpha/user_event.proto +1 -1
  33. package/build/protos/google/cloud/discoveryengine/v1beta/answer.proto +328 -0
  34. package/build/protos/google/cloud/discoveryengine/v1beta/common.proto +30 -1
  35. package/build/protos/google/cloud/discoveryengine/v1beta/conversational_search_service.proto +559 -0
  36. package/build/protos/google/cloud/discoveryengine/v1beta/document_processing_config.proto +3 -6
  37. package/build/protos/google/cloud/discoveryengine/v1beta/document_service.proto +6 -0
  38. package/build/protos/google/cloud/discoveryengine/v1beta/engine.proto +2 -2
  39. package/build/protos/google/cloud/discoveryengine/v1beta/engine_service.proto +93 -0
  40. package/build/protos/google/cloud/discoveryengine/v1beta/grounded_generation_service.proto +120 -0
  41. package/build/protos/google/cloud/discoveryengine/v1beta/grounding.proto +55 -0
  42. package/build/protos/google/cloud/discoveryengine/v1beta/import_config.proto +283 -24
  43. package/build/protos/google/cloud/discoveryengine/v1beta/rank_service.proto +115 -0
  44. package/build/protos/google/cloud/discoveryengine/v1beta/search_service.proto +142 -22
  45. package/build/protos/google/cloud/discoveryengine/v1beta/search_tuning_service.proto +7 -1
  46. package/build/protos/google/cloud/discoveryengine/v1beta/session.proto +94 -0
  47. package/build/protos/google/cloud/discoveryengine/v1beta/user_event.proto +1 -1
  48. package/build/protos/protos.d.ts +44799 -26093
  49. package/build/protos/protos.js +120465 -74222
  50. package/build/protos/protos.json +8911 -4556
  51. package/build/src/index.d.ts +4 -1
  52. package/build/src/index.js +4 -1
  53. package/build/src/v1/conversational_search_service_client.d.ts +4 -0
  54. package/build/src/v1/document_service_client.d.ts +47 -19
  55. package/build/src/v1/index.d.ts +1 -0
  56. package/build/src/v1/index.js +3 -1
  57. package/build/src/v1/recommendation_service_client.d.ts +1087 -0
  58. package/build/src/v1/recommendation_service_client.js +1432 -0
  59. package/build/src/v1/recommendation_service_client_config.json +43 -0
  60. package/build/src/v1/search_service_client.d.ts +27 -9
  61. package/build/src/v1/search_service_client.js +18 -6
  62. package/build/src/v1/search_service_client_config.json +5 -5
  63. package/build/src/v1alpha/acl_config_service_client.d.ts +330 -0
  64. package/build/src/v1alpha/acl_config_service_client.js +454 -0
  65. package/build/src/v1alpha/chunk_service_client.d.ts +330 -0
  66. package/build/src/v1alpha/chunk_service_client.js +454 -0
  67. package/build/src/v1alpha/completion_service_client.d.ts +330 -0
  68. package/build/src/v1alpha/completion_service_client.js +457 -0
  69. package/build/src/v1alpha/conversational_search_service_client.d.ts +674 -0
  70. package/build/src/v1alpha/conversational_search_service_client.js +724 -0
  71. package/build/src/v1alpha/conversational_search_service_client_config.json +35 -0
  72. package/build/src/v1alpha/data_store_service_client.d.ts +330 -0
  73. package/build/src/v1alpha/data_store_service_client.js +457 -0
  74. package/build/src/v1alpha/document_service_client.d.ts +410 -21
  75. package/build/src/v1alpha/document_service_client.js +479 -0
  76. package/build/src/v1alpha/document_service_client_config.json +5 -0
  77. package/build/src/v1alpha/engine_service_client.d.ts +330 -0
  78. package/build/src/v1alpha/engine_service_client.js +457 -0
  79. package/build/src/v1alpha/estimate_billing_service_client.d.ts +330 -0
  80. package/build/src/v1alpha/estimate_billing_service_client.js +457 -0
  81. package/build/src/v1alpha/grounded_generation_service_client.d.ts +1574 -0
  82. package/build/src/v1alpha/grounded_generation_service_client.js +2248 -0
  83. package/build/src/v1alpha/grounded_generation_service_client_config.json +43 -0
  84. package/build/src/v1alpha/index.d.ts +3 -1
  85. package/build/src/v1alpha/index.js +7 -3
  86. package/build/src/v1alpha/project_service_client.d.ts +1756 -0
  87. package/build/src/v1alpha/project_service_client.js +2500 -0
  88. package/build/src/v1alpha/project_service_client_config.json +38 -0
  89. package/build/src/v1alpha/rank_service_client.d.ts +330 -0
  90. package/build/src/v1alpha/rank_service_client.js +454 -0
  91. package/build/src/v1alpha/rank_service_client_config.json +15 -2
  92. package/build/src/v1alpha/recommendation_service_client.d.ts +330 -0
  93. package/build/src/v1alpha/recommendation_service_client.js +454 -0
  94. package/build/src/v1alpha/schema_service_client.d.ts +330 -0
  95. package/build/src/v1alpha/schema_service_client.js +457 -0
  96. package/build/src/v1alpha/search_service_client.d.ts +360 -15
  97. package/build/src/v1alpha/search_service_client.js +474 -10
  98. package/build/src/v1alpha/search_service_client_config.json +5 -5
  99. package/build/src/v1alpha/search_tuning_service_client.d.ts +330 -0
  100. package/build/src/v1alpha/search_tuning_service_client.js +457 -0
  101. package/build/src/v1alpha/serving_config_service_client.d.ts +317 -1
  102. package/build/src/v1alpha/serving_config_service_client.js +434 -1
  103. package/build/src/v1alpha/site_search_engine_service_client.d.ts +330 -0
  104. package/build/src/v1alpha/site_search_engine_service_client.js +457 -0
  105. package/build/src/v1alpha/user_event_service_client.d.ts +330 -0
  106. package/build/src/v1alpha/user_event_service_client.js +457 -0
  107. package/build/src/v1beta/completion_service_client.d.ts +315 -0
  108. package/build/src/v1beta/completion_service_client.js +432 -0
  109. package/build/src/v1beta/conversational_search_service_client.d.ts +659 -0
  110. package/build/src/v1beta/conversational_search_service_client.js +702 -0
  111. package/build/src/v1beta/conversational_search_service_client_config.json +35 -0
  112. package/build/src/v1beta/data_store_service_client.d.ts +315 -0
  113. package/build/src/v1beta/data_store_service_client.js +432 -0
  114. package/build/src/v1beta/document_service_client.d.ts +361 -21
  115. package/build/src/v1beta/document_service_client.js +432 -0
  116. package/build/src/v1beta/engine_service_client.d.ts +410 -0
  117. package/build/src/v1beta/engine_service_client.js +518 -0
  118. package/build/src/v1beta/engine_service_client_config.json +12 -0
  119. package/build/src/v1beta/grounded_generation_service_client.d.ts +1406 -0
  120. package/build/src/v1beta/grounded_generation_service_client.js +2014 -0
  121. package/build/src/v1beta/grounded_generation_service_client_config.json +43 -0
  122. package/build/src/v1beta/index.d.ts +2 -0
  123. package/build/src/v1beta/index.js +5 -1
  124. package/build/src/v1beta/rank_service_client.d.ts +1416 -0
  125. package/build/src/v1beta/rank_service_client.js +2015 -0
  126. package/build/src/v1beta/rank_service_client_config.json +43 -0
  127. package/build/src/v1beta/recommendation_service_client.d.ts +315 -0
  128. package/build/src/v1beta/recommendation_service_client.js +432 -0
  129. package/build/src/v1beta/schema_service_client.d.ts +315 -0
  130. package/build/src/v1beta/schema_service_client.js +432 -0
  131. package/build/src/v1beta/search_service_client.d.ts +342 -12
  132. package/build/src/v1beta/search_service_client.js +450 -8
  133. package/build/src/v1beta/search_service_client_config.json +5 -5
  134. package/build/src/v1beta/search_tuning_service_client.d.ts +315 -0
  135. package/build/src/v1beta/search_tuning_service_client.js +432 -0
  136. package/build/src/v1beta/serving_config_service_client.d.ts +315 -0
  137. package/build/src/v1beta/serving_config_service_client.js +432 -0
  138. package/build/src/v1beta/site_search_engine_service_client.d.ts +315 -0
  139. package/build/src/v1beta/site_search_engine_service_client.js +432 -0
  140. package/build/src/v1beta/user_event_service_client.d.ts +315 -0
  141. package/build/src/v1beta/user_event_service_client.js +432 -0
  142. package/package.json +1 -1
@@ -69,6 +69,19 @@ message SearchRequest {
69
69
  }
70
70
  }
71
71
 
72
+ // A struct to define data stores to filter on in a search call.
73
+ message DataStoreSpec {
74
+ // Required. Full resource name of
75
+ // [DataStore][google.cloud.discoveryengine.v1.DataStore], such as
76
+ // `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`.
77
+ string data_store = 1 [
78
+ (google.api.field_behavior) = REQUIRED,
79
+ (google.api.resource_reference) = {
80
+ type: "discoveryengine.googleapis.com/DataStore"
81
+ }
82
+ ];
83
+ }
84
+
72
85
  // A facet specification to perform faceted search.
73
86
  message FacetSpec {
74
87
  // Specifies how a facet is computed.
@@ -212,28 +225,29 @@ message SearchRequest {
212
225
  // Examples:
213
226
  //
214
227
  // * To boost documents with document ID "doc_1" or "doc_2", and
215
- // color
216
- // "Red" or "Blue":
217
- // * (id: ANY("doc_1", "doc_2")) AND (color: ANY("Red","Blue"))
228
+ // color "Red" or "Blue":
229
+ // `(document_id: ANY("doc_1", "doc_2")) AND (color: ANY("Red", "Blue"))`
218
230
  string condition = 1;
219
231
 
220
232
  // Strength of the condition boost, which should be in [-1, 1]. Negative
221
233
  // boost means demotion. Default is 0.0.
222
234
  //
223
- // Setting to 1.0 gives the document a big promotion. However, it does not
224
- // necessarily mean that the boosted document will be the top result at
225
- // all times, nor that other documents will be excluded. Results could
226
- // still be shown even when none of them matches the condition. And
227
- // results that are significantly more relevant to the search query can
228
- // still trump your heavily favored but irrelevant documents.
235
+ // Setting to 1.0 gives the document a big promotion. However, it does
236
+ // not necessarily mean that the boosted document will be the top result
237
+ // at all times, nor that other documents will be excluded. Results
238
+ // could still be shown even when none of them matches the condition.
239
+ // And results that are significantly more relevant to the search query
240
+ // can still trump your heavily favored but irrelevant documents.
229
241
  //
230
242
  // Setting to -1.0 gives the document a big demotion. However, results
231
243
  // that are deeply relevant might still be shown. The document will have
232
- // an upstream battle to get a fairly high ranking, but it is not blocked
233
- // out completely.
244
+ // an upstream battle to get a fairly high ranking, but it is not
245
+ // blocked out completely.
234
246
  //
235
247
  // Setting to 0.0 means no boost applied. The boosting condition is
236
- // ignored.
248
+ // ignored. Only one of the (condition, boost) combination or the
249
+ // boost_control_spec below are set. If both are set then the global boost
250
+ // is ignored and the more fine-grained boost_control_spec is applied.
237
251
  float boost = 2;
238
252
  }
239
253
 
@@ -335,11 +349,13 @@ message SearchRequest {
335
349
  // Supported values are:
336
350
  //
337
351
  // * `stable`: string. Default value when no value is specified. Uses a
338
- // generally available, fine-tuned version of the text-bison@001
339
- // model.
340
- // * `preview`: string. (Public preview) Uses a fine-tuned version of
341
- // the text-bison@002 model. This model works only for summaries in
342
- // English.
352
+ // generally available, fine-tuned model. For more information, see
353
+ // [Answer generation model versions and
354
+ // lifecycle](https://cloud.google.com/generative-ai-app-builder/docs/answer-generation-models).
355
+ // * `preview`: string. (Public preview) Uses a preview model. For more
356
+ // information, see
357
+ // [Answer generation model versions and
358
+ // lifecycle](https://cloud.google.com/generative-ai-app-builder/docs/answer-generation-models).
343
359
  string version = 1;
344
360
  }
345
361
 
@@ -347,7 +363,10 @@ message SearchRequest {
347
363
  // of results returned is less than `summaryResultCount`, the summary is
348
364
  // generated from all of the results.
349
365
  //
350
- // At most five results can be used to generate a summary.
366
+ // At most 10 results for documents mode, or 50 for chunks mode, can be
367
+ // used to generate a summary. The chunks mode is used when
368
+ // [SearchRequest.ContentSearchSpec.search_result_mode][] is set to
369
+ // [CHUNKS][SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS].
351
370
  int32 summary_result_count = 1;
352
371
 
353
372
  // Specifies whether to include citations in the summary. The default
@@ -406,6 +425,68 @@ message SearchRequest {
406
425
  // If specified, the spec will be used to modify the model specification
407
426
  // provided to the LLM.
408
427
  ModelSpec model_spec = 7;
428
+
429
+ // If true, answer will be generated from most relevant chunks from top
430
+ // search results. This feature will improve summary quality.
431
+ // Note that with this feature enabled, not all top search results
432
+ // will be referenced and included in the reference list, so the citation
433
+ // source index only points to the search results listed in the reference
434
+ // list.
435
+ bool use_semantic_chunks = 8;
436
+ }
437
+
438
+ // A specification for configuring the extractive content in a search
439
+ // response.
440
+ message ExtractiveContentSpec {
441
+ // The maximum number of extractive answers returned in each search
442
+ // result.
443
+ //
444
+ // An extractive answer is a verbatim answer extracted from the original
445
+ // document, which provides a precise and contextually relevant answer to
446
+ // the search query.
447
+ //
448
+ // If the number of matching answers is less than the
449
+ // `max_extractive_answer_count`, return all of the answers. Otherwise,
450
+ // return the `max_extractive_answer_count`.
451
+ //
452
+ // At most five answers are returned for each
453
+ // [SearchResult][google.cloud.discoveryengine.v1.SearchResponse.SearchResult].
454
+ int32 max_extractive_answer_count = 1;
455
+
456
+ // The max number of extractive segments returned in each search result.
457
+ // Only applied if the
458
+ // [DataStore][google.cloud.discoveryengine.v1.DataStore] is set to
459
+ // [DataStore.ContentConfig.CONTENT_REQUIRED][google.cloud.discoveryengine.v1.DataStore.ContentConfig.CONTENT_REQUIRED]
460
+ // or
461
+ // [DataStore.solution_types][google.cloud.discoveryengine.v1.DataStore.solution_types]
462
+ // is
463
+ // [SOLUTION_TYPE_CHAT][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_CHAT].
464
+ //
465
+ // An extractive segment is a text segment extracted from the original
466
+ // document that is relevant to the search query, and, in general, more
467
+ // verbose than an extractive answer. The segment could then be used as
468
+ // input for LLMs to generate summaries and answers.
469
+ //
470
+ // If the number of matching segments is less than
471
+ // `max_extractive_segment_count`, return all of the segments. Otherwise,
472
+ // return the `max_extractive_segment_count`.
473
+ int32 max_extractive_segment_count = 2;
474
+
475
+ // Specifies whether to return the confidence score from the extractive
476
+ // segments in each search result. This feature is available only for new
477
+ // or allowlisted data stores. To allowlist your data store,
478
+ // contact your Customer Engineer. The default value is `false`.
479
+ bool return_extractive_segment_score = 3;
480
+
481
+ // Specifies whether to also include the adjacent from each selected
482
+ // segments.
483
+ // Return at most `num_previous_segments` segments before each selected
484
+ // segments.
485
+ int32 num_previous_segments = 4;
486
+
487
+ // Return at most `num_next_segments` segments after each selected
488
+ // segments.
489
+ int32 num_next_segments = 5;
409
490
  }
410
491
 
411
492
  // If `snippetSpec` is not specified, snippets are not included in the
@@ -415,6 +496,10 @@ message SearchRequest {
415
496
  // If `summarySpec` is not specified, summaries are not included in the
416
497
  // search response.
417
498
  SummarySpec summary_spec = 2;
499
+
500
+ // If there is no extractive_content_spec provided, there will be no
501
+ // extractive answer in the search response.
502
+ ExtractiveContentSpec extractive_content_spec = 3;
418
503
  }
419
504
 
420
505
  // Required. The resource name of the Search serving config, such as
@@ -446,10 +531,14 @@ message SearchRequest {
446
531
  ImageQuery image_query = 19;
447
532
 
448
533
  // Maximum number of [Document][google.cloud.discoveryengine.v1.Document]s to
449
- // return. If unspecified, defaults to a reasonable value. The maximum allowed
450
- // value is 100. Values above 100 are coerced to 100.
534
+ // return. The maximum allowed value depends on the data type. Values above
535
+ // the maximum value are coerced to the maximum value.
451
536
  //
452
- // If this field is negative, an `INVALID_ARGUMENT` is returned.
537
+ // * Websites with basic indexing: Default `10`, Maximum `25`.
538
+ // * Websites with advanced indexing: Default `25`, Maximum `50`.
539
+ // * Other: Default `50`, Maximum `100`.
540
+ //
541
+ // If this field is negative, an `INVALID_ARGUMENT` is returned.
453
542
  int32 page_size = 4;
454
543
 
455
544
  // A page token received from a previous
@@ -472,6 +561,9 @@ message SearchRequest {
472
561
  // If this field is negative, an `INVALID_ARGUMENT` is returned.
473
562
  int32 offset = 6;
474
563
 
564
+ // A list of data store specs to apply on a search call.
565
+ repeated DataStoreSpec data_store_specs = 32;
566
+
475
567
  // The filter syntax consists of an expression language for constructing a
476
568
  // predicate from one or more fields of the documents being filtered. Filter
477
569
  // expression is case-sensitive.
@@ -685,6 +777,15 @@ message SearchResponse {
685
777
 
686
778
  // Document reference.
687
779
  message Reference {
780
+ // Chunk content.
781
+ message ChunkContent {
782
+ // Chunk textual content.
783
+ string content = 1;
784
+
785
+ // Page identifier.
786
+ string page_identifier = 2;
787
+ }
788
+
688
789
  // Title of the document.
689
790
  string title = 1;
690
791
 
@@ -701,6 +802,9 @@ message SearchResponse {
701
802
 
702
803
  // Cloud Storage or HTTP uri for the document.
703
804
  string uri = 3;
805
+
806
+ // List of cited chunk contents derived from document content.
807
+ repeated ChunkContent chunk_contents = 4;
704
808
  }
705
809
 
706
810
  // Summary with metadata information.
@@ -114,22 +114,26 @@ message UserEvent {
114
114
  // Token to attribute an API response to user action(s) to trigger the event.
115
115
  //
116
116
  // Highly recommended for user events that are the result of
117
- // [RecommendationService.Recommend][]. This field enables accurate
118
- // attribution of recommendation model performance.
117
+ // [RecommendationService.Recommend][google.cloud.discoveryengine.v1.RecommendationService.Recommend].
118
+ // This field enables accurate attribution of recommendation model
119
+ // performance.
119
120
  //
120
121
  // The value must be one of:
121
122
  //
122
- // * [RecommendResponse.attribution_token][] for events that are the result of
123
- // [RecommendationService.Recommend][].
123
+ // * [RecommendResponse.attribution_token][google.cloud.discoveryengine.v1.RecommendResponse.attribution_token] for events that are the result of
124
+ // [RecommendationService.Recommend][google.cloud.discoveryengine.v1.RecommendationService.Recommend].
124
125
  // * [SearchResponse.attribution_token][google.cloud.discoveryengine.v1.SearchResponse.attribution_token] for events that are the result of
125
126
  // [SearchService.Search][google.cloud.discoveryengine.v1.SearchService.Search].
126
127
  //
127
128
  // This token enables us to accurately attribute page view or conversion
128
129
  // completion back to the event and the particular predict response containing
129
130
  // this clicked/purchased product. If user clicks on product K in the
130
- // recommendation results, pass [RecommendResponse.attribution_token][] as a
131
- // URL parameter to product K's page. When recording events on product K's
132
- // page, log the [RecommendResponse.attribution_token][] to this field.
131
+ // recommendation results, pass
132
+ // [RecommendResponse.attribution_token][google.cloud.discoveryengine.v1.RecommendResponse.attribution_token]
133
+ // as a URL parameter to product K's page. When recording events on product
134
+ // K's page, log the
135
+ // [RecommendResponse.attribution_token][google.cloud.discoveryengine.v1.RecommendResponse.attribution_token]
136
+ // to this field.
133
137
  string attribution_token = 8;
134
138
 
135
139
  // The filter syntax consists of an expression language for constructing a
@@ -142,9 +146,10 @@ message UserEvent {
142
146
  // conforming to https://google.aip.dev/160#filtering.
143
147
  //
144
148
  // Similarly, for `view-item-list` events that are generated from a
145
- // [RecommendRequest][], this field may be populated directly from
146
- // [RecommendRequest.filter][] conforming to
147
- // https://google.aip.dev/160#filtering.
149
+ // [RecommendRequest][google.cloud.discoveryengine.v1.RecommendRequest], this
150
+ // field may be populated directly from
151
+ // [RecommendRequest.filter][google.cloud.discoveryengine.v1.RecommendRequest.filter]
152
+ // conforming to https://google.aip.dev/160#filtering.
148
153
  //
149
154
  // The value must be a UTF-8 encoded string with a length limit of 1,000
150
155
  // characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
@@ -247,7 +252,7 @@ message PageInfo {
247
252
  // The most specific category associated with a category page.
248
253
  //
249
254
  // To represent full path of category, use '>' sign to separate different
250
- // hierarchies. If '>' is part of the category name, please replace it with
255
+ // hierarchies. If '>' is part of the category name, replace it with
251
256
  // other character(s).
252
257
  //
253
258
  // Category pages include special pages such as sales or promotions. For
@@ -0,0 +1,328 @@
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/field_behavior.proto";
20
+ import "google/api/resource.proto";
21
+ import "google/protobuf/timestamp.proto";
22
+
23
+ option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Alpha";
24
+ option go_package = "cloud.google.com/go/discoveryengine/apiv1alpha/discoveryenginepb;discoveryenginepb";
25
+ option java_multiple_files = true;
26
+ option java_outer_classname = "AnswerProto";
27
+ option java_package = "com.google.cloud.discoveryengine.v1alpha";
28
+ option objc_class_prefix = "DISCOVERYENGINE";
29
+ option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1alpha";
30
+ option ruby_package = "Google::Cloud::DiscoveryEngine::V1alpha";
31
+
32
+ // Defines an answer.
33
+ message Answer {
34
+ option (google.api.resource) = {
35
+ type: "discoveryengine.googleapis.com/Answer"
36
+ pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}"
37
+ pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}/answers/{answer}"
38
+ pattern: "projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/answers/{answer}"
39
+ };
40
+
41
+ // Citation info for a segment.
42
+ message Citation {
43
+ // Index indicates the start of the segment, measured in bytes (UTF-8
44
+ // unicode).
45
+ int64 start_index = 1;
46
+
47
+ // End of the attributed segment, exclusive.
48
+ int64 end_index = 2;
49
+
50
+ // Citation sources for the attributed segment.
51
+ repeated CitationSource sources = 3;
52
+ }
53
+
54
+ // Citation source.
55
+ message CitationSource {
56
+ // ID of the citation source.
57
+ string reference_id = 1;
58
+ }
59
+
60
+ // Reference.
61
+ message Reference {
62
+ // Unstructured document information.
63
+ message UnstructuredDocumentInfo {
64
+ // Chunk content.
65
+ message ChunkContent {
66
+ // Chunk textual content.
67
+ string content = 1;
68
+
69
+ // Page identifier.
70
+ string page_identifier = 2;
71
+ }
72
+
73
+ // Document resource name.
74
+ string document = 1 [(google.api.resource_reference) = {
75
+ type: "discoveryengine.googleapis.com/Document"
76
+ }];
77
+
78
+ // URI for the document.
79
+ string uri = 2;
80
+
81
+ // Title.
82
+ string title = 3;
83
+
84
+ // List of cited chunk contents derived from document content.
85
+ repeated ChunkContent chunk_contents = 4;
86
+ }
87
+
88
+ // Chunk information.
89
+ message ChunkInfo {
90
+ // Document metadata.
91
+ message DocumentMetadata {
92
+ // Document resource name.
93
+ string document = 1 [(google.api.resource_reference) = {
94
+ type: "discoveryengine.googleapis.com/Document"
95
+ }];
96
+
97
+ // URI for the document.
98
+ string uri = 2;
99
+
100
+ // Title.
101
+ string title = 3;
102
+
103
+ // Page identifier.
104
+ string page_identifier = 4;
105
+ }
106
+
107
+ // Chunk resource name.
108
+ string chunk = 1 [(google.api.resource_reference) = {
109
+ type: "discoveryengine.googleapis.com/Chunk"
110
+ }];
111
+
112
+ // Chunk textual content.
113
+ string content = 2;
114
+
115
+ // Relevance score.
116
+ optional float relevance_score = 3;
117
+
118
+ // Document metadata.
119
+ DocumentMetadata document_metadata = 4;
120
+ }
121
+
122
+ // Search result content.
123
+ oneof content {
124
+ // Unstructured document information.
125
+ UnstructuredDocumentInfo unstructured_document_info = 1;
126
+
127
+ // Chunk information.
128
+ ChunkInfo chunk_info = 2;
129
+ }
130
+ }
131
+
132
+ // Step information.
133
+ message Step {
134
+ // Action.
135
+ message Action {
136
+ // Search action.
137
+ message SearchAction {
138
+ // The query to search.
139
+ string query = 1;
140
+ }
141
+
142
+ // Observation.
143
+ message Observation {
144
+ message SearchResult {
145
+ // Snippet information.
146
+ message SnippetInfo {
147
+ // Snippet content.
148
+ string snippet = 1;
149
+
150
+ // Status of the snippet defined by the search team.
151
+ string snippet_status = 2;
152
+ }
153
+
154
+ // Chunk information.
155
+ message ChunkInfo {
156
+ // Chunk resource name.
157
+ string chunk = 1;
158
+
159
+ // Chunk textual content.
160
+ string content = 2;
161
+
162
+ // Relevance score.
163
+ optional float relevance_score = 3;
164
+ }
165
+
166
+ // Document resource name.
167
+ string document = 1;
168
+
169
+ // URI for the document.
170
+ string uri = 2;
171
+
172
+ // Title.
173
+ string title = 3;
174
+
175
+ // If citation_type is DOCUMENT_LEVEL_CITATION, populate document
176
+ // level snippets.
177
+ repeated SnippetInfo snippet_info = 4;
178
+
179
+ // If citation_type is CHUNK_LEVEL_CITATION and chunk mode is on,
180
+ // populate chunk info.
181
+ repeated ChunkInfo chunk_info = 5;
182
+ }
183
+
184
+ // Search results observed by the search action, it can be snippets info
185
+ // or chunk info, depending on the citation type set by the user.
186
+ repeated SearchResult search_results = 2;
187
+ }
188
+
189
+ // The action.
190
+ oneof action {
191
+ // Search action.
192
+ SearchAction search_action = 2;
193
+ }
194
+
195
+ // Observation.
196
+ Observation observation = 3;
197
+ }
198
+
199
+ // Enumeration of the state of the step.
200
+ enum State {
201
+ // Unknown.
202
+ STATE_UNSPECIFIED = 0;
203
+
204
+ // Step is currently in progress.
205
+ IN_PROGRESS = 1;
206
+
207
+ // Step currently failed.
208
+ FAILED = 2;
209
+
210
+ // Step has succeeded.
211
+ SUCCEEDED = 3;
212
+ }
213
+
214
+ // The state of the step.
215
+ State state = 1;
216
+
217
+ // The description of the step.
218
+ string description = 2;
219
+
220
+ // The thought of the step.
221
+ string thought = 3;
222
+
223
+ // Actions.
224
+ repeated Action actions = 4;
225
+ }
226
+
227
+ // Query understanding information.
228
+ message QueryUnderstandingInfo {
229
+ // Query classification information.
230
+ message QueryClassificationInfo {
231
+ // Query classification types.
232
+ enum Type {
233
+ // Unspecified query classification type.
234
+ TYPE_UNSPECIFIED = 0;
235
+
236
+ // Adversarial query classification type.
237
+ ADVERSARIAL_QUERY = 1;
238
+
239
+ // Non-answer-seeking query classification type.
240
+ NON_ANSWER_SEEKING_QUERY = 2;
241
+ }
242
+
243
+ // Query classification type.
244
+ Type type = 1;
245
+
246
+ // Classification output.
247
+ bool positive = 2;
248
+ }
249
+
250
+ // Query classification information.
251
+ repeated QueryClassificationInfo query_classification_info = 1;
252
+ }
253
+
254
+ // Enumeration of the state of the answer generation.
255
+ enum State {
256
+ // Unknown.
257
+ STATE_UNSPECIFIED = 0;
258
+
259
+ // Answer generation is currently in progress.
260
+ IN_PROGRESS = 1;
261
+
262
+ // Answer generation currently failed.
263
+ FAILED = 2;
264
+
265
+ // Answer generation has succeeded.
266
+ SUCCEEDED = 3;
267
+ }
268
+
269
+ // An enum for answer skipped reasons.
270
+ enum AnswerSkippedReason {
271
+ // Default value. The answer skipped reason is not specified.
272
+ ANSWER_SKIPPED_REASON_UNSPECIFIED = 0;
273
+
274
+ // The adversarial query ignored case.
275
+ ADVERSARIAL_QUERY_IGNORED = 1;
276
+
277
+ // The non-answer seeking query ignored case.
278
+ NON_ANSWER_SEEKING_QUERY_IGNORED = 2;
279
+
280
+ // The out-of-domain query ignored case.
281
+ //
282
+ // Google skips the answer if there are no high-relevance search results.
283
+ OUT_OF_DOMAIN_QUERY_IGNORED = 3;
284
+
285
+ // The potential policy violation case.
286
+ //
287
+ // Google skips the answer if there is a potential policy violation
288
+ // detected. This includes content that may be violent or toxic.
289
+ POTENTIAL_POLICY_VIOLATION = 4;
290
+ }
291
+
292
+ // Immutable. Fully qualified name
293
+ // `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*`
294
+ string name = 1 [(google.api.field_behavior) = IMMUTABLE];
295
+
296
+ // The state of the answer generation.
297
+ State state = 2;
298
+
299
+ // The textual answer.
300
+ string answer_text = 3;
301
+
302
+ // Citations.
303
+ repeated Citation citations = 4;
304
+
305
+ // References.
306
+ repeated Reference references = 5;
307
+
308
+ // Suggested related questions.
309
+ repeated string related_questions = 6;
310
+
311
+ // Answer generation steps.
312
+ repeated Step steps = 7;
313
+
314
+ // Query understanding information.
315
+ QueryUnderstandingInfo query_understanding_info = 10;
316
+
317
+ // Additional answer-skipped reasons. This provides the reason for ignored
318
+ // cases. If nothing is skipped, this field is not set.
319
+ repeated AnswerSkippedReason answer_skipped_reasons = 11;
320
+
321
+ // Output only. Answer creation timestamp.
322
+ google.protobuf.Timestamp create_time = 8
323
+ [(google.api.field_behavior) = OUTPUT_ONLY];
324
+
325
+ // Output only. Answer completed timestamp.
326
+ google.protobuf.Timestamp complete_time = 9
327
+ [(google.api.field_behavior) = OUTPUT_ONLY];
328
+ }
@@ -46,6 +46,40 @@ message Chunk {
46
46
 
47
47
  // Title of the document.
48
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.v1alpha.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.v1alpha.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.v1alpha.SearchRequest.ContentSearchSpec.ChunkSpec.num_previous_chunks].
72
+ // This field is only populated on
73
+ // [SearchService.Search][google.cloud.discoveryengine.v1alpha.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.v1alpha.SearchRequest.ContentSearchSpec.ChunkSpec.num_next_chunks].
79
+ // This field is only populated on
80
+ // [SearchService.Search][google.cloud.discoveryengine.v1alpha.SearchService.Search]
81
+ // API.
82
+ repeated Chunk next_chunks = 2;
49
83
  }
50
84
 
51
85
  // The full resource name of the chunk.
@@ -56,7 +90,7 @@ message Chunk {
56
90
  // characters.
57
91
  string name = 1;
58
92
 
59
- // Unique chunk id of the current chunk.
93
+ // Unique chunk ID of the current chunk.
60
94
  string id = 2;
61
95
 
62
96
  // Content is a string from a document (parsed content).
@@ -69,4 +103,10 @@ message Chunk {
69
103
  // It contains derived data that are not in the original input document.
70
104
  google.protobuf.Struct derived_struct_data = 4
71
105
  [(google.api.field_behavior) = OUTPUT_ONLY];
106
+
107
+ // Page span of the chunk.
108
+ PageSpan page_span = 6;
109
+
110
+ // Output only. Metadata of the current chunk.
111
+ ChunkMetadata chunk_metadata = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
72
112
  }