google-cloud-ai_platform-v1 0.52.0 → 0.54.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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/client.rb +129 -0
  3. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/operations.rb +817 -0
  4. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/paths.rb +19 -0
  5. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/client.rb +122 -0
  6. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/operations.rb +4181 -0
  7. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/service_stub.rb +60 -0
  8. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest.rb +1 -0
  9. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service.rb +1 -0
  10. data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
  11. data/lib/google/cloud/aiplatform/v1/content_pb.rb +5 -1
  12. data/lib/google/cloud/aiplatform/v1/feature_view_pb.rb +1 -1
  13. data/lib/google/cloud/aiplatform/v1/genai_tuning_service_pb.rb +8 -1
  14. data/lib/google/cloud/aiplatform/v1/genai_tuning_service_services_pb.rb +4 -0
  15. data/lib/google/cloud/aiplatform/v1/index_endpoint_pb.rb +1 -1
  16. data/lib/google/cloud/aiplatform/v1/openapi_pb.rb +1 -1
  17. data/lib/google/cloud/aiplatform/v1/prediction_service_pb.rb +1 -1
  18. data/lib/google/cloud/aiplatform/v1/service_networking_pb.rb +2 -1
  19. data/lib/google/cloud/aiplatform/v1/tool_pb.rb +3 -1
  20. data/lib/google/cloud/aiplatform/v1/tuning_job_pb.rb +2 -1
  21. data/proto_docs/google/cloud/aiplatform/v1/content.rb +62 -0
  22. data/proto_docs/google/cloud/aiplatform/v1/feature_view.rb +4 -0
  23. data/proto_docs/google/cloud/aiplatform/v1/genai_tuning_service.rb +36 -0
  24. data/proto_docs/google/cloud/aiplatform/v1/index_endpoint.rb +5 -0
  25. data/proto_docs/google/cloud/aiplatform/v1/openapi.rb +4 -0
  26. data/proto_docs/google/cloud/aiplatform/v1/prediction_service.rb +3 -0
  27. data/proto_docs/google/cloud/aiplatform/v1/service_networking.rb +18 -0
  28. data/proto_docs/google/cloud/aiplatform/v1/tool.rb +25 -0
  29. data/proto_docs/google/cloud/aiplatform/v1/tuning_job.rb +18 -1
  30. metadata +5 -3
@@ -126,6 +126,25 @@ module Google
126
126
  "projects/#{project}/locations/#{location}/models/#{model}"
127
127
  end
128
128
 
129
+ ##
130
+ # Create a fully-qualified PipelineJob resource string.
131
+ #
132
+ # The resource will be in the following format:
133
+ #
134
+ # `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`
135
+ #
136
+ # @param project [String]
137
+ # @param location [String]
138
+ # @param pipeline_job [String]
139
+ #
140
+ # @return [::String]
141
+ def pipeline_job_path project:, location:, pipeline_job:
142
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
143
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
144
+
145
+ "projects/#{project}/locations/#{location}/pipelineJobs/#{pipeline_job}"
146
+ end
147
+
129
148
  ##
130
149
  # Create a fully-qualified TuningJob resource string.
131
150
  #
@@ -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::GenAiTuningService::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
  @gen_ai_tuning_service_stub = ::Google::Cloud::AIPlatform::V1::GenAiTuningService::Rest::ServiceStub.new(
152
159
  endpoint: @config.endpoint,
153
160
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
@@ -172,6 +179,13 @@ module Google
172
179
  end
173
180
  end
174
181
 
182
+ ##
183
+ # Get the associated client for long-running operations.
184
+ #
185
+ # @return [::Google::Cloud::AIPlatform::V1::GenAiTuningService::Rest::Operations]
186
+ #
187
+ attr_reader :operations_client
188
+
175
189
  ##
176
190
  # Get the associated client for mix-in of the Locations.
177
191
  #
@@ -535,6 +549,107 @@ module Google
535
549
  raise ::Google::Cloud::Error.from_error(e)
536
550
  end
537
551
 
552
+ ##
553
+ # Rebase a TunedModel.
554
+ # Creates a LongRunningOperation that takes a legacy Tuned GenAI model
555
+ # Reference and creates a TuningJob based on newly available model.
556
+ #
557
+ # @overload rebase_tuned_model(request, options = nil)
558
+ # Pass arguments to `rebase_tuned_model` via a request object, either of type
559
+ # {::Google::Cloud::AIPlatform::V1::RebaseTunedModelRequest} or an equivalent Hash.
560
+ #
561
+ # @param request [::Google::Cloud::AIPlatform::V1::RebaseTunedModelRequest, ::Hash]
562
+ # A request object representing the call parameters. Required. To specify no
563
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
564
+ # @param options [::Gapic::CallOptions, ::Hash]
565
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
566
+ #
567
+ # @overload rebase_tuned_model(parent: nil, tuned_model_ref: nil, tuning_job: nil, artifact_destination: nil, deploy_to_same_endpoint: nil)
568
+ # Pass arguments to `rebase_tuned_model` via keyword arguments. Note that at
569
+ # least one keyword argument is required. To specify no parameters, or to keep all
570
+ # the default parameter values, pass an empty Hash as a request object (see above).
571
+ #
572
+ # @param parent [::String]
573
+ # Required. The resource name of the Location into which to rebase the Model.
574
+ # Format: `projects/{project}/locations/{location}`
575
+ # @param tuned_model_ref [::Google::Cloud::AIPlatform::V1::TunedModelRef, ::Hash]
576
+ # Required. TunedModel reference to retrieve the legacy model information.
577
+ # @param tuning_job [::Google::Cloud::AIPlatform::V1::TuningJob, ::Hash]
578
+ # Optional. The TuningJob to be updated. Users can use this TuningJob field
579
+ # to overwrite tuning configs.
580
+ # @param artifact_destination [::Google::Cloud::AIPlatform::V1::GcsDestination, ::Hash]
581
+ # Optional. The Google Cloud Storage location to write the artifacts.
582
+ # @param deploy_to_same_endpoint [::Boolean]
583
+ # Optional. By default, bison to gemini migration will always create new
584
+ # model/endpoint, but for gemini-1.0 to gemini-1.5 migration, we default
585
+ # deploy to the same endpoint. See details in this Section.
586
+ # @yield [result, operation] Access the result along with the TransportOperation object
587
+ # @yieldparam result [::Gapic::Operation]
588
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
589
+ #
590
+ # @return [::Gapic::Operation]
591
+ #
592
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
593
+ #
594
+ # @example Basic example
595
+ # require "google/cloud/ai_platform/v1"
596
+ #
597
+ # # Create a client object. The client can be reused for multiple calls.
598
+ # client = Google::Cloud::AIPlatform::V1::GenAiTuningService::Rest::Client.new
599
+ #
600
+ # # Create a request. To set request fields, pass in keyword arguments.
601
+ # request = Google::Cloud::AIPlatform::V1::RebaseTunedModelRequest.new
602
+ #
603
+ # # Call the rebase_tuned_model method.
604
+ # result = client.rebase_tuned_model request
605
+ #
606
+ # # The returned object is of type Gapic::Operation. You can use it to
607
+ # # check the status of an operation, cancel it, or wait for results.
608
+ # # Here is how to wait for a response.
609
+ # result.wait_until_done! timeout: 60
610
+ # if result.response?
611
+ # p result.response
612
+ # else
613
+ # puts "No response received."
614
+ # end
615
+ #
616
+ def rebase_tuned_model request, options = nil
617
+ raise ::ArgumentError, "request must be provided" if request.nil?
618
+
619
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::RebaseTunedModelRequest
620
+
621
+ # Converts hash and nil to an options object
622
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
623
+
624
+ # Customize the options with defaults
625
+ call_metadata = @config.rpcs.rebase_tuned_model.metadata.to_h
626
+
627
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
628
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
629
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
630
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
631
+ transports_version_send: [:rest]
632
+
633
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
634
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
635
+
636
+ options.apply_defaults timeout: @config.rpcs.rebase_tuned_model.timeout,
637
+ metadata: call_metadata,
638
+ retry_policy: @config.rpcs.rebase_tuned_model.retry_policy
639
+
640
+ options.apply_defaults timeout: @config.timeout,
641
+ metadata: @config.metadata,
642
+ retry_policy: @config.retry_policy
643
+
644
+ @gen_ai_tuning_service_stub.rebase_tuned_model request, options do |result, operation|
645
+ result = ::Gapic::Operation.new result, @operations_client, options: options
646
+ yield result, operation if block_given?
647
+ return result
648
+ end
649
+ rescue ::Gapic::Rest::Error => e
650
+ raise ::Google::Cloud::Error.from_error(e)
651
+ end
652
+
538
653
  ##
539
654
  # Configuration class for the GenAiTuningService REST API.
540
655
  #
@@ -695,6 +810,11 @@ module Google
695
810
  # @return [::Gapic::Config::Method]
696
811
  #
697
812
  attr_reader :cancel_tuning_job
813
+ ##
814
+ # RPC-specific configuration for `rebase_tuned_model`
815
+ # @return [::Gapic::Config::Method]
816
+ #
817
+ attr_reader :rebase_tuned_model
698
818
 
699
819
  # @private
700
820
  def initialize parent_rpcs = nil
@@ -706,6 +826,8 @@ module Google
706
826
  @list_tuning_jobs = ::Gapic::Config::Method.new list_tuning_jobs_config
707
827
  cancel_tuning_job_config = parent_rpcs.cancel_tuning_job if parent_rpcs.respond_to? :cancel_tuning_job
708
828
  @cancel_tuning_job = ::Gapic::Config::Method.new cancel_tuning_job_config
829
+ rebase_tuned_model_config = parent_rpcs.rebase_tuned_model if parent_rpcs.respond_to? :rebase_tuned_model
830
+ @rebase_tuned_model = ::Gapic::Config::Method.new rebase_tuned_model_config
709
831
 
710
832
  yield self if block_given?
711
833
  end