google-cloud-discovery_engine-v1beta 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +742 -0
  3. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/paths.rb +199 -0
  4. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +693 -0
  5. data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +520 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +48 -23
  7. data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +21 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +48 -23
  9. data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +296 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +275 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/service_stub.rb +180 -0
  12. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +449 -0
  13. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/paths.rb +52 -0
  15. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +416 -0
  16. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub.rb +129 -0
  17. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest.rb +52 -0
  18. data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service.rb +55 -0
  19. data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +459 -0
  20. data/lib/google/cloud/discovery_engine/v1beta/rank_service/credentials.rb +47 -0
  21. data/lib/google/cloud/discovery_engine/v1beta/rank_service/paths.rb +52 -0
  22. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +426 -0
  23. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/service_stub.rb +129 -0
  24. data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest.rb +52 -0
  25. data/lib/google/cloud/discovery_engine/v1beta/rank_service.rb +55 -0
  26. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +2 -0
  27. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +11 -6
  28. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +11 -6
  29. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  30. data/lib/google/cloud/discovery_engine/v1beta.rb +2 -0
  31. data/lib/google/cloud/discoveryengine/v1beta/answer_pb.rb +67 -0
  32. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +1 -1
  33. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +32 -1
  34. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_services_pb.rb +25 -0
  35. data/lib/google/cloud/discoveryengine/v1beta/document_processing_config_pb.rb +1 -1
  36. data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +3 -1
  37. data/lib/google/cloud/discoveryengine/v1beta/engine_service_pb.rb +6 -1
  38. data/lib/google/cloud/discoveryengine/v1beta/engine_service_services_pb.rb +12 -0
  39. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_pb.rb +52 -0
  40. data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_services_pb.rb +45 -0
  41. data/lib/google/cloud/discoveryengine/v1beta/grounding_pb.rb +46 -0
  42. data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +13 -1
  43. data/lib/google/cloud/discoveryengine/v1beta/rank_service_pb.rb +49 -0
  44. data/lib/google/cloud/discoveryengine/v1beta/rank_service_services_pb.rb +45 -0
  45. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +7 -1
  46. data/lib/google/cloud/discoveryengine/v1beta/search_tuning_service_pb.rb +1 -1
  47. data/lib/google/cloud/discoveryengine/v1beta/session_pb.rb +50 -0
  48. data/proto_docs/google/cloud/discoveryengine/v1beta/answer.rb +354 -0
  49. data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +9 -1
  50. data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +475 -0
  51. data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +3 -5
  52. data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +4 -0
  53. data/proto_docs/google/cloud/discoveryengine/v1beta/engine.rb +2 -2
  54. data/proto_docs/google/cloud/discoveryengine/v1beta/engine_service.rb +51 -0
  55. data/proto_docs/google/cloud/discoveryengine/v1beta/grounded_generation_service.rb +106 -0
  56. data/proto_docs/google/cloud/discoveryengine/v1beta/grounding.rb +76 -0
  57. data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +310 -24
  58. data/proto_docs/google/cloud/discoveryengine/v1beta/rank_service.rb +99 -0
  59. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +154 -22
  60. data/proto_docs/google/cloud/discoveryengine/v1beta/search_tuning_service.rb +16 -1
  61. data/proto_docs/google/cloud/discoveryengine/v1beta/session.rb +85 -0
  62. data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +1 -1
  63. metadata +28 -2
@@ -0,0 +1,416 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/discoveryengine/v1beta/grounded_generation_service_pb"
21
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module DiscoveryEngine
27
+ module V1beta
28
+ module GroundedGenerationService
29
+ module Rest
30
+ ##
31
+ # REST client for the GroundedGenerationService service.
32
+ #
33
+ # Service for grounded generation.
34
+ #
35
+ class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
38
+
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :grounded_generation_service_stub
43
+
44
+ ##
45
+ # Configure the GroundedGenerationService Client class.
46
+ #
47
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all GroundedGenerationService clients
53
+ # ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config.timeout = 5.0
74
+ default_config.retry_policy = {
75
+ initial_delay: 0.1, max_delay: 5.0, multiplier: 1.3, retry_codes: [14]
76
+ }
77
+
78
+ default_config
79
+ end
80
+ yield @configure if block_given?
81
+ @configure
82
+ end
83
+
84
+ ##
85
+ # Configure the GroundedGenerationService Client instance.
86
+ #
87
+ # The configuration is set to the derived mode, meaning that values can be changed,
88
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
89
+ # should be made on {Client.configure}.
90
+ #
91
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client::Configuration}
92
+ # for a description of the configuration fields.
93
+ #
94
+ # @yield [config] Configure the Client client.
95
+ # @yieldparam config [Client::Configuration]
96
+ #
97
+ # @return [Client::Configuration]
98
+ #
99
+ def configure
100
+ yield @config if block_given?
101
+ @config
102
+ end
103
+
104
+ ##
105
+ # The effective universe domain
106
+ #
107
+ # @return [String]
108
+ #
109
+ def universe_domain
110
+ @grounded_generation_service_stub.universe_domain
111
+ end
112
+
113
+ ##
114
+ # Create a new GroundedGenerationService REST client object.
115
+ #
116
+ # @example
117
+ #
118
+ # # Create a client using the default configuration
119
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.new
120
+ #
121
+ # # Create a client using a custom configuration
122
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.new do |config|
123
+ # config.timeout = 10.0
124
+ # end
125
+ #
126
+ # @yield [config] Configure the GroundedGenerationService client.
127
+ # @yieldparam config [Client::Configuration]
128
+ #
129
+ def initialize
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint.nil? ||
141
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-"))
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+
149
+ @quota_project_id = @config.quota_project
150
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
151
+
152
+ @grounded_generation_service_stub = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::ServiceStub.new(
153
+ endpoint: @config.endpoint,
154
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
155
+ universe_domain: @config.universe_domain,
156
+ credentials: credentials
157
+ )
158
+
159
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
160
+ config.credentials = credentials
161
+ config.quota_project = @quota_project_id
162
+ config.endpoint = @grounded_generation_service_stub.endpoint
163
+ config.universe_domain = @grounded_generation_service_stub.universe_domain
164
+ end
165
+ end
166
+
167
+ ##
168
+ # Get the associated client for mix-in of the Locations.
169
+ #
170
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
171
+ #
172
+ attr_reader :location_client
173
+
174
+ # Service calls
175
+
176
+ ##
177
+ # Performs a grounding check.
178
+ #
179
+ # @overload check_grounding(request, options = nil)
180
+ # Pass arguments to `check_grounding` via a request object, either of type
181
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingRequest} or an equivalent Hash.
182
+ #
183
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingRequest, ::Hash]
184
+ # A request object representing the call parameters. Required. To specify no
185
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
186
+ # @param options [::Gapic::CallOptions, ::Hash]
187
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
188
+ #
189
+ # @overload check_grounding(grounding_config: nil, answer_candidate: nil, facts: nil, grounding_spec: nil)
190
+ # Pass arguments to `check_grounding` via keyword arguments. Note that at
191
+ # least one keyword argument is required. To specify no parameters, or to keep all
192
+ # the default parameter values, pass an empty Hash as a request object (see above).
193
+ #
194
+ # @param grounding_config [::String]
195
+ # Required. The resource name of the grounding config, such as
196
+ # `projects/*/locations/global/groundingConfigs/default_grounding_config`.
197
+ # @param answer_candidate [::String]
198
+ # Answer candidate to check.
199
+ # @param facts [::Array<::Google::Cloud::DiscoveryEngine::V1beta::GroundingFact, ::Hash>]
200
+ # List of facts for the grounding check.
201
+ # We support up to 200 facts.
202
+ # @param grounding_spec [::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingSpec, ::Hash]
203
+ # Configuration of the grounding check.
204
+ # @yield [result, operation] Access the result along with the TransportOperation object
205
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingResponse]
206
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
207
+ #
208
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingResponse]
209
+ #
210
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
211
+ #
212
+ # @example Basic example
213
+ # require "google/cloud/discovery_engine/v1beta"
214
+ #
215
+ # # Create a client object. The client can be reused for multiple calls.
216
+ # client = Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.new
217
+ #
218
+ # # Create a request. To set request fields, pass in keyword arguments.
219
+ # request = Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingRequest.new
220
+ #
221
+ # # Call the check_grounding method.
222
+ # result = client.check_grounding request
223
+ #
224
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingResponse.
225
+ # p result
226
+ #
227
+ def check_grounding request, options = nil
228
+ raise ::ArgumentError, "request must be provided" if request.nil?
229
+
230
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingRequest
231
+
232
+ # Converts hash and nil to an options object
233
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
234
+
235
+ # Customize the options with defaults
236
+ call_metadata = @config.rpcs.check_grounding.metadata.to_h
237
+
238
+ # Set x-goog-api-client and x-goog-user-project headers
239
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
240
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
241
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
242
+ transports_version_send: [:rest]
243
+
244
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
245
+
246
+ options.apply_defaults timeout: @config.rpcs.check_grounding.timeout,
247
+ metadata: call_metadata,
248
+ retry_policy: @config.rpcs.check_grounding.retry_policy
249
+
250
+ options.apply_defaults timeout: @config.timeout,
251
+ metadata: @config.metadata,
252
+ retry_policy: @config.retry_policy
253
+
254
+ @grounded_generation_service_stub.check_grounding request, options do |result, operation|
255
+ yield result, operation if block_given?
256
+ return result
257
+ end
258
+ rescue ::Gapic::Rest::Error => e
259
+ raise ::Google::Cloud::Error.from_error(e)
260
+ end
261
+
262
+ ##
263
+ # Configuration class for the GroundedGenerationService REST API.
264
+ #
265
+ # This class represents the configuration for GroundedGenerationService REST,
266
+ # providing control over timeouts, retry behavior, logging, transport
267
+ # parameters, and other low-level controls. Certain parameters can also be
268
+ # applied individually to specific RPCs. See
269
+ # {::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client::Configuration::Rpcs}
270
+ # for a list of RPCs that can be configured independently.
271
+ #
272
+ # Configuration can be applied globally to all clients, or to a single client
273
+ # on construction.
274
+ #
275
+ # @example
276
+ #
277
+ # # Modify the global config, setting the timeout for
278
+ # # check_grounding to 20 seconds,
279
+ # # and all remaining timeouts to 10 seconds.
280
+ # ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.configure do |config|
281
+ # config.timeout = 10.0
282
+ # config.rpcs.check_grounding.timeout = 20.0
283
+ # end
284
+ #
285
+ # # Apply the above configuration only to a new client.
286
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.new do |config|
287
+ # config.timeout = 10.0
288
+ # config.rpcs.check_grounding.timeout = 20.0
289
+ # end
290
+ #
291
+ # @!attribute [rw] endpoint
292
+ # A custom service endpoint, as a hostname or hostname:port. The default is
293
+ # nil, indicating to use the default endpoint in the current universe domain.
294
+ # @return [::String,nil]
295
+ # @!attribute [rw] credentials
296
+ # Credentials to send with calls. You may provide any of the following types:
297
+ # * (`String`) The path to a service account key file in JSON format
298
+ # * (`Hash`) A service account key as a Hash
299
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
300
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
301
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
302
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
303
+ # * (`nil`) indicating no credentials
304
+ # @return [::Object]
305
+ # @!attribute [rw] scope
306
+ # The OAuth scopes
307
+ # @return [::Array<::String>]
308
+ # @!attribute [rw] lib_name
309
+ # The library name as recorded in instrumentation and logging
310
+ # @return [::String]
311
+ # @!attribute [rw] lib_version
312
+ # The library version as recorded in instrumentation and logging
313
+ # @return [::String]
314
+ # @!attribute [rw] timeout
315
+ # The call timeout in seconds.
316
+ # @return [::Numeric]
317
+ # @!attribute [rw] metadata
318
+ # Additional headers to be sent with the call.
319
+ # @return [::Hash{::Symbol=>::String}]
320
+ # @!attribute [rw] retry_policy
321
+ # The retry policy. The value is a hash with the following keys:
322
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
323
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
324
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
325
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
326
+ # trigger a retry.
327
+ # @return [::Hash]
328
+ # @!attribute [rw] quota_project
329
+ # A separate project against which to charge quota.
330
+ # @return [::String]
331
+ # @!attribute [rw] universe_domain
332
+ # The universe domain within which to make requests. This determines the
333
+ # default endpoint URL. The default value of nil uses the environment
334
+ # universe (usually the default "googleapis.com" universe).
335
+ # @return [::String,nil]
336
+ #
337
+ class Configuration
338
+ extend ::Gapic::Config
339
+
340
+ # @private
341
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
342
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
343
+
344
+ config_attr :endpoint, nil, ::String, nil
345
+ config_attr :credentials, nil do |value|
346
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
347
+ allowed.any? { |klass| klass === value }
348
+ end
349
+ config_attr :scope, nil, ::String, ::Array, nil
350
+ config_attr :lib_name, nil, ::String, nil
351
+ config_attr :lib_version, nil, ::String, nil
352
+ config_attr :timeout, nil, ::Numeric, nil
353
+ config_attr :metadata, nil, ::Hash, nil
354
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
355
+ config_attr :quota_project, nil, ::String, nil
356
+ config_attr :universe_domain, nil, ::String, nil
357
+
358
+ # @private
359
+ def initialize parent_config = nil
360
+ @parent_config = parent_config unless parent_config.nil?
361
+
362
+ yield self if block_given?
363
+ end
364
+
365
+ ##
366
+ # Configurations for individual RPCs
367
+ # @return [Rpcs]
368
+ #
369
+ def rpcs
370
+ @rpcs ||= begin
371
+ parent_rpcs = nil
372
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
373
+ Rpcs.new parent_rpcs
374
+ end
375
+ end
376
+
377
+ ##
378
+ # Configuration RPC class for the GroundedGenerationService API.
379
+ #
380
+ # Includes fields providing the configuration for each RPC in this service.
381
+ # Each configuration object is of type `Gapic::Config::Method` and includes
382
+ # the following configuration fields:
383
+ #
384
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
385
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
386
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
387
+ # include the following keys:
388
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
389
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
390
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
391
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
392
+ # trigger a retry.
393
+ #
394
+ class Rpcs
395
+ ##
396
+ # RPC-specific configuration for `check_grounding`
397
+ # @return [::Gapic::Config::Method]
398
+ #
399
+ attr_reader :check_grounding
400
+
401
+ # @private
402
+ def initialize parent_rpcs = nil
403
+ check_grounding_config = parent_rpcs.check_grounding if parent_rpcs.respond_to? :check_grounding
404
+ @check_grounding = ::Gapic::Config::Method.new check_grounding_config
405
+
406
+ yield self if block_given?
407
+ end
408
+ end
409
+ end
410
+ end
411
+ end
412
+ end
413
+ end
414
+ end
415
+ end
416
+ end
@@ -0,0 +1,129 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/discoveryengine/v1beta/grounded_generation_service_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module DiscoveryEngine
24
+ module V1beta
25
+ module GroundedGenerationService
26
+ module Rest
27
+ ##
28
+ # REST service stub for the GroundedGenerationService service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # These require statements are intentionally placed here to initialize
35
+ # the REST modules only when it's required.
36
+ require "gapic/rest"
37
+
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
39
+ endpoint_template: endpoint_template,
40
+ universe_domain: universe_domain,
41
+ credentials: credentials,
42
+ numeric_enums: true,
43
+ raise_faraday_errors: false
44
+ end
45
+
46
+ ##
47
+ # The effective universe domain
48
+ #
49
+ # @return [String]
50
+ #
51
+ def universe_domain
52
+ @client_stub.universe_domain
53
+ end
54
+
55
+ ##
56
+ # The effective endpoint
57
+ #
58
+ # @return [String]
59
+ #
60
+ def endpoint
61
+ @client_stub.endpoint
62
+ end
63
+
64
+ ##
65
+ # Baseline implementation for the check_grounding REST call
66
+ #
67
+ # @param request_pb [::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingRequest]
68
+ # A request object representing the call parameters. Required.
69
+ # @param options [::Gapic::CallOptions]
70
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
71
+ #
72
+ # @yield [result, operation] Access the result along with the TransportOperation object
73
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingResponse]
74
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
75
+ #
76
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingResponse]
77
+ # A result object deserialized from the server's reply
78
+ def check_grounding request_pb, options = nil
79
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
80
+
81
+ verb, uri, query_string_params, body = ServiceStub.transcode_check_grounding_request request_pb
82
+ query_string_params = if query_string_params.any?
83
+ query_string_params.to_h { |p| p.split "=", 2 }
84
+ else
85
+ {}
86
+ end
87
+
88
+ response = @client_stub.make_http_request(
89
+ verb,
90
+ uri: uri,
91
+ body: body || "",
92
+ params: query_string_params,
93
+ options: options
94
+ )
95
+ operation = ::Gapic::Rest::TransportOperation.new response
96
+ result = ::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingResponse.decode_json response.body, ignore_unknown_fields: true
97
+
98
+ yield result, operation if block_given?
99
+ result
100
+ end
101
+
102
+ ##
103
+ # @private
104
+ #
105
+ # GRPC transcoding helper method for the check_grounding REST call
106
+ #
107
+ # @param request_pb [::Google::Cloud::DiscoveryEngine::V1beta::CheckGroundingRequest]
108
+ # A request object representing the call parameters. Required.
109
+ # @return [Array(String, [String, nil], Hash{String => String})]
110
+ # Uri, Body, Query string parameters
111
+ def self.transcode_check_grounding_request request_pb
112
+ transcoder = Gapic::Rest::GrpcTranscoder.new
113
+ .with_bindings(
114
+ uri_method: :post,
115
+ uri_template: "/v1beta/{grounding_config}:check",
116
+ body: "*",
117
+ matches: [
118
+ ["grounding_config", %r{^projects/[^/]+/locations/[^/]+/groundingConfigs/[^/]+/?$}, false]
119
+ ]
120
+ )
121
+ transcoder.transcode request_pb
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/discovery_engine/v1beta/version"
24
+
25
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/credentials"
26
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/paths"
27
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module DiscoveryEngine
32
+ module V1beta
33
+ ##
34
+ # Service for grounded generation.
35
+ #
36
+ # To load this service and instantiate a REST client:
37
+ #
38
+ # require "google/cloud/discovery_engine/v1beta/grounded_generation_service/rest"
39
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.new
40
+ #
41
+ module GroundedGenerationService
42
+ # Client for the REST transport
43
+ module Rest
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
52
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/helpers" if ::File.file? helper_path
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/discovery_engine/v1beta/version"
24
+
25
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/credentials"
26
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/paths"
27
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/client"
28
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/rest"
29
+
30
+ module Google
31
+ module Cloud
32
+ module DiscoveryEngine
33
+ module V1beta
34
+ ##
35
+ # Service for grounded generation.
36
+ #
37
+ # @example Load this service and instantiate a gRPC client
38
+ #
39
+ # require "google/cloud/discovery_engine/v1beta/grounded_generation_service"
40
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Client.new
41
+ #
42
+ # @example Load this service and instantiate a REST client
43
+ #
44
+ # require "google/cloud/discovery_engine/v1beta/grounded_generation_service/rest"
45
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.new
46
+ #
47
+ module GroundedGenerationService
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ helper_path = ::File.join __dir__, "grounded_generation_service", "helpers.rb"
55
+ require "google/cloud/discovery_engine/v1beta/grounded_generation_service/helpers" if ::File.file? helper_path