google-cloud-ai_platform-v1 1.41.0 → 1.43.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,184 @@ 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
+
497
+ ##
498
+ # Cancels an AsyncQueryReasoningEngine operation.
499
+ #
500
+ # @overload cancel_async_query_reasoning_engine(request, options = nil)
501
+ # Pass arguments to `cancel_async_query_reasoning_engine` via a request object, either of type
502
+ # {::Google::Cloud::AIPlatform::V1::CancelAsyncQueryReasoningEngineRequest} or an equivalent Hash.
503
+ #
504
+ # @param request [::Google::Cloud::AIPlatform::V1::CancelAsyncQueryReasoningEngineRequest, ::Hash]
505
+ # A request object representing the call parameters. Required. To specify no
506
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
507
+ # @param options [::Gapic::CallOptions, ::Hash]
508
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
509
+ #
510
+ # @overload cancel_async_query_reasoning_engine(name: nil, operation_name: nil)
511
+ # Pass arguments to `cancel_async_query_reasoning_engine` via keyword arguments. Note that at
512
+ # least one keyword argument is required. To specify no parameters, or to keep all
513
+ # the default parameter values, pass an empty Hash as a request object (see above).
514
+ #
515
+ # @param name [::String]
516
+ # Required. The name of the ReasoningEngine resource to use.
517
+ # Format:
518
+ # `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}`
519
+ # @param operation_name [::String]
520
+ # Required. The name of the longrunning operation returned from
521
+ # AsyncQueryReasoningEngine.
522
+ # Format:
523
+ # `projects/{project}/locations/{location}/operations/{operation}`
524
+ # @yield [result, operation] Access the result along with the TransportOperation object
525
+ # @yieldparam result [::Google::Cloud::AIPlatform::V1::CancelAsyncQueryReasoningEngineResponse]
526
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
527
+ #
528
+ # @return [::Google::Cloud::AIPlatform::V1::CancelAsyncQueryReasoningEngineResponse]
529
+ #
530
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
531
+ #
532
+ # @example Basic example
533
+ # require "google/cloud/ai_platform/v1"
534
+ #
535
+ # # Create a client object. The client can be reused for multiple calls.
536
+ # client = Google::Cloud::AIPlatform::V1::ReasoningEngineExecutionService::Rest::Client.new
537
+ #
538
+ # # Create a request. To set request fields, pass in keyword arguments.
539
+ # request = Google::Cloud::AIPlatform::V1::CancelAsyncQueryReasoningEngineRequest.new
540
+ #
541
+ # # Call the cancel_async_query_reasoning_engine method.
542
+ # result = client.cancel_async_query_reasoning_engine request
543
+ #
544
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::CancelAsyncQueryReasoningEngineResponse.
545
+ # p result
546
+ #
547
+ def cancel_async_query_reasoning_engine request, options = nil
548
+ raise ::ArgumentError, "request must be provided" if request.nil?
549
+
550
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::CancelAsyncQueryReasoningEngineRequest
551
+
552
+ # Converts hash and nil to an options object
553
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
554
+
555
+ # Customize the options with defaults
556
+ call_metadata = @config.rpcs.cancel_async_query_reasoning_engine.metadata.to_h
557
+
558
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
559
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
560
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
561
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
562
+ transports_version_send: [:rest]
563
+
564
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
565
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
566
+
567
+ options.apply_defaults timeout: @config.rpcs.cancel_async_query_reasoning_engine.timeout,
568
+ metadata: call_metadata,
569
+ retry_policy: @config.rpcs.cancel_async_query_reasoning_engine.retry_policy
570
+
571
+ options.apply_defaults timeout: @config.timeout,
572
+ metadata: @config.metadata,
573
+ retry_policy: @config.retry_policy
574
+
575
+ @reasoning_engine_execution_service_stub.cancel_async_query_reasoning_engine request, options do |result, operation|
576
+ yield result, operation if block_given?
577
+ end
578
+ rescue ::Gapic::Rest::Error => e
579
+ raise ::Google::Cloud::Error.from_error(e)
580
+ end
581
+
390
582
  ##
391
583
  # Configuration class for the ReasoningEngineExecutionService REST API.
392
584
  #
@@ -550,6 +742,16 @@ module Google
550
742
  # @return [::Gapic::Config::Method]
551
743
  #
552
744
  attr_reader :stream_query_reasoning_engine
745
+ ##
746
+ # RPC-specific configuration for `async_query_reasoning_engine`
747
+ # @return [::Gapic::Config::Method]
748
+ #
749
+ attr_reader :async_query_reasoning_engine
750
+ ##
751
+ # RPC-specific configuration for `cancel_async_query_reasoning_engine`
752
+ # @return [::Gapic::Config::Method]
753
+ #
754
+ attr_reader :cancel_async_query_reasoning_engine
553
755
 
554
756
  # @private
555
757
  def initialize parent_rpcs = nil
@@ -557,6 +759,10 @@ module Google
557
759
  @query_reasoning_engine = ::Gapic::Config::Method.new query_reasoning_engine_config
558
760
  stream_query_reasoning_engine_config = parent_rpcs.stream_query_reasoning_engine if parent_rpcs.respond_to? :stream_query_reasoning_engine
559
761
  @stream_query_reasoning_engine = ::Gapic::Config::Method.new stream_query_reasoning_engine_config
762
+ async_query_reasoning_engine_config = parent_rpcs.async_query_reasoning_engine if parent_rpcs.respond_to? :async_query_reasoning_engine
763
+ @async_query_reasoning_engine = ::Gapic::Config::Method.new async_query_reasoning_engine_config
764
+ cancel_async_query_reasoning_engine_config = parent_rpcs.cancel_async_query_reasoning_engine if parent_rpcs.respond_to? :cancel_async_query_reasoning_engine
765
+ @cancel_async_query_reasoning_engine = ::Gapic::Config::Method.new cancel_async_query_reasoning_engine_config
560
766
 
561
767
  yield self if block_given?
562
768
  end