google-cloud-ai_platform-v1 0.27.0 → 0.29.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1555acd4a72deb70df0daf713aa449b3565bab50d1d2b81ba8a44cf56bd6f91a
4
- data.tar.gz: 6ada0b556e610fe1d52e28b2480e2cd7d1aa99f72e83f977ba06421525314f5c
3
+ metadata.gz: feb5a1ea6d2106d041c6c40dbcd256d503edf586b3fb0af80537e8cf87e4f435
4
+ data.tar.gz: 27220fe8c85ffdb47735718a69f149d2179fcab0dfb7b7fa84e598fcd356df13
5
5
  SHA512:
6
- metadata.gz: cfb8967df79c8d5217f877609fcf56c447cce943a5b5f36a34286f5673dc70e50806bdccd39ecdf40a97468a9347238c281fed695f541828a1fd687ad85c8490
7
- data.tar.gz: bc42bc22cb2cfb3fcfe8b852cfdf69c6d3c4a02b572eed8cc4bbed829b370a8c7e30e202a7edcf9c8a02c8a4f8aa6bbfb98fd2ee1ecc757d3c8f8aa0c022e006
6
+ metadata.gz: c61c61245aef652a959dbdcaa716da7bc504e3e947b1417dfa3f80b51ead053f446b735b9a6ec4dae4f0d3195c7161d4e604df8d54ed6db5a3805a993ba0fc93
7
+ data.tar.gz: 85efd35cb73a5c4d6102f8659201db0ed7106d71f1a144d4f20d06c74e28164b2c8d5e2e0a649de13ecc848eed64d15da3ca74ead1d57982892b2ab482f4ad11
@@ -388,6 +388,101 @@ module Google
388
388
  raise ::Google::Cloud::Error.from_error(e)
389
389
  end
390
390
 
391
+ ##
392
+ # Perform a server-side streaming online prediction request for Vertex
393
+ # LLM streaming.
394
+ #
395
+ # @overload server_streaming_predict(request, options = nil)
396
+ # Pass arguments to `server_streaming_predict` via a request object, either of type
397
+ # {::Google::Cloud::AIPlatform::V1::StreamingPredictRequest} or an equivalent Hash.
398
+ #
399
+ # @param request [::Google::Cloud::AIPlatform::V1::StreamingPredictRequest, ::Hash]
400
+ # A request object representing the call parameters. Required. To specify no
401
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
402
+ # @param options [::Gapic::CallOptions, ::Hash]
403
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
404
+ #
405
+ # @overload server_streaming_predict(endpoint: nil, inputs: nil, parameters: nil)
406
+ # Pass arguments to `server_streaming_predict` via keyword arguments. Note that at
407
+ # least one keyword argument is required. To specify no parameters, or to keep all
408
+ # the default parameter values, pass an empty Hash as a request object (see above).
409
+ #
410
+ # @param endpoint [::String]
411
+ # Required. The name of the Endpoint requested to serve the prediction.
412
+ # Format:
413
+ # `projects/{project}/locations/{location}/endpoints/{endpoint}`
414
+ # @param inputs [::Array<::Google::Cloud::AIPlatform::V1::Tensor, ::Hash>]
415
+ # The prediction input.
416
+ # @param parameters [::Google::Cloud::AIPlatform::V1::Tensor, ::Hash]
417
+ # The parameters that govern the prediction.
418
+ #
419
+ # @yield [response, operation] Access the result along with the RPC operation
420
+ # @yieldparam response [::Enumerable<::Google::Cloud::AIPlatform::V1::StreamingPredictResponse>]
421
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
422
+ #
423
+ # @return [::Enumerable<::Google::Cloud::AIPlatform::V1::StreamingPredictResponse>]
424
+ #
425
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
426
+ #
427
+ # @example Basic example
428
+ # require "google/cloud/ai_platform/v1"
429
+ #
430
+ # # Create a client object. The client can be reused for multiple calls.
431
+ # client = Google::Cloud::AIPlatform::V1::PredictionService::Client.new
432
+ #
433
+ # # Create a request. To set request fields, pass in keyword arguments.
434
+ # request = Google::Cloud::AIPlatform::V1::StreamingPredictRequest.new
435
+ #
436
+ # # Call the server_streaming_predict method to start streaming.
437
+ # output = client.server_streaming_predict request
438
+ #
439
+ # # The returned object is a streamed enumerable yielding elements of type
440
+ # # ::Google::Cloud::AIPlatform::V1::StreamingPredictResponse
441
+ # output.each do |current_response|
442
+ # p current_response
443
+ # end
444
+ #
445
+ def server_streaming_predict request, options = nil
446
+ raise ::ArgumentError, "request must be provided" if request.nil?
447
+
448
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::StreamingPredictRequest
449
+
450
+ # Converts hash and nil to an options object
451
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
452
+
453
+ # Customize the options with defaults
454
+ metadata = @config.rpcs.server_streaming_predict.metadata.to_h
455
+
456
+ # Set x-goog-api-client and x-goog-user-project headers
457
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
458
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
459
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
460
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
461
+
462
+ header_params = {}
463
+ if request.endpoint
464
+ header_params["endpoint"] = request.endpoint
465
+ end
466
+
467
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
468
+ metadata[:"x-goog-request-params"] ||= request_params_header
469
+
470
+ options.apply_defaults timeout: @config.rpcs.server_streaming_predict.timeout,
471
+ metadata: metadata,
472
+ retry_policy: @config.rpcs.server_streaming_predict.retry_policy
473
+
474
+ options.apply_defaults timeout: @config.timeout,
475
+ metadata: @config.metadata,
476
+ retry_policy: @config.retry_policy
477
+
478
+ @prediction_service_stub.call_rpc :server_streaming_predict, request, options: options do |response, operation|
479
+ yield response, operation if block_given?
480
+ return response
481
+ end
482
+ rescue ::GRPC::BadStatus => e
483
+ raise ::Google::Cloud::Error.from_error(e)
484
+ end
485
+
391
486
  ##
392
487
  # Perform an online explanation.
393
488
  #
@@ -662,6 +757,11 @@ module Google
662
757
  #
663
758
  attr_reader :raw_predict
664
759
  ##
760
+ # RPC-specific configuration for `server_streaming_predict`
761
+ # @return [::Gapic::Config::Method]
762
+ #
763
+ attr_reader :server_streaming_predict
764
+ ##
665
765
  # RPC-specific configuration for `explain`
666
766
  # @return [::Gapic::Config::Method]
667
767
  #
@@ -673,6 +773,8 @@ module Google
673
773
  @predict = ::Gapic::Config::Method.new predict_config
674
774
  raw_predict_config = parent_rpcs.raw_predict if parent_rpcs.respond_to? :raw_predict
675
775
  @raw_predict = ::Gapic::Config::Method.new raw_predict_config
776
+ server_streaming_predict_config = parent_rpcs.server_streaming_predict if parent_rpcs.respond_to? :server_streaming_predict
777
+ @server_streaming_predict = ::Gapic::Config::Method.new server_streaming_predict_config
676
778
  explain_config = parent_rpcs.explain if parent_rpcs.respond_to? :explain
677
779
  @explain = ::Gapic::Config::Method.new explain_config
678
780