@google-cloud/discoveryengine 2.0.0 → 2.1.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 (149) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +7 -2
  3. package/build/protos/google/cloud/discoveryengine/v1/answer.proto +54 -2
  4. package/build/protos/google/cloud/discoveryengine/v1/chunk.proto +2 -1
  5. package/build/protos/google/cloud/discoveryengine/v1/common.proto +35 -6
  6. package/build/protos/google/cloud/discoveryengine/v1/control.proto +113 -2
  7. package/build/protos/google/cloud/discoveryengine/v1/conversational_search_service.proto +168 -2
  8. package/build/protos/google/cloud/discoveryengine/v1/data_store.proto +23 -4
  9. package/build/protos/google/cloud/discoveryengine/v1/document.proto +7 -2
  10. package/build/protos/google/cloud/discoveryengine/v1/document_service.proto +1 -1
  11. package/build/protos/google/cloud/discoveryengine/v1/engine.proto +16 -3
  12. package/build/protos/google/cloud/discoveryengine/v1/grounded_generation_service.proto +70 -9
  13. package/build/protos/google/cloud/discoveryengine/v1/import_config.proto +20 -1
  14. package/build/protos/google/cloud/discoveryengine/v1/purge_config.proto +9 -5
  15. package/build/protos/google/cloud/discoveryengine/v1/rank_service.proto +3 -1
  16. package/build/protos/google/cloud/discoveryengine/v1/recommendation_service.proto +2 -2
  17. package/build/protos/google/cloud/discoveryengine/v1/safety.proto +107 -0
  18. package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +96 -8
  19. package/build/protos/google/cloud/discoveryengine/v1/serving_config.proto +271 -0
  20. package/build/protos/google/cloud/discoveryengine/v1/serving_config_service.proto +75 -0
  21. package/build/protos/google/cloud/discoveryengine/v1/session.proto +19 -0
  22. package/build/protos/google/cloud/discoveryengine/v1/site_search_engine.proto +27 -3
  23. package/build/protos/google/cloud/discoveryengine/v1/site_search_engine_service.proto +184 -5
  24. package/build/protos/google/cloud/discoveryengine/v1/user_event.proto +34 -0
  25. package/build/protos/google/cloud/discoveryengine/v1/user_event_service.proto +16 -4
  26. package/build/protos/protos.d.ts +5356 -981
  27. package/build/protos/protos.js +32266 -20956
  28. package/build/protos/protos.json +1391 -74
  29. package/build/src/index.d.ts +4 -1
  30. package/build/src/index.js +4 -1
  31. package/build/src/v1/completion_service_client.d.ts +238 -1
  32. package/build/src/v1/completion_service_client.js +341 -5
  33. package/build/src/v1/completion_service_proto_list.json +3 -0
  34. package/build/src/v1/control_service_client.d.ts +237 -0
  35. package/build/src/v1/control_service_client.js +347 -7
  36. package/build/src/v1/control_service_proto_list.json +3 -0
  37. package/build/src/v1/conversational_search_service_client.d.ts +213 -6
  38. package/build/src/v1/conversational_search_service_client.js +316 -22
  39. package/build/src/v1/conversational_search_service_client_config.json +5 -0
  40. package/build/src/v1/conversational_search_service_proto_list.json +3 -0
  41. package/build/src/v1/data_store_service_client.d.ts +238 -1
  42. package/build/src/v1/data_store_service_client.js +347 -7
  43. package/build/src/v1/data_store_service_proto_list.json +3 -0
  44. package/build/src/v1/document_service_client.d.ts +245 -2
  45. package/build/src/v1/document_service_client.js +356 -10
  46. package/build/src/v1/document_service_proto_list.json +3 -0
  47. package/build/src/v1/engine_service_client.d.ts +238 -1
  48. package/build/src/v1/engine_service_client.js +347 -7
  49. package/build/src/v1/engine_service_proto_list.json +3 -0
  50. package/build/src/v1/gapic_metadata.json +59 -0
  51. package/build/src/v1/grounded_generation_service_client.d.ts +238 -3
  52. package/build/src/v1/grounded_generation_service_client.js +335 -3
  53. package/build/src/v1/grounded_generation_service_proto_list.json +3 -0
  54. package/build/src/v1/index.d.ts +1 -0
  55. package/build/src/v1/index.js +3 -1
  56. package/build/src/v1/project_service_client.d.ts +238 -1
  57. package/build/src/v1/project_service_client.js +329 -1
  58. package/build/src/v1/project_service_proto_list.json +3 -0
  59. package/build/src/v1/rank_service_client.d.ts +238 -1
  60. package/build/src/v1/rank_service_client.js +329 -1
  61. package/build/src/v1/rank_service_proto_list.json +3 -0
  62. package/build/src/v1/recommendation_service_client.d.ts +95 -2
  63. package/build/src/v1/recommendation_service_client.js +131 -1
  64. package/build/src/v1/recommendation_service_proto_list.json +3 -0
  65. package/build/src/v1/schema_service_client.d.ts +238 -1
  66. package/build/src/v1/schema_service_client.js +347 -7
  67. package/build/src/v1/schema_service_proto_list.json +3 -0
  68. package/build/src/v1/search_service_client.d.ts +219 -30
  69. package/build/src/v1/search_service_client.js +230 -26
  70. package/build/src/v1/search_service_proto_list.json +3 -0
  71. package/build/src/v1/search_tuning_service_client.d.ts +238 -1
  72. package/build/src/v1/search_tuning_service_client.js +332 -2
  73. package/build/src/v1/search_tuning_service_proto_list.json +3 -0
  74. package/build/src/v1/serving_config_service_client.d.ts +1851 -0
  75. package/build/src/v1/serving_config_service_client.js +2653 -0
  76. package/build/src/v1/serving_config_service_client_config.json +30 -0
  77. package/build/src/v1/serving_config_service_proto_list.json +39 -0
  78. package/build/src/v1/site_search_engine_service_client.d.ts +357 -4
  79. package/build/src/v1/site_search_engine_service_client.js +521 -16
  80. package/build/src/v1/site_search_engine_service_client_config.json +12 -0
  81. package/build/src/v1/site_search_engine_service_proto_list.json +3 -0
  82. package/build/src/v1/user_event_service_client.d.ts +259 -10
  83. package/build/src/v1/user_event_service_client.js +338 -4
  84. package/build/src/v1/user_event_service_proto_list.json +3 -0
  85. package/build/src/v1alpha/acl_config_service_client.js +6 -2
  86. package/build/src/v1alpha/chunk_service_client.js +12 -4
  87. package/build/src/v1alpha/completion_service_client.d.ts +1 -1
  88. package/build/src/v1alpha/completion_service_client.js +15 -5
  89. package/build/src/v1alpha/control_service_client.js +21 -7
  90. package/build/src/v1alpha/conversational_search_service_client.js +51 -17
  91. package/build/src/v1alpha/data_store_service_client.d.ts +1 -1
  92. package/build/src/v1alpha/data_store_service_client.js +27 -9
  93. package/build/src/v1alpha/document_service_client.d.ts +1 -1
  94. package/build/src/v1alpha/document_service_client.js +33 -11
  95. package/build/src/v1alpha/engine_service_client.d.ts +1 -1
  96. package/build/src/v1alpha/engine_service_client.js +30 -10
  97. package/build/src/v1alpha/estimate_billing_service_client.d.ts +1 -1
  98. package/build/src/v1alpha/estimate_billing_service_client.js +3 -1
  99. package/build/src/v1alpha/evaluation_service_client.d.ts +1 -1
  100. package/build/src/v1alpha/evaluation_service_client.js +24 -8
  101. package/build/src/v1alpha/grounded_generation_service_client.js +3 -1
  102. package/build/src/v1alpha/project_service_client.d.ts +1 -1
  103. package/build/src/v1alpha/project_service_client.js +9 -3
  104. package/build/src/v1alpha/rank_service_client.js +3 -1
  105. package/build/src/v1alpha/recommendation_service_client.js +3 -1
  106. package/build/src/v1alpha/sample_query_service_client.d.ts +1 -1
  107. package/build/src/v1alpha/sample_query_service_client.js +24 -8
  108. package/build/src/v1alpha/sample_query_set_service_client.js +21 -7
  109. package/build/src/v1alpha/schema_service_client.d.ts +1 -1
  110. package/build/src/v1alpha/schema_service_client.js +21 -7
  111. package/build/src/v1alpha/search_service_client.js +9 -3
  112. package/build/src/v1alpha/search_tuning_service_client.d.ts +1 -1
  113. package/build/src/v1alpha/search_tuning_service_client.js +6 -2
  114. package/build/src/v1alpha/serving_config_service_client.js +15 -5
  115. package/build/src/v1alpha/site_search_engine_service_client.d.ts +1 -1
  116. package/build/src/v1alpha/site_search_engine_service_client.js +54 -18
  117. package/build/src/v1alpha/user_event_service_client.d.ts +1 -1
  118. package/build/src/v1alpha/user_event_service_client.js +12 -4
  119. package/build/src/v1beta/completion_service_client.d.ts +1 -1
  120. package/build/src/v1beta/completion_service_client.js +18 -6
  121. package/build/src/v1beta/control_service_client.js +21 -7
  122. package/build/src/v1beta/conversational_search_service_client.js +51 -17
  123. package/build/src/v1beta/data_store_service_client.d.ts +1 -1
  124. package/build/src/v1beta/data_store_service_client.js +21 -7
  125. package/build/src/v1beta/document_service_client.d.ts +1 -1
  126. package/build/src/v1beta/document_service_client.js +30 -10
  127. package/build/src/v1beta/engine_service_client.d.ts +1 -1
  128. package/build/src/v1beta/engine_service_client.js +30 -10
  129. package/build/src/v1beta/evaluation_service_client.d.ts +1 -1
  130. package/build/src/v1beta/evaluation_service_client.js +24 -8
  131. package/build/src/v1beta/grounded_generation_service_client.js +9 -3
  132. package/build/src/v1beta/project_service_client.d.ts +1 -1
  133. package/build/src/v1beta/project_service_client.js +3 -1
  134. package/build/src/v1beta/rank_service_client.js +3 -1
  135. package/build/src/v1beta/recommendation_service_client.js +3 -1
  136. package/build/src/v1beta/sample_query_service_client.d.ts +1 -1
  137. package/build/src/v1beta/sample_query_service_client.js +24 -8
  138. package/build/src/v1beta/sample_query_set_service_client.js +21 -7
  139. package/build/src/v1beta/schema_service_client.d.ts +1 -1
  140. package/build/src/v1beta/schema_service_client.js +21 -7
  141. package/build/src/v1beta/search_service_client.js +18 -6
  142. package/build/src/v1beta/search_tuning_service_client.d.ts +1 -1
  143. package/build/src/v1beta/search_tuning_service_client.js +6 -2
  144. package/build/src/v1beta/serving_config_service_client.js +15 -5
  145. package/build/src/v1beta/site_search_engine_service_client.d.ts +1 -1
  146. package/build/src/v1beta/site_search_engine_service_client.js +57 -19
  147. package/build/src/v1beta/user_event_service_client.d.ts +1 -1
  148. package/build/src/v1beta/user_event_service_client.js +12 -4
  149. package/package.json +5 -5
@@ -18,6 +18,7 @@
18
18
  // ** All changes to this file may be overwritten. **
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.ConversationalSearchServiceClient = void 0;
21
+ const stream_1 = require("stream");
21
22
  const jsonProtos = require("../../protos/protos.json");
22
23
  const google_gax_1 = require("google-gax");
23
24
  /**
@@ -183,6 +184,7 @@ class ConversationalSearchServiceClient {
183
184
  projectLocationCollectionDataStoreSessionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}'),
184
185
  projectLocationCollectionDataStoreSessionAnswerPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}/answers/{answer}'),
185
186
  projectLocationCollectionDataStoreSiteSearchEnginePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine'),
187
+ projectLocationCollectionDataStoreSiteSearchEngineSitemapPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine/sitemaps/{sitemap}'),
186
188
  projectLocationCollectionDataStoreSiteSearchEngineTargetSitePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}'),
187
189
  projectLocationCollectionEngineControlPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/controls/{control}'),
188
190
  projectLocationCollectionEngineConversationPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/conversations/{conversation}'),
@@ -201,6 +203,7 @@ class ConversationalSearchServiceClient {
201
203
  projectLocationDataStoreSessionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}'),
202
204
  projectLocationDataStoreSessionAnswerPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}'),
203
205
  projectLocationDataStoreSiteSearchEnginePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine'),
206
+ projectLocationDataStoreSiteSearchEngineSitemapPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine/sitemaps/{sitemap}'),
204
207
  projectLocationDataStoreSiteSearchEngineTargetSitePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/siteSearchEngine/targetSites/{target_site}'),
205
208
  };
206
209
  // Some of the methods on this service return "paged" results,
@@ -210,6 +213,11 @@ class ConversationalSearchServiceClient {
210
213
  listConversations: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'conversations'),
211
214
  listSessions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessions'),
212
215
  };
216
+ // Some of the methods on this service provide streaming responses.
217
+ // Provide descriptors for these.
218
+ this.descriptors.stream = {
219
+ streamAnswerQuery: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries),
220
+ };
213
221
  // Put together the default options sent with requests.
214
222
  this._defaults = this._gaxGrpc.constructSettings('google.cloud.discoveryengine.v1.ConversationalSearchService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
215
223
  // Set up a dictionary of "inner API calls"; the core implementation
@@ -252,6 +260,7 @@ class ConversationalSearchServiceClient {
252
260
  'getConversation',
253
261
  'listConversations',
254
262
  'answerQuery',
263
+ 'streamAnswerQuery',
255
264
  'getAnswer',
256
265
  'createSession',
257
266
  'deleteSession',
@@ -262,6 +271,13 @@ class ConversationalSearchServiceClient {
262
271
  for (const methodName of conversationalSearchServiceStubMethods) {
263
272
  const callPromise = this.conversationalSearchServiceStub.then(stub => (...args) => {
264
273
  if (this._terminated) {
274
+ if (methodName in this.descriptors.stream) {
275
+ const stream = new stream_1.PassThrough({ objectMode: true });
276
+ setImmediate(() => {
277
+ stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.'));
278
+ });
279
+ return stream;
280
+ }
265
281
  return Promise.reject('The client has already been closed.');
266
282
  }
267
283
  const func = stub[methodName];
@@ -269,7 +285,9 @@ class ConversationalSearchServiceClient {
269
285
  }, (err) => () => {
270
286
  throw err;
271
287
  });
272
- const descriptor = this.descriptors.page[methodName] || undefined;
288
+ const descriptor = this.descriptors.page[methodName] ||
289
+ this.descriptors.stream[methodName] ||
290
+ undefined;
273
291
  const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
274
292
  this.innerApiCalls[methodName] = apiCall;
275
293
  }
@@ -352,7 +370,9 @@ class ConversationalSearchServiceClient {
352
370
  this._gaxModule.routingHeader.fromParams({
353
371
  name: request.name ?? '',
354
372
  });
355
- this.initialize();
373
+ this.initialize().catch(err => {
374
+ throw err;
375
+ });
356
376
  this._log.info('converseConversation request %j', request);
357
377
  const wrappedCallback = callback
358
378
  ? (error, response, options, rawResponse) => {
@@ -384,7 +404,9 @@ class ConversationalSearchServiceClient {
384
404
  this._gaxModule.routingHeader.fromParams({
385
405
  parent: request.parent ?? '',
386
406
  });
387
- this.initialize();
407
+ this.initialize().catch(err => {
408
+ throw err;
409
+ });
388
410
  this._log.info('createConversation request %j', request);
389
411
  const wrappedCallback = callback
390
412
  ? (error, response, options, rawResponse) => {
@@ -416,7 +438,9 @@ class ConversationalSearchServiceClient {
416
438
  this._gaxModule.routingHeader.fromParams({
417
439
  name: request.name ?? '',
418
440
  });
419
- this.initialize();
441
+ this.initialize().catch(err => {
442
+ throw err;
443
+ });
420
444
  this._log.info('deleteConversation request %j', request);
421
445
  const wrappedCallback = callback
422
446
  ? (error, response, options, rawResponse) => {
@@ -448,7 +472,9 @@ class ConversationalSearchServiceClient {
448
472
  this._gaxModule.routingHeader.fromParams({
449
473
  'conversation.name': request.conversation.name ?? '',
450
474
  });
451
- this.initialize();
475
+ this.initialize().catch(err => {
476
+ throw err;
477
+ });
452
478
  this._log.info('updateConversation request %j', request);
453
479
  const wrappedCallback = callback
454
480
  ? (error, response, options, rawResponse) => {
@@ -480,7 +506,9 @@ class ConversationalSearchServiceClient {
480
506
  this._gaxModule.routingHeader.fromParams({
481
507
  name: request.name ?? '',
482
508
  });
483
- this.initialize();
509
+ this.initialize().catch(err => {
510
+ throw err;
511
+ });
484
512
  this._log.info('getConversation request %j', request);
485
513
  const wrappedCallback = callback
486
514
  ? (error, response, options, rawResponse) => {
@@ -512,7 +540,9 @@ class ConversationalSearchServiceClient {
512
540
  this._gaxModule.routingHeader.fromParams({
513
541
  serving_config: request.servingConfig ?? '',
514
542
  });
515
- this.initialize();
543
+ this.initialize().catch(err => {
544
+ throw err;
545
+ });
516
546
  this._log.info('answerQuery request %j', request);
517
547
  const wrappedCallback = callback
518
548
  ? (error, response, options, rawResponse) => {
@@ -544,7 +574,9 @@ class ConversationalSearchServiceClient {
544
574
  this._gaxModule.routingHeader.fromParams({
545
575
  name: request.name ?? '',
546
576
  });
547
- this.initialize();
577
+ this.initialize().catch(err => {
578
+ throw err;
579
+ });
548
580
  this._log.info('getAnswer request %j', request);
549
581
  const wrappedCallback = callback
550
582
  ? (error, response, options, rawResponse) => {
@@ -576,7 +608,9 @@ class ConversationalSearchServiceClient {
576
608
  this._gaxModule.routingHeader.fromParams({
577
609
  parent: request.parent ?? '',
578
610
  });
579
- this.initialize();
611
+ this.initialize().catch(err => {
612
+ throw err;
613
+ });
580
614
  this._log.info('createSession request %j', request);
581
615
  const wrappedCallback = callback
582
616
  ? (error, response, options, rawResponse) => {
@@ -608,7 +642,9 @@ class ConversationalSearchServiceClient {
608
642
  this._gaxModule.routingHeader.fromParams({
609
643
  name: request.name ?? '',
610
644
  });
611
- this.initialize();
645
+ this.initialize().catch(err => {
646
+ throw err;
647
+ });
612
648
  this._log.info('deleteSession request %j', request);
613
649
  const wrappedCallback = callback
614
650
  ? (error, response, options, rawResponse) => {
@@ -640,7 +676,9 @@ class ConversationalSearchServiceClient {
640
676
  this._gaxModule.routingHeader.fromParams({
641
677
  'session.name': request.session.name ?? '',
642
678
  });
643
- this.initialize();
679
+ this.initialize().catch(err => {
680
+ throw err;
681
+ });
644
682
  this._log.info('updateSession request %j', request);
645
683
  const wrappedCallback = callback
646
684
  ? (error, response, options, rawResponse) => {
@@ -672,7 +710,9 @@ class ConversationalSearchServiceClient {
672
710
  this._gaxModule.routingHeader.fromParams({
673
711
  name: request.name ?? '',
674
712
  });
675
- this.initialize();
713
+ this.initialize().catch(err => {
714
+ throw err;
715
+ });
676
716
  this._log.info('getSession request %j', request);
677
717
  const wrappedCallback = callback
678
718
  ? (error, response, options, rawResponse) => {
@@ -687,6 +727,112 @@ class ConversationalSearchServiceClient {
687
727
  return [response, options, rawResponse];
688
728
  });
689
729
  }
730
+ /**
731
+ * Answer query method (streaming).
732
+ *
733
+ * It takes one
734
+ * {@link protos.google.cloud.discoveryengine.v1.AnswerQueryRequest|AnswerQueryRequest}
735
+ * and returns multiple
736
+ * {@link protos.google.cloud.discoveryengine.v1.AnswerQueryResponse|AnswerQueryResponse}
737
+ * messages in a stream.
738
+ *
739
+ * @param {Object} request
740
+ * The request object that will be sent.
741
+ * @param {string} request.servingConfig
742
+ * Required. The resource name of the Search serving config, such as
743
+ * `projects/* /locations/global/collections/default_collection/engines/* /servingConfigs/default_serving_config`,
744
+ * or
745
+ * `projects/* /locations/global/collections/default_collection/dataStores/* /servingConfigs/default_serving_config`.
746
+ * This field is used to identify the serving configuration name, set
747
+ * of models used to make the search.
748
+ * @param {google.cloud.discoveryengine.v1.Query} request.query
749
+ * Required. Current user query.
750
+ * @param {string} request.session
751
+ * The session resource name. Not required.
752
+ *
753
+ * When session field is not set, the API is in sessionless mode.
754
+ *
755
+ * We support auto session mode: users can use the wildcard symbol `-` as
756
+ * session ID. A new ID will be automatically generated and assigned.
757
+ * @param {google.cloud.discoveryengine.v1.AnswerQueryRequest.SafetySpec} request.safetySpec
758
+ * Model specification.
759
+ * @param {google.cloud.discoveryengine.v1.AnswerQueryRequest.RelatedQuestionsSpec} request.relatedQuestionsSpec
760
+ * Related questions specification.
761
+ * @param {google.cloud.discoveryengine.v1.AnswerQueryRequest.GroundingSpec} [request.groundingSpec]
762
+ * Optional. Grounding specification.
763
+ * @param {google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec} request.answerGenerationSpec
764
+ * Answer generation specification.
765
+ * @param {google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec} request.searchSpec
766
+ * Search specification.
767
+ * @param {google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec} request.queryUnderstandingSpec
768
+ * Query understanding specification.
769
+ * @param {boolean} request.asynchronousMode
770
+ * Deprecated: This field is deprecated. Streaming Answer API will be
771
+ * supported.
772
+ *
773
+ * Asynchronous mode control.
774
+ *
775
+ * If enabled, the response will be returned with answer/session resource
776
+ * name without final answer. The API users need to do the polling to get
777
+ * the latest status of answer/session by calling
778
+ * {@link protos.google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer|ConversationalSearchService.GetAnswer}
779
+ * or
780
+ * {@link protos.google.cloud.discoveryengine.v1.ConversationalSearchService.GetSession|ConversationalSearchService.GetSession}
781
+ * method.
782
+ * @param {string} request.userPseudoId
783
+ * A unique identifier for tracking visitors. For example, this could be
784
+ * implemented with an HTTP cookie, which should be able to uniquely identify
785
+ * a visitor on a single device. This unique identifier should not change if
786
+ * the visitor logs in or out of the website.
787
+ *
788
+ * This field should NOT have a fixed value such as `unknown_visitor`.
789
+ *
790
+ * The field must be a UTF-8 encoded string with a length limit of 128
791
+ * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
792
+ * @param {number[]} request.userLabels
793
+ * The user labels applied to a resource must meet the following requirements:
794
+ *
795
+ * * Each resource can have multiple labels, up to a maximum of 64.
796
+ * * Each label must be a key-value pair.
797
+ * * Keys have a minimum length of 1 character and a maximum length of 63
798
+ * characters and cannot be empty. Values can be empty and have a maximum
799
+ * length of 63 characters.
800
+ * * Keys and values can contain only lowercase letters, numeric characters,
801
+ * underscores, and dashes. All characters must use UTF-8 encoding, and
802
+ * international characters are allowed.
803
+ * * The key portion of a label must be unique. However, you can use the same
804
+ * key with multiple resources.
805
+ * * Keys must start with a lowercase letter or international character.
806
+ *
807
+ * See [Google Cloud
808
+ * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
809
+ * for more details.
810
+ * @param {google.cloud.discoveryengine.v1.AnswerQueryRequest.EndUserSpec} [request.endUserSpec]
811
+ * Optional. End user specification.
812
+ * @param {object} [options]
813
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
814
+ * @returns {Stream}
815
+ * An object stream which emits {@link protos.google.cloud.discoveryengine.v1.AnswerQueryResponse|AnswerQueryResponse} on 'data' event.
816
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation }
817
+ * for more details and examples.
818
+ * @example <caption>include:samples/generated/v1/conversational_search_service.stream_answer_query.js</caption>
819
+ * region_tag:discoveryengine_v1_generated_ConversationalSearchService_StreamAnswerQuery_async
820
+ */
821
+ streamAnswerQuery(request, options) {
822
+ request = request || {};
823
+ options = options || {};
824
+ options.otherArgs = options.otherArgs || {};
825
+ options.otherArgs.headers = options.otherArgs.headers || {};
826
+ options.otherArgs.headers['x-goog-request-params'] =
827
+ this._gaxModule.routingHeader.fromParams({
828
+ serving_config: request.servingConfig ?? '',
829
+ });
830
+ this.initialize().catch(err => {
831
+ throw err;
832
+ });
833
+ this._log.info('streamAnswerQuery stream %j', options);
834
+ return this.innerApiCalls.streamAnswerQuery(request, options);
835
+ }
690
836
  listConversations(request, optionsOrCallback, callback) {
691
837
  request = request || {};
692
838
  let options;
@@ -704,7 +850,9 @@ class ConversationalSearchServiceClient {
704
850
  this._gaxModule.routingHeader.fromParams({
705
851
  parent: request.parent ?? '',
706
852
  });
707
- this.initialize();
853
+ this.initialize().catch(err => {
854
+ throw err;
855
+ });
708
856
  const wrappedCallback = callback
709
857
  ? (error, values, nextPageRequest, rawResponse) => {
710
858
  this._log.info('listConversations values %j', values);
@@ -771,7 +919,9 @@ class ConversationalSearchServiceClient {
771
919
  });
772
920
  const defaultCallSettings = this._defaults['listConversations'];
773
921
  const callSettings = defaultCallSettings.merge(options);
774
- this.initialize();
922
+ this.initialize().catch(err => {
923
+ throw err;
924
+ });
775
925
  this._log.info('listConversations stream %j', request);
776
926
  return this.descriptors.page.listConversations.createStream(this.innerApiCalls.listConversations, request, callSettings);
777
927
  }
@@ -830,7 +980,9 @@ class ConversationalSearchServiceClient {
830
980
  });
831
981
  const defaultCallSettings = this._defaults['listConversations'];
832
982
  const callSettings = defaultCallSettings.merge(options);
833
- this.initialize();
983
+ this.initialize().catch(err => {
984
+ throw err;
985
+ });
834
986
  this._log.info('listConversations iterate %j', request);
835
987
  return this.descriptors.page.listConversations.asyncIterate(this.innerApiCalls['listConversations'], request, callSettings);
836
988
  }
@@ -851,7 +1003,9 @@ class ConversationalSearchServiceClient {
851
1003
  this._gaxModule.routingHeader.fromParams({
852
1004
  parent: request.parent ?? '',
853
1005
  });
854
- this.initialize();
1006
+ this.initialize().catch(err => {
1007
+ throw err;
1008
+ });
855
1009
  const wrappedCallback = callback
856
1010
  ? (error, values, nextPageRequest, rawResponse) => {
857
1011
  this._log.info('listSessions values %j', values);
@@ -889,13 +1043,18 @@ class ConversationalSearchServiceClient {
889
1043
  * A comma-separated list of fields to order by, sorted in ascending order.
890
1044
  * Use "desc" after a field name for descending.
891
1045
  * Supported fields:
1046
+ *
892
1047
  * * `update_time`
893
1048
  * * `create_time`
894
1049
  * * `session_name`
1050
+ * * `is_pinned`
895
1051
  *
896
1052
  * Example:
897
- * "update_time desc"
898
- * "create_time"
1053
+ *
1054
+ * * "update_time desc"
1055
+ * * "create_time"
1056
+ * * "is_pinned desc,update_time desc": list sessions by is_pinned first, then
1057
+ * by update_time.
899
1058
  * @param {object} [options]
900
1059
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
901
1060
  * @returns {Stream}
@@ -918,7 +1077,9 @@ class ConversationalSearchServiceClient {
918
1077
  });
919
1078
  const defaultCallSettings = this._defaults['listSessions'];
920
1079
  const callSettings = defaultCallSettings.merge(options);
921
- this.initialize();
1080
+ this.initialize().catch(err => {
1081
+ throw err;
1082
+ });
922
1083
  this._log.info('listSessions stream %j', request);
923
1084
  return this.descriptors.page.listSessions.createStream(this.innerApiCalls.listSessions, request, callSettings);
924
1085
  }
@@ -947,13 +1108,18 @@ class ConversationalSearchServiceClient {
947
1108
  * A comma-separated list of fields to order by, sorted in ascending order.
948
1109
  * Use "desc" after a field name for descending.
949
1110
  * Supported fields:
1111
+ *
950
1112
  * * `update_time`
951
1113
  * * `create_time`
952
1114
  * * `session_name`
1115
+ * * `is_pinned`
953
1116
  *
954
1117
  * Example:
955
- * "update_time desc"
956
- * "create_time"
1118
+ *
1119
+ * * "update_time desc"
1120
+ * * "create_time"
1121
+ * * "is_pinned desc,update_time desc": list sessions by is_pinned first, then
1122
+ * by update_time.
957
1123
  * @param {object} [options]
958
1124
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
959
1125
  * @returns {Object}
@@ -977,7 +1143,9 @@ class ConversationalSearchServiceClient {
977
1143
  });
978
1144
  const defaultCallSettings = this._defaults['listSessions'];
979
1145
  const callSettings = defaultCallSettings.merge(options);
980
- this.initialize();
1146
+ this.initialize().catch(err => {
1147
+ throw err;
1148
+ });
981
1149
  this._log.info('listSessions iterate %j', request);
982
1150
  return this.descriptors.page.listSessions.asyncIterate(this.innerApiCalls['listSessions'], request, callSettings);
983
1151
  }
@@ -1957,6 +2125,75 @@ class ConversationalSearchServiceClient {
1957
2125
  matchDataStoreFromProjectLocationCollectionDataStoreSiteSearchEngineName(projectLocationCollectionDataStoreSiteSearchEngineName) {
1958
2126
  return this.pathTemplates.projectLocationCollectionDataStoreSiteSearchEnginePathTemplate.match(projectLocationCollectionDataStoreSiteSearchEngineName).data_store;
1959
2127
  }
2128
+ /**
2129
+ * Return a fully-qualified projectLocationCollectionDataStoreSiteSearchEngineSitemap resource name string.
2130
+ *
2131
+ * @param {string} project
2132
+ * @param {string} location
2133
+ * @param {string} collection
2134
+ * @param {string} data_store
2135
+ * @param {string} sitemap
2136
+ * @returns {string} Resource name string.
2137
+ */
2138
+ projectLocationCollectionDataStoreSiteSearchEngineSitemapPath(project, location, collection, dataStore, sitemap) {
2139
+ return this.pathTemplates.projectLocationCollectionDataStoreSiteSearchEngineSitemapPathTemplate.render({
2140
+ project: project,
2141
+ location: location,
2142
+ collection: collection,
2143
+ data_store: dataStore,
2144
+ sitemap: sitemap,
2145
+ });
2146
+ }
2147
+ /**
2148
+ * Parse the project from ProjectLocationCollectionDataStoreSiteSearchEngineSitemap resource.
2149
+ *
2150
+ * @param {string} projectLocationCollectionDataStoreSiteSearchEngineSitemapName
2151
+ * A fully-qualified path representing project_location_collection_data_store_siteSearchEngine_sitemap resource.
2152
+ * @returns {string} A string representing the project.
2153
+ */
2154
+ matchProjectFromProjectLocationCollectionDataStoreSiteSearchEngineSitemapName(projectLocationCollectionDataStoreSiteSearchEngineSitemapName) {
2155
+ return this.pathTemplates.projectLocationCollectionDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationCollectionDataStoreSiteSearchEngineSitemapName).project;
2156
+ }
2157
+ /**
2158
+ * Parse the location from ProjectLocationCollectionDataStoreSiteSearchEngineSitemap resource.
2159
+ *
2160
+ * @param {string} projectLocationCollectionDataStoreSiteSearchEngineSitemapName
2161
+ * A fully-qualified path representing project_location_collection_data_store_siteSearchEngine_sitemap resource.
2162
+ * @returns {string} A string representing the location.
2163
+ */
2164
+ matchLocationFromProjectLocationCollectionDataStoreSiteSearchEngineSitemapName(projectLocationCollectionDataStoreSiteSearchEngineSitemapName) {
2165
+ return this.pathTemplates.projectLocationCollectionDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationCollectionDataStoreSiteSearchEngineSitemapName).location;
2166
+ }
2167
+ /**
2168
+ * Parse the collection from ProjectLocationCollectionDataStoreSiteSearchEngineSitemap resource.
2169
+ *
2170
+ * @param {string} projectLocationCollectionDataStoreSiteSearchEngineSitemapName
2171
+ * A fully-qualified path representing project_location_collection_data_store_siteSearchEngine_sitemap resource.
2172
+ * @returns {string} A string representing the collection.
2173
+ */
2174
+ matchCollectionFromProjectLocationCollectionDataStoreSiteSearchEngineSitemapName(projectLocationCollectionDataStoreSiteSearchEngineSitemapName) {
2175
+ return this.pathTemplates.projectLocationCollectionDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationCollectionDataStoreSiteSearchEngineSitemapName).collection;
2176
+ }
2177
+ /**
2178
+ * Parse the data_store from ProjectLocationCollectionDataStoreSiteSearchEngineSitemap resource.
2179
+ *
2180
+ * @param {string} projectLocationCollectionDataStoreSiteSearchEngineSitemapName
2181
+ * A fully-qualified path representing project_location_collection_data_store_siteSearchEngine_sitemap resource.
2182
+ * @returns {string} A string representing the data_store.
2183
+ */
2184
+ matchDataStoreFromProjectLocationCollectionDataStoreSiteSearchEngineSitemapName(projectLocationCollectionDataStoreSiteSearchEngineSitemapName) {
2185
+ return this.pathTemplates.projectLocationCollectionDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationCollectionDataStoreSiteSearchEngineSitemapName).data_store;
2186
+ }
2187
+ /**
2188
+ * Parse the sitemap from ProjectLocationCollectionDataStoreSiteSearchEngineSitemap resource.
2189
+ *
2190
+ * @param {string} projectLocationCollectionDataStoreSiteSearchEngineSitemapName
2191
+ * A fully-qualified path representing project_location_collection_data_store_siteSearchEngine_sitemap resource.
2192
+ * @returns {string} A string representing the sitemap.
2193
+ */
2194
+ matchSitemapFromProjectLocationCollectionDataStoreSiteSearchEngineSitemapName(projectLocationCollectionDataStoreSiteSearchEngineSitemapName) {
2195
+ return this.pathTemplates.projectLocationCollectionDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationCollectionDataStoreSiteSearchEngineSitemapName).sitemap;
2196
+ }
1960
2197
  /**
1961
2198
  * Return a fully-qualified projectLocationCollectionDataStoreSiteSearchEngineTargetSite resource name string.
1962
2199
  *
@@ -3079,6 +3316,63 @@ class ConversationalSearchServiceClient {
3079
3316
  matchDataStoreFromProjectLocationDataStoreSiteSearchEngineName(projectLocationDataStoreSiteSearchEngineName) {
3080
3317
  return this.pathTemplates.projectLocationDataStoreSiteSearchEnginePathTemplate.match(projectLocationDataStoreSiteSearchEngineName).data_store;
3081
3318
  }
3319
+ /**
3320
+ * Return a fully-qualified projectLocationDataStoreSiteSearchEngineSitemap resource name string.
3321
+ *
3322
+ * @param {string} project
3323
+ * @param {string} location
3324
+ * @param {string} data_store
3325
+ * @param {string} sitemap
3326
+ * @returns {string} Resource name string.
3327
+ */
3328
+ projectLocationDataStoreSiteSearchEngineSitemapPath(project, location, dataStore, sitemap) {
3329
+ return this.pathTemplates.projectLocationDataStoreSiteSearchEngineSitemapPathTemplate.render({
3330
+ project: project,
3331
+ location: location,
3332
+ data_store: dataStore,
3333
+ sitemap: sitemap,
3334
+ });
3335
+ }
3336
+ /**
3337
+ * Parse the project from ProjectLocationDataStoreSiteSearchEngineSitemap resource.
3338
+ *
3339
+ * @param {string} projectLocationDataStoreSiteSearchEngineSitemapName
3340
+ * A fully-qualified path representing project_location_data_store_siteSearchEngine_sitemap resource.
3341
+ * @returns {string} A string representing the project.
3342
+ */
3343
+ matchProjectFromProjectLocationDataStoreSiteSearchEngineSitemapName(projectLocationDataStoreSiteSearchEngineSitemapName) {
3344
+ return this.pathTemplates.projectLocationDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationDataStoreSiteSearchEngineSitemapName).project;
3345
+ }
3346
+ /**
3347
+ * Parse the location from ProjectLocationDataStoreSiteSearchEngineSitemap resource.
3348
+ *
3349
+ * @param {string} projectLocationDataStoreSiteSearchEngineSitemapName
3350
+ * A fully-qualified path representing project_location_data_store_siteSearchEngine_sitemap resource.
3351
+ * @returns {string} A string representing the location.
3352
+ */
3353
+ matchLocationFromProjectLocationDataStoreSiteSearchEngineSitemapName(projectLocationDataStoreSiteSearchEngineSitemapName) {
3354
+ return this.pathTemplates.projectLocationDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationDataStoreSiteSearchEngineSitemapName).location;
3355
+ }
3356
+ /**
3357
+ * Parse the data_store from ProjectLocationDataStoreSiteSearchEngineSitemap resource.
3358
+ *
3359
+ * @param {string} projectLocationDataStoreSiteSearchEngineSitemapName
3360
+ * A fully-qualified path representing project_location_data_store_siteSearchEngine_sitemap resource.
3361
+ * @returns {string} A string representing the data_store.
3362
+ */
3363
+ matchDataStoreFromProjectLocationDataStoreSiteSearchEngineSitemapName(projectLocationDataStoreSiteSearchEngineSitemapName) {
3364
+ return this.pathTemplates.projectLocationDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationDataStoreSiteSearchEngineSitemapName).data_store;
3365
+ }
3366
+ /**
3367
+ * Parse the sitemap from ProjectLocationDataStoreSiteSearchEngineSitemap resource.
3368
+ *
3369
+ * @param {string} projectLocationDataStoreSiteSearchEngineSitemapName
3370
+ * A fully-qualified path representing project_location_data_store_siteSearchEngine_sitemap resource.
3371
+ * @returns {string} A string representing the sitemap.
3372
+ */
3373
+ matchSitemapFromProjectLocationDataStoreSiteSearchEngineSitemapName(projectLocationDataStoreSiteSearchEngineSitemapName) {
3374
+ return this.pathTemplates.projectLocationDataStoreSiteSearchEngineSitemapPathTemplate.match(projectLocationDataStoreSiteSearchEngineSitemapName).sitemap;
3375
+ }
3082
3376
  /**
3083
3377
  * Return a fully-qualified projectLocationDataStoreSiteSearchEngineTargetSite resource name string.
3084
3378
  *
@@ -67,6 +67,11 @@
67
67
  "retry_codes_name": "unavailable",
68
68
  "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f"
69
69
  },
70
+ "StreamAnswerQuery": {
71
+ "timeout_millis": 30000,
72
+ "retry_codes_name": "unavailable",
73
+ "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f"
74
+ },
70
75
  "GetAnswer": {
71
76
  "timeout_millis": 30000,
72
77
  "retry_codes_name": "unavailable",
@@ -24,10 +24,13 @@
24
24
  "../../protos/google/cloud/discoveryengine/v1/purge_config.proto",
25
25
  "../../protos/google/cloud/discoveryengine/v1/rank_service.proto",
26
26
  "../../protos/google/cloud/discoveryengine/v1/recommendation_service.proto",
27
+ "../../protos/google/cloud/discoveryengine/v1/safety.proto",
27
28
  "../../protos/google/cloud/discoveryengine/v1/schema.proto",
28
29
  "../../protos/google/cloud/discoveryengine/v1/schema_service.proto",
29
30
  "../../protos/google/cloud/discoveryengine/v1/search_service.proto",
30
31
  "../../protos/google/cloud/discoveryengine/v1/search_tuning_service.proto",
32
+ "../../protos/google/cloud/discoveryengine/v1/serving_config.proto",
33
+ "../../protos/google/cloud/discoveryengine/v1/serving_config_service.proto",
31
34
  "../../protos/google/cloud/discoveryengine/v1/session.proto",
32
35
  "../../protos/google/cloud/discoveryengine/v1/site_search_engine.proto",
33
36
  "../../protos/google/cloud/discoveryengine/v1/site_search_engine_service.proto",