google-cloud-ai_platform-v1 1.15.0 → 1.16.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.
- checksums.yaml +4 -4
- data/lib/google/cloud/ai_platform/v1/model_garden_service/client.rb +137 -0
- data/lib/google/cloud/ai_platform/v1/model_garden_service/operations.rb +821 -0
- data/lib/google/cloud/ai_platform/v1/model_garden_service/paths.rb +36 -0
- data/lib/google/cloud/ai_platform/v1/model_garden_service/rest/client.rb +130 -0
- data/lib/google/cloud/ai_platform/v1/model_garden_service/rest/operations.rb +4398 -0
- data/lib/google/cloud/ai_platform/v1/model_garden_service/rest/service_stub.rb +62 -0
- data/lib/google/cloud/ai_platform/v1/model_garden_service/rest.rb +1 -0
- data/lib/google/cloud/ai_platform/v1/model_garden_service.rb +1 -0
- data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/client.rb +198 -0
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/paths.rb +17 -0
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest/client.rb +184 -0
- data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest/service_stub.rb +123 -0
- data/lib/google/cloud/aiplatform/v1/endpoint_pb.rb +3 -1
- data/lib/google/cloud/aiplatform/v1/model_garden_service_pb.rb +14 -1
- data/lib/google/cloud/aiplatform/v1/model_garden_service_services_pb.rb +2 -0
- data/lib/google/cloud/aiplatform/v1/service_networking_pb.rb +3 -1
- data/lib/google/cloud/aiplatform/v1/vertex_rag_data_pb.rb +6 -1
- data/lib/google/cloud/aiplatform/v1/vertex_rag_data_service_pb.rb +4 -1
- data/lib/google/cloud/aiplatform/v1/vertex_rag_data_service_services_pb.rb +4 -0
- data/proto_docs/google/cloud/aiplatform/v1/endpoint.rb +31 -6
- data/proto_docs/google/cloud/aiplatform/v1/model_garden_service.rb +153 -0
- data/proto_docs/google/cloud/aiplatform/v1/service_networking.rb +61 -5
- data/proto_docs/google/cloud/aiplatform/v1/vertex_rag_data.rb +67 -0
- data/proto_docs/google/cloud/aiplatform/v1/vertex_rag_data_service.rb +35 -0
- metadata +3 -1
@@ -24,6 +24,23 @@ module Google
|
|
24
24
|
module ModelGardenService
|
25
25
|
# Path helper methods for the ModelGardenService API.
|
26
26
|
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Location resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
#
|
37
|
+
# @return [::String]
|
38
|
+
def location_path project:, location:
|
39
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
40
|
+
|
41
|
+
"projects/#{project}/locations/#{location}"
|
42
|
+
end
|
43
|
+
|
27
44
|
##
|
28
45
|
# Create a fully-qualified PublisherModel resource string.
|
29
46
|
#
|
@@ -41,6 +58,25 @@ module Google
|
|
41
58
|
"publishers/#{publisher}/models/#{model}"
|
42
59
|
end
|
43
60
|
|
61
|
+
##
|
62
|
+
# Create a fully-qualified Reservation resource string.
|
63
|
+
#
|
64
|
+
# The resource will be in the following format:
|
65
|
+
#
|
66
|
+
# `projects/{project_id_or_number}/zones/{zone}/reservations/{reservation_name}`
|
67
|
+
#
|
68
|
+
# @param project_id_or_number [String]
|
69
|
+
# @param zone [String]
|
70
|
+
# @param reservation_name [String]
|
71
|
+
#
|
72
|
+
# @return [::String]
|
73
|
+
def reservation_path project_id_or_number:, zone:, reservation_name:
|
74
|
+
raise ::ArgumentError, "project_id_or_number cannot contain /" if project_id_or_number.to_s.include? "/"
|
75
|
+
raise ::ArgumentError, "zone cannot contain /" if zone.to_s.include? "/"
|
76
|
+
|
77
|
+
"projects/#{project_id_or_number}/zones/#{zone}/reservations/#{reservation_name}"
|
78
|
+
end
|
79
|
+
|
44
80
|
extend self
|
45
81
|
end
|
46
82
|
end
|
@@ -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::ModelGardenService::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
|
@model_garden_service_stub = ::Google::Cloud::AIPlatform::V1::ModelGardenService::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::ModelGardenService::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
|
#
|
@@ -300,6 +314,115 @@ module Google
|
|
300
314
|
raise ::Google::Cloud::Error.from_error(e)
|
301
315
|
end
|
302
316
|
|
317
|
+
##
|
318
|
+
# Deploys a model to a new endpoint.
|
319
|
+
#
|
320
|
+
# @overload deploy(request, options = nil)
|
321
|
+
# Pass arguments to `deploy` via a request object, either of type
|
322
|
+
# {::Google::Cloud::AIPlatform::V1::DeployRequest} or an equivalent Hash.
|
323
|
+
#
|
324
|
+
# @param request [::Google::Cloud::AIPlatform::V1::DeployRequest, ::Hash]
|
325
|
+
# A request object representing the call parameters. Required. To specify no
|
326
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
327
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
328
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
329
|
+
#
|
330
|
+
# @overload deploy(publisher_model_name: nil, hugging_face_model_id: nil, destination: nil, model_config: nil, endpoint_config: nil, deploy_config: nil)
|
331
|
+
# Pass arguments to `deploy` via keyword arguments. Note that at
|
332
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
333
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
334
|
+
#
|
335
|
+
# @param publisher_model_name [::String]
|
336
|
+
# The Model Garden model to deploy.
|
337
|
+
# Format:
|
338
|
+
# `publishers/{publisher}/models/{publisher_model}@{version_id}`, or
|
339
|
+
# `publishers/hf-{hugging-face-author}/models/{hugging-face-model-name}@001`.
|
340
|
+
#
|
341
|
+
# Note: The following fields are mutually exclusive: `publisher_model_name`, `hugging_face_model_id`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
342
|
+
# @param hugging_face_model_id [::String]
|
343
|
+
# The Hugging Face model to deploy.
|
344
|
+
# Format: Hugging Face model ID like `google/gemma-2-2b-it`.
|
345
|
+
#
|
346
|
+
# Note: The following fields are mutually exclusive: `hugging_face_model_id`, `publisher_model_name`. If a field in that set is populated, all other fields in the set will automatically be cleared.
|
347
|
+
# @param destination [::String]
|
348
|
+
# Required. The resource name of the Location to deploy the model in.
|
349
|
+
# Format: `projects/{project}/locations/{location}`
|
350
|
+
# @param model_config [::Google::Cloud::AIPlatform::V1::DeployRequest::ModelConfig, ::Hash]
|
351
|
+
# Optional. The model config to use for the deployment.
|
352
|
+
# If not specified, the default model config will be used.
|
353
|
+
# @param endpoint_config [::Google::Cloud::AIPlatform::V1::DeployRequest::EndpointConfig, ::Hash]
|
354
|
+
# Optional. The endpoint config to use for the deployment.
|
355
|
+
# If not specified, the default endpoint config will be used.
|
356
|
+
# @param deploy_config [::Google::Cloud::AIPlatform::V1::DeployRequest::DeployConfig, ::Hash]
|
357
|
+
# Optional. The deploy config to use for the deployment.
|
358
|
+
# If not specified, the default deploy config will be used.
|
359
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
360
|
+
# @yieldparam result [::Gapic::Operation]
|
361
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
362
|
+
#
|
363
|
+
# @return [::Gapic::Operation]
|
364
|
+
#
|
365
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
366
|
+
#
|
367
|
+
# @example Basic example
|
368
|
+
# require "google/cloud/ai_platform/v1"
|
369
|
+
#
|
370
|
+
# # Create a client object. The client can be reused for multiple calls.
|
371
|
+
# client = Google::Cloud::AIPlatform::V1::ModelGardenService::Rest::Client.new
|
372
|
+
#
|
373
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
374
|
+
# request = Google::Cloud::AIPlatform::V1::DeployRequest.new
|
375
|
+
#
|
376
|
+
# # Call the deploy method.
|
377
|
+
# result = client.deploy request
|
378
|
+
#
|
379
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
380
|
+
# # check the status of an operation, cancel it, or wait for results.
|
381
|
+
# # Here is how to wait for a response.
|
382
|
+
# result.wait_until_done! timeout: 60
|
383
|
+
# if result.response?
|
384
|
+
# p result.response
|
385
|
+
# else
|
386
|
+
# puts "No response received."
|
387
|
+
# end
|
388
|
+
#
|
389
|
+
def deploy request, options = nil
|
390
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
391
|
+
|
392
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::DeployRequest
|
393
|
+
|
394
|
+
# Converts hash and nil to an options object
|
395
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
396
|
+
|
397
|
+
# Customize the options with defaults
|
398
|
+
call_metadata = @config.rpcs.deploy.metadata.to_h
|
399
|
+
|
400
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
401
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
402
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
403
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
|
404
|
+
transports_version_send: [:rest]
|
405
|
+
|
406
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
407
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
408
|
+
|
409
|
+
options.apply_defaults timeout: @config.rpcs.deploy.timeout,
|
410
|
+
metadata: call_metadata,
|
411
|
+
retry_policy: @config.rpcs.deploy.retry_policy
|
412
|
+
|
413
|
+
options.apply_defaults timeout: @config.timeout,
|
414
|
+
metadata: @config.metadata,
|
415
|
+
retry_policy: @config.retry_policy
|
416
|
+
|
417
|
+
@model_garden_service_stub.deploy request, options do |result, operation|
|
418
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
419
|
+
yield result, operation if block_given?
|
420
|
+
throw :response, result
|
421
|
+
end
|
422
|
+
rescue ::Gapic::Rest::Error => e
|
423
|
+
raise ::Google::Cloud::Error.from_error(e)
|
424
|
+
end
|
425
|
+
|
303
426
|
##
|
304
427
|
# Configuration class for the ModelGardenService REST API.
|
305
428
|
#
|
@@ -458,11 +581,18 @@ module Google
|
|
458
581
|
# @return [::Gapic::Config::Method]
|
459
582
|
#
|
460
583
|
attr_reader :get_publisher_model
|
584
|
+
##
|
585
|
+
# RPC-specific configuration for `deploy`
|
586
|
+
# @return [::Gapic::Config::Method]
|
587
|
+
#
|
588
|
+
attr_reader :deploy
|
461
589
|
|
462
590
|
# @private
|
463
591
|
def initialize parent_rpcs = nil
|
464
592
|
get_publisher_model_config = parent_rpcs.get_publisher_model if parent_rpcs.respond_to? :get_publisher_model
|
465
593
|
@get_publisher_model = ::Gapic::Config::Method.new get_publisher_model_config
|
594
|
+
deploy_config = parent_rpcs.deploy if parent_rpcs.respond_to? :deploy
|
595
|
+
@deploy = ::Gapic::Config::Method.new deploy_config
|
466
596
|
|
467
597
|
yield self if block_given?
|
468
598
|
end
|