google-cloud-discovery_engine-v1beta 0.15.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -20
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +186 -6
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +62 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +179 -6
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +131 -31
- data/lib/google/cloud/discovery_engine/v1beta/control_service/client.rb +35 -12
- data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/client.rb +35 -12
- data/lib/google/cloud/discovery_engine/v1beta/control_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/client.rb +48 -27
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/client.rb +48 -27
- data/lib/google/cloud/discovery_engine/v1beta/conversational_search_service/rest/service_stub.rb +118 -80
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +31 -9
- data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +25 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +31 -9
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +78 -50
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/client.rb +35 -12
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/client.rb +35 -12
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/service_stub.rb +78 -50
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/client.rb +31 -5
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/client.rb +31 -5
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/service_stub.rb +46 -26
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/client.rb +244 -6
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/paths.rb +85 -0
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/client.rb +152 -6
- data/lib/google/cloud/discovery_engine/v1beta/grounded_generation_service/rest/service_stub.rb +83 -7
- data/lib/google/cloud/discovery_engine/v1beta/project_service/client.rb +29 -2
- data/lib/google/cloud/discovery_engine/v1beta/project_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/client.rb +29 -2
- data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/discovery_engine/v1beta/rank_service/client.rb +29 -3
- data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/client.rb +29 -3
- data/lib/google/cloud/discovery_engine/v1beta/rank_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +28 -2
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +28 -2
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +22 -8
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/client.rb +30 -7
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/client.rb +30 -7
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/service_stub.rb +62 -38
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/client.rb +29 -6
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/client.rb +29 -6
- data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +32 -6
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +32 -6
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +54 -32
- data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +427 -3
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +417 -3
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +99 -7
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/client.rb +29 -3
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/client.rb +29 -3
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/service_stub.rb +30 -14
- data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/serving_config_service/rest/service_stub.rb +38 -20
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/client.rb +361 -14
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/paths.rb +49 -0
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/client.rb +340 -14
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/service_stub.rb +308 -73
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +12 -15
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +31 -6
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +43 -38
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +46 -26
- data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/answer_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +18 -1
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +2 -0
- data/lib/google/cloud/discoveryengine/v1beta/control_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +4 -1
- data/lib/google/cloud/discoveryengine/v1beta/custom_tuning_model_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/data_store_pb.rb +7 -1
- data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/engine_pb.rb +1 -1
- data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_pb.rb +24 -1
- data/lib/google/cloud/discoveryengine/v1beta/grounded_generation_service_services_pb.rb +4 -0
- data/lib/google/cloud/discoveryengine/v1beta/grounding_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +3 -1
- data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +14 -0
- data/lib/google/cloud/discoveryengine/v1beta/serving_config_pb.rb +2 -2
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_pb.rb +2 -1
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_pb.rb +10 -1
- data/lib/google/cloud/discoveryengine/v1beta/site_search_engine_service_services_pb.rb +7 -0
- data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +1 -1
- data/proto_docs/google/api/client.rb +39 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/answer.rb +20 -6
- data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +268 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/control.rb +9 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/control_service.rb +6 -6
- data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +95 -15
- data/proto_docs/google/cloud/discoveryengine/v1beta/custom_tuning_model.rb +8 -3
- data/proto_docs/google/cloud/discoveryengine/v1beta/data_store.rb +131 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +7 -5
- data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +19 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/engine.rb +5 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/engine_service.rb +4 -4
- data/proto_docs/google/cloud/discoveryengine/v1beta/grounded_generation_service.rb +396 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/grounding.rb +10 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/project.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/rank_service.rb +1 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +71 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config.rb +16 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config_service.rb +2 -2
- data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine.rb +17 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/site_search_engine_service.rb +147 -1
- data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +9 -1
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
@@ -163,14 +163,26 @@ module Google
|
|
163
163
|
universe_domain: @config.universe_domain,
|
164
164
|
channel_args: @config.channel_args,
|
165
165
|
interceptors: @config.interceptors,
|
166
|
-
channel_pool_config: @config.channel_pool
|
166
|
+
channel_pool_config: @config.channel_pool,
|
167
|
+
logger: @config.logger
|
167
168
|
)
|
168
169
|
|
170
|
+
@grounded_generation_service_stub.stub_logger&.info do |entry|
|
171
|
+
entry.set_system_name
|
172
|
+
entry.set_service
|
173
|
+
entry.message = "Created client for #{entry.service}"
|
174
|
+
entry.set_credentials_fields credentials
|
175
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
176
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
177
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
178
|
+
end
|
179
|
+
|
169
180
|
@location_client = Google::Cloud::Location::Locations::Client.new do |config|
|
170
181
|
config.credentials = credentials
|
171
182
|
config.quota_project = @quota_project_id
|
172
183
|
config.endpoint = @grounded_generation_service_stub.endpoint
|
173
184
|
config.universe_domain = @grounded_generation_service_stub.universe_domain
|
185
|
+
config.logger = @grounded_generation_service_stub.logger if config.respond_to? :logger=
|
174
186
|
end
|
175
187
|
end
|
176
188
|
|
@@ -181,8 +193,215 @@ module Google
|
|
181
193
|
#
|
182
194
|
attr_reader :location_client
|
183
195
|
|
196
|
+
##
|
197
|
+
# The logger used for request/response debug logging.
|
198
|
+
#
|
199
|
+
# @return [Logger]
|
200
|
+
#
|
201
|
+
def logger
|
202
|
+
@grounded_generation_service_stub.logger
|
203
|
+
end
|
204
|
+
|
184
205
|
# Service calls
|
185
206
|
|
207
|
+
##
|
208
|
+
# Generates grounded content in a streaming fashion.
|
209
|
+
#
|
210
|
+
# @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest, ::Hash>]
|
211
|
+
# An enumerable of {::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest} instances.
|
212
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
213
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
214
|
+
#
|
215
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
216
|
+
# @yieldparam response [::Enumerable<::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse>]
|
217
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
218
|
+
#
|
219
|
+
# @return [::Enumerable<::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse>]
|
220
|
+
#
|
221
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
222
|
+
#
|
223
|
+
# @example Basic example
|
224
|
+
# require "google/cloud/discovery_engine/v1beta"
|
225
|
+
#
|
226
|
+
# # Create a client object. The client can be reused for multiple calls.
|
227
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Client.new
|
228
|
+
#
|
229
|
+
# # Create an input stream.
|
230
|
+
# input = Gapic::StreamInput.new
|
231
|
+
#
|
232
|
+
# # Call the stream_generate_grounded_content method to start streaming.
|
233
|
+
# output = client.stream_generate_grounded_content input
|
234
|
+
#
|
235
|
+
# # Send requests on the stream. For each request object, set fields by
|
236
|
+
# # passing keyword arguments. Be sure to close the stream when done.
|
237
|
+
# input << Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest.new
|
238
|
+
# input << Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest.new
|
239
|
+
# input.close
|
240
|
+
#
|
241
|
+
# # The returned object is a streamed enumerable yielding elements of type
|
242
|
+
# # ::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse
|
243
|
+
# output.each do |current_response|
|
244
|
+
# p current_response
|
245
|
+
# end
|
246
|
+
#
|
247
|
+
def stream_generate_grounded_content request, options = nil
|
248
|
+
unless request.is_a? ::Enumerable
|
249
|
+
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
250
|
+
request = request.to_enum
|
251
|
+
end
|
252
|
+
|
253
|
+
request = request.lazy.map do |req|
|
254
|
+
::Gapic::Protobuf.coerce req, to: ::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest
|
255
|
+
end
|
256
|
+
|
257
|
+
# Converts hash and nil to an options object
|
258
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
259
|
+
|
260
|
+
# Customize the options with defaults
|
261
|
+
metadata = @config.rpcs.stream_generate_grounded_content.metadata.to_h
|
262
|
+
|
263
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
264
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
265
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
266
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
267
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
268
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
269
|
+
|
270
|
+
options.apply_defaults timeout: @config.rpcs.stream_generate_grounded_content.timeout,
|
271
|
+
metadata: metadata,
|
272
|
+
retry_policy: @config.rpcs.stream_generate_grounded_content.retry_policy
|
273
|
+
|
274
|
+
options.apply_defaults timeout: @config.timeout,
|
275
|
+
metadata: @config.metadata,
|
276
|
+
retry_policy: @config.retry_policy
|
277
|
+
|
278
|
+
@grounded_generation_service_stub.call_rpc :stream_generate_grounded_content, request, options: options do |response, operation|
|
279
|
+
yield response, operation if block_given?
|
280
|
+
end
|
281
|
+
rescue ::GRPC::BadStatus => e
|
282
|
+
raise ::Google::Cloud::Error.from_error(e)
|
283
|
+
end
|
284
|
+
|
285
|
+
##
|
286
|
+
# Generates grounded content.
|
287
|
+
#
|
288
|
+
# @overload generate_grounded_content(request, options = nil)
|
289
|
+
# Pass arguments to `generate_grounded_content` via a request object, either of type
|
290
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest} or an equivalent Hash.
|
291
|
+
#
|
292
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest, ::Hash]
|
293
|
+
# A request object representing the call parameters. Required. To specify no
|
294
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
295
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
296
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
297
|
+
#
|
298
|
+
# @overload generate_grounded_content(location: nil, system_instruction: nil, contents: nil, generation_spec: nil, grounding_spec: nil, user_labels: nil)
|
299
|
+
# Pass arguments to `generate_grounded_content` via keyword arguments. Note that at
|
300
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
301
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
302
|
+
#
|
303
|
+
# @param location [::String]
|
304
|
+
# Required. Location resource.
|
305
|
+
#
|
306
|
+
# Format: `projects/{project}/locations/{location}`.
|
307
|
+
# @param system_instruction [::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationContent, ::Hash]
|
308
|
+
# Content of the system instruction for the current API.
|
309
|
+
#
|
310
|
+
# These instructions will take priority over any other prompt instructions
|
311
|
+
# if the selected model is supporting them.
|
312
|
+
# @param contents [::Array<::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationContent, ::Hash>]
|
313
|
+
# Content of the current conversation with the model.
|
314
|
+
#
|
315
|
+
# For single-turn queries, this is a single instance. For multi-turn queries,
|
316
|
+
# this is a repeated field that contains conversation history + latest
|
317
|
+
# request.
|
318
|
+
# @param generation_spec [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest::GenerationSpec, ::Hash]
|
319
|
+
# Content generation specification.
|
320
|
+
# @param grounding_spec [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest::GroundingSpec, ::Hash]
|
321
|
+
# Grounding specification.
|
322
|
+
# @param user_labels [::Hash{::String => ::String}]
|
323
|
+
# The user labels applied to a resource must meet the following requirements:
|
324
|
+
#
|
325
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
326
|
+
# * Each label must be a key-value pair.
|
327
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
328
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
329
|
+
# length of 63 characters.
|
330
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
331
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
332
|
+
# international characters are allowed.
|
333
|
+
# * The key portion of a label must be unique. However, you can use the same
|
334
|
+
# key with multiple resources.
|
335
|
+
# * Keys must start with a lowercase letter or international character.
|
336
|
+
#
|
337
|
+
# See [Google Cloud
|
338
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
339
|
+
# for more details.
|
340
|
+
#
|
341
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
342
|
+
# @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse]
|
343
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
344
|
+
#
|
345
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse]
|
346
|
+
#
|
347
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
348
|
+
#
|
349
|
+
# @example Basic example
|
350
|
+
# require "google/cloud/discovery_engine/v1beta"
|
351
|
+
#
|
352
|
+
# # Create a client object. The client can be reused for multiple calls.
|
353
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Client.new
|
354
|
+
#
|
355
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
356
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest.new
|
357
|
+
#
|
358
|
+
# # Call the generate_grounded_content method.
|
359
|
+
# result = client.generate_grounded_content request
|
360
|
+
#
|
361
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse.
|
362
|
+
# p result
|
363
|
+
#
|
364
|
+
def generate_grounded_content request, options = nil
|
365
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
366
|
+
|
367
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest
|
368
|
+
|
369
|
+
# Converts hash and nil to an options object
|
370
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
371
|
+
|
372
|
+
# Customize the options with defaults
|
373
|
+
metadata = @config.rpcs.generate_grounded_content.metadata.to_h
|
374
|
+
|
375
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
376
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
377
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
378
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
|
379
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
380
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
381
|
+
|
382
|
+
header_params = {}
|
383
|
+
if request.location
|
384
|
+
header_params["location"] = request.location
|
385
|
+
end
|
386
|
+
|
387
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
388
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
389
|
+
|
390
|
+
options.apply_defaults timeout: @config.rpcs.generate_grounded_content.timeout,
|
391
|
+
metadata: metadata,
|
392
|
+
retry_policy: @config.rpcs.generate_grounded_content.retry_policy
|
393
|
+
|
394
|
+
options.apply_defaults timeout: @config.timeout,
|
395
|
+
metadata: @config.metadata,
|
396
|
+
retry_policy: @config.retry_policy
|
397
|
+
|
398
|
+
@grounded_generation_service_stub.call_rpc :generate_grounded_content, request, options: options do |response, operation|
|
399
|
+
yield response, operation if block_given?
|
400
|
+
end
|
401
|
+
rescue ::GRPC::BadStatus => e
|
402
|
+
raise ::Google::Cloud::Error.from_error(e)
|
403
|
+
end
|
404
|
+
|
186
405
|
##
|
187
406
|
# Performs a grounding check.
|
188
407
|
#
|
@@ -205,7 +424,7 @@ module Google
|
|
205
424
|
# Required. The resource name of the grounding config, such as
|
206
425
|
# `projects/*/locations/global/groundingConfigs/default_grounding_config`.
|
207
426
|
# @param answer_candidate [::String]
|
208
|
-
# Answer candidate to check.
|
427
|
+
# Answer candidate to check. It can have a maximum length of 4096 tokens.
|
209
428
|
# @param facts [::Array<::Google::Cloud::DiscoveryEngine::V1beta::GroundingFact, ::Hash>]
|
210
429
|
# List of facts for the grounding check.
|
211
430
|
# We support up to 200 facts.
|
@@ -289,7 +508,6 @@ module Google
|
|
289
508
|
|
290
509
|
@grounded_generation_service_stub.call_rpc :check_grounding, request, options: options do |response, operation|
|
291
510
|
yield response, operation if block_given?
|
292
|
-
return response
|
293
511
|
end
|
294
512
|
rescue ::GRPC::BadStatus => e
|
295
513
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -311,17 +529,17 @@ module Google
|
|
311
529
|
# @example
|
312
530
|
#
|
313
531
|
# # Modify the global config, setting the timeout for
|
314
|
-
# #
|
532
|
+
# # stream_generate_grounded_content to 20 seconds,
|
315
533
|
# # and all remaining timeouts to 10 seconds.
|
316
534
|
# ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Client.configure do |config|
|
317
535
|
# config.timeout = 10.0
|
318
|
-
# config.rpcs.
|
536
|
+
# config.rpcs.stream_generate_grounded_content.timeout = 20.0
|
319
537
|
# end
|
320
538
|
#
|
321
539
|
# # Apply the above configuration only to a new client.
|
322
540
|
# client = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Client.new do |config|
|
323
541
|
# config.timeout = 10.0
|
324
|
-
# config.rpcs.
|
542
|
+
# config.rpcs.stream_generate_grounded_content.timeout = 20.0
|
325
543
|
# end
|
326
544
|
#
|
327
545
|
# @!attribute [rw] endpoint
|
@@ -378,6 +596,11 @@ module Google
|
|
378
596
|
# default endpoint URL. The default value of nil uses the environment
|
379
597
|
# universe (usually the default "googleapis.com" universe).
|
380
598
|
# @return [::String,nil]
|
599
|
+
# @!attribute [rw] logger
|
600
|
+
# A custom logger to use for request/response debug logging, or the value
|
601
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
602
|
+
# explicitly disable logging.
|
603
|
+
# @return [::Logger,:default,nil]
|
381
604
|
#
|
382
605
|
class Configuration
|
383
606
|
extend ::Gapic::Config
|
@@ -402,6 +625,7 @@ module Google
|
|
402
625
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
403
626
|
config_attr :quota_project, nil, ::String, nil
|
404
627
|
config_attr :universe_domain, nil, ::String, nil
|
628
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
405
629
|
|
406
630
|
# @private
|
407
631
|
def initialize parent_config = nil
|
@@ -448,6 +672,16 @@ module Google
|
|
448
672
|
# trigger a retry.
|
449
673
|
#
|
450
674
|
class Rpcs
|
675
|
+
##
|
676
|
+
# RPC-specific configuration for `stream_generate_grounded_content`
|
677
|
+
# @return [::Gapic::Config::Method]
|
678
|
+
#
|
679
|
+
attr_reader :stream_generate_grounded_content
|
680
|
+
##
|
681
|
+
# RPC-specific configuration for `generate_grounded_content`
|
682
|
+
# @return [::Gapic::Config::Method]
|
683
|
+
#
|
684
|
+
attr_reader :generate_grounded_content
|
451
685
|
##
|
452
686
|
# RPC-specific configuration for `check_grounding`
|
453
687
|
# @return [::Gapic::Config::Method]
|
@@ -456,6 +690,10 @@ module Google
|
|
456
690
|
|
457
691
|
# @private
|
458
692
|
def initialize parent_rpcs = nil
|
693
|
+
stream_generate_grounded_content_config = parent_rpcs.stream_generate_grounded_content if parent_rpcs.respond_to? :stream_generate_grounded_content
|
694
|
+
@stream_generate_grounded_content = ::Gapic::Config::Method.new stream_generate_grounded_content_config
|
695
|
+
generate_grounded_content_config = parent_rpcs.generate_grounded_content if parent_rpcs.respond_to? :generate_grounded_content
|
696
|
+
@generate_grounded_content = ::Gapic::Config::Method.new generate_grounded_content_config
|
459
697
|
check_grounding_config = parent_rpcs.check_grounding if parent_rpcs.respond_to? :check_grounding
|
460
698
|
@check_grounding = ::Gapic::Config::Method.new check_grounding_config
|
461
699
|
|
@@ -43,6 +43,91 @@ module Google
|
|
43
43
|
"projects/#{project}/locations/#{location}/groundingConfigs/#{grounding_config}"
|
44
44
|
end
|
45
45
|
|
46
|
+
##
|
47
|
+
# Create a fully-qualified Location resource string.
|
48
|
+
#
|
49
|
+
# The resource will be in the following format:
|
50
|
+
#
|
51
|
+
# `projects/{project}/locations/{location}`
|
52
|
+
#
|
53
|
+
# @param project [String]
|
54
|
+
# @param location [String]
|
55
|
+
#
|
56
|
+
# @return [::String]
|
57
|
+
def location_path project:, location:
|
58
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
59
|
+
|
60
|
+
"projects/#{project}/locations/#{location}"
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Create a fully-qualified ServingConfig resource string.
|
65
|
+
#
|
66
|
+
# @overload serving_config_path(project:, location:, data_store:, serving_config:)
|
67
|
+
# The resource will be in the following format:
|
68
|
+
#
|
69
|
+
# `projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}`
|
70
|
+
#
|
71
|
+
# @param project [String]
|
72
|
+
# @param location [String]
|
73
|
+
# @param data_store [String]
|
74
|
+
# @param serving_config [String]
|
75
|
+
#
|
76
|
+
# @overload serving_config_path(project:, location:, collection:, data_store:, serving_config:)
|
77
|
+
# The resource will be in the following format:
|
78
|
+
#
|
79
|
+
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}`
|
80
|
+
#
|
81
|
+
# @param project [String]
|
82
|
+
# @param location [String]
|
83
|
+
# @param collection [String]
|
84
|
+
# @param data_store [String]
|
85
|
+
# @param serving_config [String]
|
86
|
+
#
|
87
|
+
# @overload serving_config_path(project:, location:, collection:, engine:, serving_config:)
|
88
|
+
# The resource will be in the following format:
|
89
|
+
#
|
90
|
+
# `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config}`
|
91
|
+
#
|
92
|
+
# @param project [String]
|
93
|
+
# @param location [String]
|
94
|
+
# @param collection [String]
|
95
|
+
# @param engine [String]
|
96
|
+
# @param serving_config [String]
|
97
|
+
#
|
98
|
+
# @return [::String]
|
99
|
+
def serving_config_path **args
|
100
|
+
resources = {
|
101
|
+
"data_store:location:project:serving_config" => (proc do |project:, location:, data_store:, serving_config:|
|
102
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
103
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
104
|
+
raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
|
105
|
+
|
106
|
+
"projects/#{project}/locations/#{location}/dataStores/#{data_store}/servingConfigs/#{serving_config}"
|
107
|
+
end),
|
108
|
+
"collection:data_store:location:project:serving_config" => (proc do |project:, location:, collection:, data_store:, serving_config:|
|
109
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
110
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
111
|
+
raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
|
112
|
+
raise ::ArgumentError, "data_store cannot contain /" if data_store.to_s.include? "/"
|
113
|
+
|
114
|
+
"projects/#{project}/locations/#{location}/collections/#{collection}/dataStores/#{data_store}/servingConfigs/#{serving_config}"
|
115
|
+
end),
|
116
|
+
"collection:engine:location:project:serving_config" => (proc do |project:, location:, collection:, engine:, serving_config:|
|
117
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
118
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
119
|
+
raise ::ArgumentError, "collection cannot contain /" if collection.to_s.include? "/"
|
120
|
+
raise ::ArgumentError, "engine cannot contain /" if engine.to_s.include? "/"
|
121
|
+
|
122
|
+
"projects/#{project}/locations/#{location}/collections/#{collection}/engines/#{engine}/servingConfigs/#{serving_config}"
|
123
|
+
end)
|
124
|
+
}
|
125
|
+
|
126
|
+
resource = resources[args.keys.sort.join(":")]
|
127
|
+
raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
|
128
|
+
resource.call(**args)
|
129
|
+
end
|
130
|
+
|
46
131
|
extend self
|
47
132
|
end
|
48
133
|
end
|
@@ -156,14 +156,26 @@ module Google
|
|
156
156
|
endpoint: @config.endpoint,
|
157
157
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
158
158
|
universe_domain: @config.universe_domain,
|
159
|
-
credentials: credentials
|
159
|
+
credentials: credentials,
|
160
|
+
logger: @config.logger
|
160
161
|
)
|
161
162
|
|
163
|
+
@grounded_generation_service_stub.logger(stub: true)&.info do |entry|
|
164
|
+
entry.set_system_name
|
165
|
+
entry.set_service
|
166
|
+
entry.message = "Created client for #{entry.service}"
|
167
|
+
entry.set_credentials_fields credentials
|
168
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
169
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
170
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
171
|
+
end
|
172
|
+
|
162
173
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
163
174
|
config.credentials = credentials
|
164
175
|
config.quota_project = @quota_project_id
|
165
176
|
config.endpoint = @grounded_generation_service_stub.endpoint
|
166
177
|
config.universe_domain = @grounded_generation_service_stub.universe_domain
|
178
|
+
config.logger = @grounded_generation_service_stub.logger if config.respond_to? :logger=
|
167
179
|
end
|
168
180
|
end
|
169
181
|
|
@@ -174,8 +186,130 @@ module Google
|
|
174
186
|
#
|
175
187
|
attr_reader :location_client
|
176
188
|
|
189
|
+
##
|
190
|
+
# The logger used for request/response debug logging.
|
191
|
+
#
|
192
|
+
# @return [Logger]
|
193
|
+
#
|
194
|
+
def logger
|
195
|
+
@grounded_generation_service_stub.logger
|
196
|
+
end
|
197
|
+
|
177
198
|
# Service calls
|
178
199
|
|
200
|
+
##
|
201
|
+
# Generates grounded content.
|
202
|
+
#
|
203
|
+
# @overload generate_grounded_content(request, options = nil)
|
204
|
+
# Pass arguments to `generate_grounded_content` via a request object, either of type
|
205
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest} or an equivalent Hash.
|
206
|
+
#
|
207
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest, ::Hash]
|
208
|
+
# A request object representing the call parameters. Required. To specify no
|
209
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
210
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
211
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
212
|
+
#
|
213
|
+
# @overload generate_grounded_content(location: nil, system_instruction: nil, contents: nil, generation_spec: nil, grounding_spec: nil, user_labels: nil)
|
214
|
+
# Pass arguments to `generate_grounded_content` via keyword arguments. Note that at
|
215
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
216
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
217
|
+
#
|
218
|
+
# @param location [::String]
|
219
|
+
# Required. Location resource.
|
220
|
+
#
|
221
|
+
# Format: `projects/{project}/locations/{location}`.
|
222
|
+
# @param system_instruction [::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationContent, ::Hash]
|
223
|
+
# Content of the system instruction for the current API.
|
224
|
+
#
|
225
|
+
# These instructions will take priority over any other prompt instructions
|
226
|
+
# if the selected model is supporting them.
|
227
|
+
# @param contents [::Array<::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationContent, ::Hash>]
|
228
|
+
# Content of the current conversation with the model.
|
229
|
+
#
|
230
|
+
# For single-turn queries, this is a single instance. For multi-turn queries,
|
231
|
+
# this is a repeated field that contains conversation history + latest
|
232
|
+
# request.
|
233
|
+
# @param generation_spec [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest::GenerationSpec, ::Hash]
|
234
|
+
# Content generation specification.
|
235
|
+
# @param grounding_spec [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest::GroundingSpec, ::Hash]
|
236
|
+
# Grounding specification.
|
237
|
+
# @param user_labels [::Hash{::String => ::String}]
|
238
|
+
# The user labels applied to a resource must meet the following requirements:
|
239
|
+
#
|
240
|
+
# * Each resource can have multiple labels, up to a maximum of 64.
|
241
|
+
# * Each label must be a key-value pair.
|
242
|
+
# * Keys have a minimum length of 1 character and a maximum length of 63
|
243
|
+
# characters and cannot be empty. Values can be empty and have a maximum
|
244
|
+
# length of 63 characters.
|
245
|
+
# * Keys and values can contain only lowercase letters, numeric characters,
|
246
|
+
# underscores, and dashes. All characters must use UTF-8 encoding, and
|
247
|
+
# international characters are allowed.
|
248
|
+
# * The key portion of a label must be unique. However, you can use the same
|
249
|
+
# key with multiple resources.
|
250
|
+
# * Keys must start with a lowercase letter or international character.
|
251
|
+
#
|
252
|
+
# See [Google Cloud
|
253
|
+
# Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
|
254
|
+
# for more details.
|
255
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
256
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse]
|
257
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
258
|
+
#
|
259
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse]
|
260
|
+
#
|
261
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
262
|
+
#
|
263
|
+
# @example Basic example
|
264
|
+
# require "google/cloud/discovery_engine/v1beta"
|
265
|
+
#
|
266
|
+
# # Create a client object. The client can be reused for multiple calls.
|
267
|
+
# client = Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.new
|
268
|
+
#
|
269
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
270
|
+
# request = Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest.new
|
271
|
+
#
|
272
|
+
# # Call the generate_grounded_content method.
|
273
|
+
# result = client.generate_grounded_content request
|
274
|
+
#
|
275
|
+
# # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentResponse.
|
276
|
+
# p result
|
277
|
+
#
|
278
|
+
def generate_grounded_content request, options = nil
|
279
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
280
|
+
|
281
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GenerateGroundedContentRequest
|
282
|
+
|
283
|
+
# Converts hash and nil to an options object
|
284
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
285
|
+
|
286
|
+
# Customize the options with defaults
|
287
|
+
call_metadata = @config.rpcs.generate_grounded_content.metadata.to_h
|
288
|
+
|
289
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
290
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
291
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
292
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
293
|
+
transports_version_send: [:rest]
|
294
|
+
|
295
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
296
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
297
|
+
|
298
|
+
options.apply_defaults timeout: @config.rpcs.generate_grounded_content.timeout,
|
299
|
+
metadata: call_metadata,
|
300
|
+
retry_policy: @config.rpcs.generate_grounded_content.retry_policy
|
301
|
+
|
302
|
+
options.apply_defaults timeout: @config.timeout,
|
303
|
+
metadata: @config.metadata,
|
304
|
+
retry_policy: @config.retry_policy
|
305
|
+
|
306
|
+
@grounded_generation_service_stub.generate_grounded_content request, options do |result, operation|
|
307
|
+
yield result, operation if block_given?
|
308
|
+
end
|
309
|
+
rescue ::Gapic::Rest::Error => e
|
310
|
+
raise ::Google::Cloud::Error.from_error(e)
|
311
|
+
end
|
312
|
+
|
179
313
|
##
|
180
314
|
# Performs a grounding check.
|
181
315
|
#
|
@@ -198,7 +332,7 @@ module Google
|
|
198
332
|
# Required. The resource name of the grounding config, such as
|
199
333
|
# `projects/*/locations/global/groundingConfigs/default_grounding_config`.
|
200
334
|
# @param answer_candidate [::String]
|
201
|
-
# Answer candidate to check.
|
335
|
+
# Answer candidate to check. It can have a maximum length of 4096 tokens.
|
202
336
|
# @param facts [::Array<::Google::Cloud::DiscoveryEngine::V1beta::GroundingFact, ::Hash>]
|
203
337
|
# List of facts for the grounding check.
|
204
338
|
# We support up to 200 facts.
|
@@ -275,7 +409,6 @@ module Google
|
|
275
409
|
|
276
410
|
@grounded_generation_service_stub.check_grounding request, options do |result, operation|
|
277
411
|
yield result, operation if block_given?
|
278
|
-
return result
|
279
412
|
end
|
280
413
|
rescue ::Gapic::Rest::Error => e
|
281
414
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -297,17 +430,17 @@ module Google
|
|
297
430
|
# @example
|
298
431
|
#
|
299
432
|
# # Modify the global config, setting the timeout for
|
300
|
-
# #
|
433
|
+
# # generate_grounded_content to 20 seconds,
|
301
434
|
# # and all remaining timeouts to 10 seconds.
|
302
435
|
# ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.configure do |config|
|
303
436
|
# config.timeout = 10.0
|
304
|
-
# config.rpcs.
|
437
|
+
# config.rpcs.generate_grounded_content.timeout = 20.0
|
305
438
|
# end
|
306
439
|
#
|
307
440
|
# # Apply the above configuration only to a new client.
|
308
441
|
# client = ::Google::Cloud::DiscoveryEngine::V1beta::GroundedGenerationService::Rest::Client.new do |config|
|
309
442
|
# config.timeout = 10.0
|
310
|
-
# config.rpcs.
|
443
|
+
# config.rpcs.generate_grounded_content.timeout = 20.0
|
311
444
|
# end
|
312
445
|
#
|
313
446
|
# @!attribute [rw] endpoint
|
@@ -355,6 +488,11 @@ module Google
|
|
355
488
|
# default endpoint URL. The default value of nil uses the environment
|
356
489
|
# universe (usually the default "googleapis.com" universe).
|
357
490
|
# @return [::String,nil]
|
491
|
+
# @!attribute [rw] logger
|
492
|
+
# A custom logger to use for request/response debug logging, or the value
|
493
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
494
|
+
# explicitly disable logging.
|
495
|
+
# @return [::Logger,:default,nil]
|
358
496
|
#
|
359
497
|
class Configuration
|
360
498
|
extend ::Gapic::Config
|
@@ -376,6 +514,7 @@ module Google
|
|
376
514
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
377
515
|
config_attr :quota_project, nil, ::String, nil
|
378
516
|
config_attr :universe_domain, nil, ::String, nil
|
517
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
379
518
|
|
380
519
|
# @private
|
381
520
|
def initialize parent_config = nil
|
@@ -414,6 +553,11 @@ module Google
|
|
414
553
|
# trigger a retry.
|
415
554
|
#
|
416
555
|
class Rpcs
|
556
|
+
##
|
557
|
+
# RPC-specific configuration for `generate_grounded_content`
|
558
|
+
# @return [::Gapic::Config::Method]
|
559
|
+
#
|
560
|
+
attr_reader :generate_grounded_content
|
417
561
|
##
|
418
562
|
# RPC-specific configuration for `check_grounding`
|
419
563
|
# @return [::Gapic::Config::Method]
|
@@ -422,6 +566,8 @@ module Google
|
|
422
566
|
|
423
567
|
# @private
|
424
568
|
def initialize parent_rpcs = nil
|
569
|
+
generate_grounded_content_config = parent_rpcs.generate_grounded_content if parent_rpcs.respond_to? :generate_grounded_content
|
570
|
+
@generate_grounded_content = ::Gapic::Config::Method.new generate_grounded_content_config
|
425
571
|
check_grounding_config = parent_rpcs.check_grounding if parent_rpcs.respond_to? :check_grounding
|
426
572
|
@check_grounding = ::Gapic::Config::Method.new check_grounding_config
|
427
573
|
|