google-cloud-ai_platform-v1 1.40.0 → 1.42.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.
@@ -148,6 +148,13 @@ module Google
148
148
  @quota_project_id = @config.quota_project
149
149
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
150
 
151
+ @operations_client = ::Google::Cloud::AIPlatform::V1::ReasoningEngineExecutionService::Rest::Operations.new do |config|
152
+ config.credentials = credentials
153
+ config.quota_project = @quota_project_id
154
+ config.endpoint = @config.endpoint
155
+ config.universe_domain = @config.universe_domain
156
+ end
157
+
151
158
  @reasoning_engine_execution_service_stub = ::Google::Cloud::AIPlatform::V1::ReasoningEngineExecutionService::Rest::ServiceStub.new(
152
159
  endpoint: @config.endpoint,
153
160
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
@@ -185,6 +192,13 @@ module Google
185
192
  end
186
193
  end
187
194
 
195
+ ##
196
+ # Get the associated client for long-running operations.
197
+ #
198
+ # @return [::Google::Cloud::AIPlatform::V1::ReasoningEngineExecutionService::Rest::Operations]
199
+ #
200
+ attr_reader :operations_client
201
+
188
202
  ##
189
203
  # Get the associated client for mix-in of the Locations.
190
204
  #
@@ -387,6 +401,99 @@ module Google
387
401
  raise ::Google::Cloud::Error.from_error(e)
388
402
  end
389
403
 
404
+ ##
405
+ # Async query using a reasoning engine.
406
+ #
407
+ # @overload async_query_reasoning_engine(request, options = nil)
408
+ # Pass arguments to `async_query_reasoning_engine` via a request object, either of type
409
+ # {::Google::Cloud::AIPlatform::V1::AsyncQueryReasoningEngineRequest} or an equivalent Hash.
410
+ #
411
+ # @param request [::Google::Cloud::AIPlatform::V1::AsyncQueryReasoningEngineRequest, ::Hash]
412
+ # A request object representing the call parameters. Required. To specify no
413
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
414
+ # @param options [::Gapic::CallOptions, ::Hash]
415
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
416
+ #
417
+ # @overload async_query_reasoning_engine(name: nil, input_gcs_uri: nil, output_gcs_uri: nil)
418
+ # Pass arguments to `async_query_reasoning_engine` via keyword arguments. Note that at
419
+ # least one keyword argument is required. To specify no parameters, or to keep all
420
+ # the default parameter values, pass an empty Hash as a request object (see above).
421
+ #
422
+ # @param name [::String]
423
+ # Required. The name of the ReasoningEngine resource to use.
424
+ # Format:
425
+ # `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
426
+ # @param input_gcs_uri [::String]
427
+ # Optional. Input Cloud Storage URI for the Async query.
428
+ # @param output_gcs_uri [::String]
429
+ # Optional. Output Cloud Storage URI for the Async query.
430
+ # @yield [result, operation] Access the result along with the TransportOperation object
431
+ # @yieldparam result [::Gapic::Operation]
432
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
433
+ #
434
+ # @return [::Gapic::Operation]
435
+ #
436
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
437
+ #
438
+ # @example Basic example
439
+ # require "google/cloud/ai_platform/v1"
440
+ #
441
+ # # Create a client object. The client can be reused for multiple calls.
442
+ # client = Google::Cloud::AIPlatform::V1::ReasoningEngineExecutionService::Rest::Client.new
443
+ #
444
+ # # Create a request. To set request fields, pass in keyword arguments.
445
+ # request = Google::Cloud::AIPlatform::V1::AsyncQueryReasoningEngineRequest.new
446
+ #
447
+ # # Call the async_query_reasoning_engine method.
448
+ # result = client.async_query_reasoning_engine request
449
+ #
450
+ # # The returned object is of type Gapic::Operation. You can use it to
451
+ # # check the status of an operation, cancel it, or wait for results.
452
+ # # Here is how to wait for a response.
453
+ # result.wait_until_done! timeout: 60
454
+ # if result.response?
455
+ # p result.response
456
+ # else
457
+ # puts "No response received."
458
+ # end
459
+ #
460
+ def async_query_reasoning_engine request, options = nil
461
+ raise ::ArgumentError, "request must be provided" if request.nil?
462
+
463
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::AsyncQueryReasoningEngineRequest
464
+
465
+ # Converts hash and nil to an options object
466
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
467
+
468
+ # Customize the options with defaults
469
+ call_metadata = @config.rpcs.async_query_reasoning_engine.metadata.to_h
470
+
471
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
472
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
473
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
474
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
475
+ transports_version_send: [:rest]
476
+
477
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
478
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
479
+
480
+ options.apply_defaults timeout: @config.rpcs.async_query_reasoning_engine.timeout,
481
+ metadata: call_metadata,
482
+ retry_policy: @config.rpcs.async_query_reasoning_engine.retry_policy
483
+
484
+ options.apply_defaults timeout: @config.timeout,
485
+ metadata: @config.metadata,
486
+ retry_policy: @config.retry_policy
487
+
488
+ @reasoning_engine_execution_service_stub.async_query_reasoning_engine request, options do |result, operation|
489
+ result = ::Gapic::Operation.new result, @operations_client, options: options
490
+ yield result, operation if block_given?
491
+ throw :response, result
492
+ end
493
+ rescue ::Gapic::Rest::Error => e
494
+ raise ::Google::Cloud::Error.from_error(e)
495
+ end
496
+
390
497
  ##
391
498
  # Configuration class for the ReasoningEngineExecutionService REST API.
392
499
  #
@@ -550,6 +657,11 @@ module Google
550
657
  # @return [::Gapic::Config::Method]
551
658
  #
552
659
  attr_reader :stream_query_reasoning_engine
660
+ ##
661
+ # RPC-specific configuration for `async_query_reasoning_engine`
662
+ # @return [::Gapic::Config::Method]
663
+ #
664
+ attr_reader :async_query_reasoning_engine
553
665
 
554
666
  # @private
555
667
  def initialize parent_rpcs = nil
@@ -557,6 +669,8 @@ module Google
557
669
  @query_reasoning_engine = ::Gapic::Config::Method.new query_reasoning_engine_config
558
670
  stream_query_reasoning_engine_config = parent_rpcs.stream_query_reasoning_engine if parent_rpcs.respond_to? :stream_query_reasoning_engine
559
671
  @stream_query_reasoning_engine = ::Gapic::Config::Method.new stream_query_reasoning_engine_config
672
+ async_query_reasoning_engine_config = parent_rpcs.async_query_reasoning_engine if parent_rpcs.respond_to? :async_query_reasoning_engine
673
+ @async_query_reasoning_engine = ::Gapic::Config::Method.new async_query_reasoning_engine_config
560
674
 
561
675
  yield self if block_given?
562
676
  end