google-cloud-discovery_engine-v1beta 0.15.0 → 0.17.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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +186 -6
  4. data/lib/google/cloud/discovery_engine/v1beta/completion_service/operations.rb +12 -15
  5. data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +62 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +179 -6
  7. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/operations.rb +43 -38
  8. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +131 -31
  9. data/lib/google/cloud/discovery_engine/v1beta/control_service/client.rb +35 -12
  10. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/client.rb +35 -12
  11. data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/service_stub.rb +54 -32
  12. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +48 -27
  13. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +48 -27
  14. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +118 -80
  15. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/client.rb +31 -6
  16. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/operations.rb +12 -15
  17. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/client.rb +31 -6
  18. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/operations.rb +43 -38
  19. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/service_stub.rb +54 -32
  20. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +31 -9
  21. data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +12 -15
  22. data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +25 -0
  23. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +31 -9
  24. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +43 -38
  25. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +78 -50
  26. data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +35 -12
  27. data/lib/google/cloud/discovery_engine/v1beta/engine_service/operations.rb +12 -15
  28. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +35 -12
  29. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/operations.rb +43 -38
  30. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/service_stub.rb +78 -50
  31. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/client.rb +31 -5
  32. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/operations.rb +12 -15
  33. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/client.rb +31 -5
  34. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/operations.rb +43 -38
  35. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/service_stub.rb +46 -26
  36. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +244 -6
  37. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/paths.rb +85 -0
  38. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +152 -6
  39. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub.rb +83 -7
  40. data/lib/google/cloud/discovery_engine/v1beta/project_service/client.rb +29 -2
  41. data/lib/google/cloud/discovery_engine/v1beta/project_service/operations.rb +12 -15
  42. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/client.rb +29 -2
  43. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/operations.rb +43 -38
  44. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/service_stub.rb +22 -8
  45. data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +29 -3
  46. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +29 -3
  47. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/service_stub.rb +22 -8
  48. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +28 -2
  49. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +28 -2
  50. data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +22 -8
  51. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/client.rb +30 -7
  52. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/operations.rb +12 -15
  53. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/client.rb +30 -7
  54. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/operations.rb +43 -38
  55. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/service_stub.rb +62 -38
  56. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/client.rb +29 -6
  57. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/client.rb +29 -6
  58. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/service_stub.rb +54 -32
  59. data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +32 -6
  60. data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +12 -15
  61. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +32 -6
  62. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +43 -38
  63. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +54 -32
  64. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +427 -3
  65. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +417 -3
  66. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +99 -7
  67. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/client.rb +29 -3
  68. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/operations.rb +12 -15
  69. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/client.rb +29 -3
  70. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/operations.rb +43 -38
  71. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/service_stub.rb +30 -14
  72. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/client.rb +31 -6
  73. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/client.rb +31 -6
  74. data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/service_stub.rb +38 -20
  75. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/client.rb +361 -14
  76. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/operations.rb +12 -15
  77. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/paths.rb +49 -0
  78. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/client.rb +340 -14
  79. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/operations.rb +43 -38
  80. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/service_stub.rb +308 -73
  81. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +31 -6
  82. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +12 -15
  83. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +31 -6
  84. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +43 -38
  85. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +46 -26
  86. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  87. data/lib/google/cloud/discoveryengine/v1beta/answer_pb.rb +1 -1
  88. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +1 -1
  89. data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +18 -1
  90. data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +2 -0
  91. data/lib/google/cloud/discoveryengine/v1beta/control_pb.rb +1 -1
  92. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +4 -1
  93. data/lib/google/cloud/discoveryengine/v1beta/custom_tuning_model_pb.rb +1 -1
  94. data/lib/google/cloud/discoveryengine/v1beta/data_store_pb.rb +7 -1
  95. data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +2 -1
  96. data/lib/google/cloud/discoveryengine/v1beta/engine_pb.rb +1 -1
  97. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_pb.rb +24 -1
  98. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_services_pb.rb +4 -0
  99. data/lib/google/cloud/discoveryengine/v1beta/grounding_pb.rb +2 -1
  100. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +3 -1
  101. data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +14 -0
  102. data/lib/google/cloud/discoveryengine/v1beta/serving_config_pb.rb +2 -2
  103. data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_pb.rb +2 -1
  104. data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_pb.rb +10 -1
  105. data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_services_pb.rb +7 -0
  106. data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +1 -1
  107. data/proto_docs/google/api/client.rb +39 -0
  108. data/proto_docs/google/cloud/discoveryengine/v1beta/answer.rb +20 -6
  109. data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +268 -0
  110. data/proto_docs/google/cloud/discoveryengine/v1beta/control.rb +9 -0
  111. data/proto_docs/google/cloud/discoveryengine/v1beta/control_service.rb +6 -6
  112. data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +95 -15
  113. data/proto_docs/google/cloud/discoveryengine/v1beta/custom_tuning_model.rb +8 -3
  114. data/proto_docs/google/cloud/discoveryengine/v1beta/data_store.rb +131 -0
  115. data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +7 -5
  116. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +19 -0
  117. data/proto_docs/google/cloud/discoveryengine/v1beta/engine.rb +5 -1
  118. data/proto_docs/google/cloud/discoveryengine/v1beta/engine_service.rb +4 -4
  119. data/proto_docs/google/cloud/discoveryengine/v1beta/grounded_generation_service.rb +396 -1
  120. data/proto_docs/google/cloud/discoveryengine/v1beta/grounding.rb +10 -0
  121. data/proto_docs/google/cloud/discoveryengine/v1beta/project.rb +1 -1
  122. data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +1 -1
  123. data/proto_docs/google/cloud/discoveryengine/v1beta/rank_service.rb +1 -1
  124. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +71 -0
  125. data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config.rb +16 -0
  126. data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config_service.rb +2 -2
  127. data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine.rb +17 -0
  128. data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine_service.rb +147 -1
  129. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +9 -1
  130. data/proto_docs/google/longrunning/operations.rb +19 -14
  131. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8679c5cf98f141e7a42c1b151fbc8b1f0eb64faa50e8cd55002ad5e52479c36c
4
- data.tar.gz: 977cbafe59af89e46224a35d870742a69a0f28af6281345633e62edb3f8a1cd6
3
+ metadata.gz: 6540034d790eaf9ad6165a0e6a9d2a3e9c92578ab00b8c0bb395f3ea22d73ac8
4
+ data.tar.gz: 6b5d2743325834f8580e79558a4b8466c8e515af5a614b5cf477b110fb2b5b2c
5
5
  SHA512:
6
- metadata.gz: 4a22a4415cefa5ad0d9b17c362732da8a566604f30160b2dbb6a64910d79db714b2ce7b884d269cf56188f06513199449f216063bb7a805057f206dfd46a642b
7
- data.tar.gz: 818bcc004174ac4a3a7b6ad8c41e9e628313b4c8c21f2bb8f01c81f7793f6775312b6e8b4dd3601b4e6081613b742197552d3f17dbe3ff014559f6ca9043cffe
6
+ metadata.gz: b4c19df302f96bccb055320c5768b6d0b0e4f22378c8c7f2f971984c5c48e27e315f2929ea2cabe01bcaa5d4ffe361c7ad204f1515c65c9a9b4a79220050d039
7
+ data.tar.gz: 7aa167d0d3f5ab7adb85e794db98332d844078d39135d1567092927b1e6b6b63a4888d052b55638e1faa29c154247ee0e92291807b8aea8da56074ba6e984885
data/README.md CHANGED
@@ -42,33 +42,43 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/generative-ai-app-builder/docs)
43
43
  for general usage information.
44
44
 
45
- ## Enabling Logging
46
-
47
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
48
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
49
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
50
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
51
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
52
-
53
- Configuring a Ruby stdlib logger:
45
+ ## Debug Logging
46
+
47
+ This library comes with opt-in Debug Logging that can help you troubleshoot
48
+ your application's integration with the API. When logging is activated, key
49
+ events such as requests and responses, along with data payloads and metadata
50
+ such as headers and client configuration, are logged to the standard error
51
+ stream.
52
+
53
+ **WARNING:** Client Library Debug Logging includes your data payloads in
54
+ plaintext, which could include sensitive data such as PII for yourself or your
55
+ customers, private keys, or other security data that could be compromising if
56
+ leaked. Always practice good data hygiene with your application logs, and follow
57
+ the principle of least access. Google also recommends that Client Library Debug
58
+ Logging be enabled only temporarily during active debugging, and not used
59
+ permanently in production.
60
+
61
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
62
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
63
+ list of client library gem names. This will select the default logging behavior,
64
+ which writes logs to the standard error stream. On a local workstation, this may
65
+ result in logs appearing on the console. When running on a Google Cloud hosting
66
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
67
+ results in logs appearing alongside your application logs in the
68
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
69
+
70
+ You can customize logging by modifying the `logger` configuration when
71
+ constructing a client object. For example:
54
72
 
55
73
  ```ruby
74
+ require "google/cloud/discovery_engine/v1beta"
56
75
  require "logger"
57
76
 
58
- module MyLogger
59
- LOGGER = Logger.new $stderr, level: Logger::WARN
60
- def logger
61
- LOGGER
62
- end
63
- end
64
-
65
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
66
- module GRPC
67
- extend MyLogger
77
+ client = ::Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new do |config|
78
+ config.logger = Logger.new "my-app.log"
68
79
  end
69
80
  ```
70
81
 
71
-
72
82
  ## Google Cloud Samples
73
83
 
74
84
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -170,14 +170,26 @@ module Google
170
170
  universe_domain: @config.universe_domain,
171
171
  channel_args: @config.channel_args,
172
172
  interceptors: @config.interceptors,
173
- channel_pool_config: @config.channel_pool
173
+ channel_pool_config: @config.channel_pool,
174
+ logger: @config.logger
174
175
  )
175
176
 
177
+ @completion_service_stub.stub_logger&.info do |entry|
178
+ entry.set_system_name
179
+ entry.set_service
180
+ entry.message = "Created client for #{entry.service}"
181
+ entry.set_credentials_fields credentials
182
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
183
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
184
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
185
+ end
186
+
176
187
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
177
188
  config.credentials = credentials
178
189
  config.quota_project = @quota_project_id
179
190
  config.endpoint = @completion_service_stub.endpoint
180
191
  config.universe_domain = @completion_service_stub.universe_domain
192
+ config.logger = @completion_service_stub.logger if config.respond_to? :logger=
181
193
  end
182
194
  end
183
195
 
@@ -195,6 +207,15 @@ module Google
195
207
  #
196
208
  attr_reader :location_client
197
209
 
210
+ ##
211
+ # The logger used for request/response debug logging.
212
+ #
213
+ # @return [Logger]
214
+ #
215
+ def logger
216
+ @completion_service_stub.logger
217
+ end
218
+
198
219
  # Service calls
199
220
 
200
221
  ##
@@ -320,7 +341,153 @@ module Google
320
341
 
321
342
  @completion_service_stub.call_rpc :complete_query, request, options: options do |response, operation|
322
343
  yield response, operation if block_given?
323
- return response
344
+ end
345
+ rescue ::GRPC::BadStatus => e
346
+ raise ::Google::Cloud::Error.from_error(e)
347
+ end
348
+
349
+ ##
350
+ # Completes the user input with advanced keyword suggestions.
351
+ #
352
+ # @overload advanced_complete_query(request, options = nil)
353
+ # Pass arguments to `advanced_complete_query` via a request object, either of type
354
+ # {::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest} or an equivalent Hash.
355
+ #
356
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest, ::Hash]
357
+ # A request object representing the call parameters. Required. To specify no
358
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
359
+ # @param options [::Gapic::CallOptions, ::Hash]
360
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
361
+ #
362
+ # @overload advanced_complete_query(completion_config: nil, query: nil, query_model: nil, user_pseudo_id: nil, user_info: nil, include_tail_suggestions: nil, boost_spec: nil, suggestion_types: nil)
363
+ # Pass arguments to `advanced_complete_query` via keyword arguments. Note that at
364
+ # least one keyword argument is required. To specify no parameters, or to keep all
365
+ # the default parameter values, pass an empty Hash as a request object (see above).
366
+ #
367
+ # @param completion_config [::String]
368
+ # Required. The completion_config of the parent dataStore or engine resource
369
+ # name for which the completion is performed, such as
370
+ # `projects/*/locations/global/collections/default_collection/dataStores/*/completionConfig`
371
+ # `projects/*/locations/global/collections/default_collection/engines/*/completionConfig`.
372
+ # @param query [::String]
373
+ # Required. The typeahead input used to fetch suggestions. Maximum length is
374
+ # 128 characters.
375
+ #
376
+ # The query can not be empty for most of the suggestion types. If it is
377
+ # empty, an `INVALID_ARGUMENT` error is returned. The exception is when the
378
+ # suggestion_types contains only the type `RECENT_SEARCH`, the query can
379
+ # be an empty string. The is called "zero prefix" feature, which returns
380
+ # user's recently searched queries given the empty query.
381
+ # @param query_model [::String]
382
+ # Specifies the autocomplete data model. This overrides any model specified
383
+ # in the Configuration > Autocomplete section of the Cloud console. Currently
384
+ # supported values:
385
+ #
386
+ # * `document` - Using suggestions generated from user-imported documents.
387
+ # * `search-history` - Using suggestions generated from the past history of
388
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchService::Client#search SearchService.Search}
389
+ # API calls. Do not use it when there is no traffic for Search API.
390
+ # * `user-event` - Using suggestions generated from user-imported search
391
+ # events.
392
+ # * `document-completable` - Using suggestions taken directly from
393
+ # user-imported document fields marked as completable.
394
+ #
395
+ # Default values:
396
+ #
397
+ # * `document` is the default model for regular dataStores.
398
+ # * `search-history` is the default model for site search dataStores.
399
+ # @param user_pseudo_id [::String]
400
+ # A unique identifier for tracking visitors. For example, this could be
401
+ # implemented with an HTTP cookie, which should be able to uniquely identify
402
+ # a visitor on a single device. This unique identifier should not change if
403
+ # the visitor logs in or out of the website.
404
+ #
405
+ # This field should NOT have a fixed value such as `unknown_visitor`.
406
+ #
407
+ # This should be the same identifier as
408
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_pseudo_id UserEvent.user_pseudo_id}
409
+ # and
410
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#user_pseudo_id SearchRequest.user_pseudo_id}.
411
+ #
412
+ # The field must be a UTF-8 encoded string with a length limit of 128
413
+ # @param user_info [::Google::Cloud::DiscoveryEngine::V1beta::UserInfo, ::Hash]
414
+ # Optional. Information about the end user.
415
+ #
416
+ # This should be the same identifier information as
417
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UserEvent#user_info UserEvent.user_info}
418
+ # and
419
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SearchRequest#user_info SearchRequest.user_info}.
420
+ # @param include_tail_suggestions [::Boolean]
421
+ # Indicates if tail suggestions should be returned if there are no
422
+ # suggestions that match the full query. Even if set to true, if there are
423
+ # suggestions that match the full query, those are returned and no
424
+ # tail suggestions are returned.
425
+ # @param boost_spec [::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest::BoostSpec, ::Hash]
426
+ # Optional. Specification to boost suggestions matching the condition.
427
+ # @param suggestion_types [::Array<::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest::SuggestionType>]
428
+ # Optional. Suggestion types to return. If empty or unspecified, query
429
+ # suggestions are returned. Only one suggestion type is supported at the
430
+ # moment.
431
+ #
432
+ # @yield [response, operation] Access the result along with the RPC operation
433
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse]
434
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
435
+ #
436
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse]
437
+ #
438
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
439
+ #
440
+ # @example Basic example
441
+ # require "google/cloud/discovery_engine/v1beta"
442
+ #
443
+ # # Create a client object. The client can be reused for multiple calls.
444
+ # client = Google::Cloud::DiscoveryEngine::V1beta::CompletionService::Client.new
445
+ #
446
+ # # Create a request. To set request fields, pass in keyword arguments.
447
+ # request = Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest.new
448
+ #
449
+ # # Call the advanced_complete_query method.
450
+ # result = client.advanced_complete_query request
451
+ #
452
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryResponse.
453
+ # p result
454
+ #
455
+ def advanced_complete_query request, options = nil
456
+ raise ::ArgumentError, "request must be provided" if request.nil?
457
+
458
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::AdvancedCompleteQueryRequest
459
+
460
+ # Converts hash and nil to an options object
461
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
462
+
463
+ # Customize the options with defaults
464
+ metadata = @config.rpcs.advanced_complete_query.metadata.to_h
465
+
466
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
467
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
468
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
469
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
470
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
471
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
472
+
473
+ header_params = {}
474
+ if request.completion_config
475
+ header_params["completion_config"] = request.completion_config
476
+ end
477
+
478
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
479
+ metadata[:"x-goog-request-params"] ||= request_params_header
480
+
481
+ options.apply_defaults timeout: @config.rpcs.advanced_complete_query.timeout,
482
+ metadata: metadata,
483
+ retry_policy: @config.rpcs.advanced_complete_query.retry_policy
484
+
485
+ options.apply_defaults timeout: @config.timeout,
486
+ metadata: @config.metadata,
487
+ retry_policy: @config.retry_policy
488
+
489
+ @completion_service_stub.call_rpc :advanced_complete_query, request, options: options do |response, operation|
490
+ yield response, operation if block_given?
324
491
  end
325
492
  rescue ::GRPC::BadStatus => e
326
493
  raise ::Google::Cloud::Error.from_error(e)
@@ -428,7 +595,7 @@ module Google
428
595
  @completion_service_stub.call_rpc :import_suggestion_deny_list_entries, request, options: options do |response, operation|
429
596
  response = ::Gapic::Operation.new response, @operations_client, options: options
430
597
  yield response, operation if block_given?
431
- return response
598
+ throw :response, response
432
599
  end
433
600
  rescue ::GRPC::BadStatus => e
434
601
  raise ::Google::Cloud::Error.from_error(e)
@@ -525,7 +692,7 @@ module Google
525
692
  @completion_service_stub.call_rpc :purge_suggestion_deny_list_entries, request, options: options do |response, operation|
526
693
  response = ::Gapic::Operation.new response, @operations_client, options: options
527
694
  yield response, operation if block_given?
528
- return response
695
+ throw :response, response
529
696
  end
530
697
  rescue ::GRPC::BadStatus => e
531
698
  raise ::Google::Cloud::Error.from_error(e)
@@ -632,7 +799,7 @@ module Google
632
799
  @completion_service_stub.call_rpc :import_completion_suggestions, request, options: options do |response, operation|
633
800
  response = ::Gapic::Operation.new response, @operations_client, options: options
634
801
  yield response, operation if block_given?
635
- return response
802
+ throw :response, response
636
803
  end
637
804
  rescue ::GRPC::BadStatus => e
638
805
  raise ::Google::Cloud::Error.from_error(e)
@@ -730,7 +897,7 @@ module Google
730
897
  @completion_service_stub.call_rpc :purge_completion_suggestions, request, options: options do |response, operation|
731
898
  response = ::Gapic::Operation.new response, @operations_client, options: options
732
899
  yield response, operation if block_given?
733
- return response
900
+ throw :response, response
734
901
  end
735
902
  rescue ::GRPC::BadStatus => e
736
903
  raise ::Google::Cloud::Error.from_error(e)
@@ -819,6 +986,11 @@ module Google
819
986
  # default endpoint URL. The default value of nil uses the environment
820
987
  # universe (usually the default "googleapis.com" universe).
821
988
  # @return [::String,nil]
989
+ # @!attribute [rw] logger
990
+ # A custom logger to use for request/response debug logging, or the value
991
+ # `:default` (the default) to construct a default logger, or `nil` to
992
+ # explicitly disable logging.
993
+ # @return [::Logger,:default,nil]
822
994
  #
823
995
  class Configuration
824
996
  extend ::Gapic::Config
@@ -843,6 +1015,7 @@ module Google
843
1015
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
844
1016
  config_attr :quota_project, nil, ::String, nil
845
1017
  config_attr :universe_domain, nil, ::String, nil
1018
+ config_attr :logger, :default, ::Logger, nil, :default
846
1019
 
847
1020
  # @private
848
1021
  def initialize parent_config = nil
@@ -895,6 +1068,11 @@ module Google
895
1068
  #
896
1069
  attr_reader :complete_query
897
1070
  ##
1071
+ # RPC-specific configuration for `advanced_complete_query`
1072
+ # @return [::Gapic::Config::Method]
1073
+ #
1074
+ attr_reader :advanced_complete_query
1075
+ ##
898
1076
  # RPC-specific configuration for `import_suggestion_deny_list_entries`
899
1077
  # @return [::Gapic::Config::Method]
900
1078
  #
@@ -919,6 +1097,8 @@ module Google
919
1097
  def initialize parent_rpcs = nil
920
1098
  complete_query_config = parent_rpcs.complete_query if parent_rpcs.respond_to? :complete_query
921
1099
  @complete_query = ::Gapic::Config::Method.new complete_query_config
1100
+ advanced_complete_query_config = parent_rpcs.advanced_complete_query if parent_rpcs.respond_to? :advanced_complete_query
1101
+ @advanced_complete_query = ::Gapic::Config::Method.new advanced_complete_query_config
922
1102
  import_suggestion_deny_list_entries_config = parent_rpcs.import_suggestion_deny_list_entries if parent_rpcs.respond_to? :import_suggestion_deny_list_entries
923
1103
  @import_suggestion_deny_list_entries = ::Gapic::Config::Method.new import_suggestion_deny_list_entries_config
924
1104
  purge_suggestion_deny_list_entries_config = parent_rpcs.purge_suggestion_deny_list_entries if parent_rpcs.respond_to? :purge_suggestion_deny_list_entries
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -688,6 +679,11 @@ module Google
688
679
  # default endpoint URL. The default value of nil uses the environment
689
680
  # universe (usually the default "googleapis.com" universe).
690
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
691
687
  #
692
688
  class Configuration
693
689
  extend ::Gapic::Config
@@ -712,6 +708,7 @@ module Google
712
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
709
  config_attr :quota_project, nil, ::String, nil
714
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
715
712
 
716
713
  # @private
717
714
  def initialize parent_config = nil
@@ -24,6 +24,68 @@ module Google
24
24
  module CompletionService
25
25
  # Path helper methods for the CompletionService API.
26
26
  module Paths
27
+ ##
28
+ # Create a fully-qualified CompletionConfig resource string.
29
+ #
30
+ # @overload completion_config_path(project:, location:, data_store:)
31
+ # The resource will be in the following format:
32
+ #
33
+ # `projects/{project}/locations/{location}/dataStores/{data_store}/completionConfig`
34
+ #
35
+ # @param project [String]
36
+ # @param location [String]
37
+ # @param data_store [String]
38
+ #
39
+ # @overload completion_config_path(project:, location:, collection:, data_store:)
40
+ # The resource will be in the following format:
41
+ #
42
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/completionConfig`
43
+ #
44
+ # @param project [String]
45
+ # @param location [String]
46
+ # @param collection [String]
47
+ # @param data_store [String]
48
+ #
49
+ # @overload completion_config_path(project:, location:, collection:, engine:)
50
+ # The resource will be in the following format:
51
+ #
52
+ # `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/completionConfig`
53
+ #
54
+ # @param project [String]
55
+ # @param location [String]
56
+ # @param collection [String]
57
+ # @param engine [String]
58
+ #
59
+ # @return [::String]
60
+ def completion_config_path **args
61
+ resources = {
62
+ "data_store:location:project" => (proc do |project:, location:, data_store:|
63
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
64
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
65
+
66
+ "projects/#{project}/locations/#{location}/dataStores/#{data_store}/completionConfig"
67
+ end),
68
+ "collection:data_store:location:project" => (proc do |project:, location:, collection:, data_store:|
69
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
70
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
71
+ raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
72
+
73
+ "projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}/completionConfig"
74
+ end),
75
+ "collection:engine:location:project" => (proc do |project:, location:, collection:, engine:|
76
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
77
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
78
+ raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
79
+
80
+ "projects/#{project}/locations/#{location}/collections/#{collection}/engines/#{engine}/completionConfig"
81
+ end)
82
+ }
83
+
84
+ resource = resources[args.keys.sort.join(":")]
85
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
86
+ resource.call(**args)
87
+ end
88
+
27
89
  ##
28
90
  # Create a fully-qualified DataStore resource string.
29
91
  #