google-cloud-ai_platform-v1 0.23.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/ai_platform/v1/dataset_service/client.rb +4 -2
  3. data/lib/google/cloud/ai_platform/v1/dataset_service/operations.rb +3 -1
  4. data/lib/google/cloud/ai_platform/v1/endpoint_service/client.rb +4 -2
  5. data/lib/google/cloud/ai_platform/v1/endpoint_service/operations.rb +3 -1
  6. data/lib/google/cloud/ai_platform/v1/featurestore_online_serving_service/client.rb +4 -2
  7. data/lib/google/cloud/ai_platform/v1/featurestore_service/client.rb +5 -3
  8. data/lib/google/cloud/ai_platform/v1/featurestore_service/operations.rb +3 -1
  9. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/client.rb +4 -2
  10. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/operations.rb +3 -1
  11. data/lib/google/cloud/ai_platform/v1/index_service/client.rb +4 -2
  12. data/lib/google/cloud/ai_platform/v1/index_service/operations.rb +3 -1
  13. data/lib/google/cloud/ai_platform/v1/job_service/client.rb +4 -2
  14. data/lib/google/cloud/ai_platform/v1/job_service/operations.rb +3 -1
  15. data/lib/google/cloud/ai_platform/v1/match_service/client.rb +533 -0
  16. data/lib/google/cloud/ai_platform/v1/match_service/credentials.rb +47 -0
  17. data/lib/google/cloud/ai_platform/v1/match_service/paths.rb +52 -0
  18. data/lib/google/cloud/ai_platform/v1/match_service.rb +50 -0
  19. data/lib/google/cloud/ai_platform/v1/metadata_service/client.rb +16 -5
  20. data/lib/google/cloud/ai_platform/v1/metadata_service/operations.rb +3 -1
  21. data/lib/google/cloud/ai_platform/v1/migration_service/client.rb +4 -2
  22. data/lib/google/cloud/ai_platform/v1/migration_service/operations.rb +3 -1
  23. data/lib/google/cloud/ai_platform/v1/model_garden_service/client.rb +424 -0
  24. data/lib/google/cloud/ai_platform/v1/model_garden_service/credentials.rb +47 -0
  25. data/lib/google/cloud/ai_platform/v1/model_garden_service/paths.rb +50 -0
  26. data/lib/google/cloud/ai_platform/v1/model_garden_service.rb +49 -0
  27. data/lib/google/cloud/ai_platform/v1/model_service/client.rb +4 -2
  28. data/lib/google/cloud/ai_platform/v1/model_service/operations.rb +3 -1
  29. data/lib/google/cloud/ai_platform/v1/model_service/paths.rb +19 -0
  30. data/lib/google/cloud/ai_platform/v1/pipeline_service/client.rb +4 -2
  31. data/lib/google/cloud/ai_platform/v1/pipeline_service/operations.rb +3 -1
  32. data/lib/google/cloud/ai_platform/v1/prediction_service/client.rb +5 -4
  33. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/client.rb +4 -2
  34. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/operations.rb +3 -1
  35. data/lib/google/cloud/ai_platform/v1/tensorboard_service/client.rb +4 -2
  36. data/lib/google/cloud/ai_platform/v1/tensorboard_service/operations.rb +3 -1
  37. data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
  38. data/lib/google/cloud/ai_platform/v1/vizier_service/client.rb +6 -3
  39. data/lib/google/cloud/ai_platform/v1/vizier_service/operations.rb +3 -1
  40. data/lib/google/cloud/ai_platform/v1.rb +2 -0
  41. data/lib/google/cloud/aiplatform/v1/accelerator_type_pb.rb +24 -14
  42. data/lib/google/cloud/aiplatform/v1/annotation_pb.rb +27 -11
  43. data/lib/google/cloud/aiplatform/v1/annotation_spec_pb.rb +25 -8
  44. data/lib/google/cloud/aiplatform/v1/artifact_pb.rb +26 -20
  45. data/lib/google/cloud/aiplatform/v1/batch_prediction_job_pb.rb +34 -57
  46. data/lib/google/cloud/aiplatform/v1/completion_stats_pb.rb +24 -7
  47. data/lib/google/cloud/aiplatform/v1/context_pb.rb +26 -14
  48. data/lib/google/cloud/aiplatform/v1/custom_job_pb.rb +31 -55
  49. data/lib/google/cloud/aiplatform/v1/data_item_pb.rb +26 -9
  50. data/lib/google/cloud/aiplatform/v1/data_labeling_job_pb.rb +29 -45
  51. data/lib/google/cloud/aiplatform/v1/dataset_pb.rb +29 -37
  52. data/lib/google/cloud/aiplatform/v1/dataset_service_pb.rb +30 -121
  53. data/lib/google/cloud/aiplatform/v1/deployed_index_ref_pb.rb +24 -5
  54. data/lib/google/cloud/aiplatform/v1/deployed_model_ref_pb.rb +24 -5
  55. data/lib/google/cloud/aiplatform/v1/encryption_spec_pb.rb +24 -4
  56. data/lib/google/cloud/aiplatform/v1/endpoint_pb.rb +29 -44
  57. data/lib/google/cloud/aiplatform/v1/endpoint_service_pb.rb +27 -63
  58. data/lib/google/cloud/aiplatform/v1/entity_type_pb.rb +26 -11
  59. data/lib/google/cloud/aiplatform/v1/env_var_pb.rb +24 -5
  60. data/lib/google/cloud/aiplatform/v1/evaluated_annotation_pb.rb +26 -36
  61. data/lib/google/cloud/aiplatform/v1/event_pb.rb +25 -13
  62. data/lib/google/cloud/aiplatform/v1/execution_pb.rb +26 -23
  63. data/lib/google/cloud/aiplatform/v1/explanation_metadata_pb.rb +25 -78
  64. data/lib/google/cloud/aiplatform/v1/explanation_pb.rb +34 -92
  65. data/lib/google/cloud/aiplatform/v1/feature_monitoring_stats_pb.rb +25 -10
  66. data/lib/google/cloud/aiplatform/v1/feature_pb.rb +26 -33
  67. data/lib/google/cloud/aiplatform/v1/feature_selector_pb.rb +24 -7
  68. data/lib/google/cloud/aiplatform/v1/featurestore_monitoring_pb.rb +24 -33
  69. data/lib/google/cloud/aiplatform/v1/featurestore_online_service_pb.rb +27 -62
  70. data/lib/google/cloud/aiplatform/v1/featurestore_pb.rb +26 -26
  71. data/lib/google/cloud/aiplatform/v1/featurestore_service_pb.rb +33 -249
  72. data/lib/google/cloud/aiplatform/v1/hyperparameter_tuning_job_pb.rb +29 -19
  73. data/lib/google/cloud/aiplatform/v1/index_endpoint_pb.rb +27 -41
  74. data/lib/google/cloud/aiplatform/v1/index_endpoint_service_pb.rb +27 -60
  75. data/lib/google/cloud/aiplatform/v1/index_pb.rb +27 -38
  76. data/lib/google/cloud/aiplatform/v1/index_service_pb.rb +27 -73
  77. data/lib/google/cloud/aiplatform/v1/io_pb.rb +24 -28
  78. data/lib/google/cloud/aiplatform/v1/job_service_pb.rb +33 -186
  79. data/lib/google/cloud/aiplatform/v1/job_state_pb.rb +24 -14
  80. data/lib/google/cloud/aiplatform/v1/lineage_subgraph_pb.rb +27 -6
  81. data/lib/google/cloud/aiplatform/v1/machine_resources_pb.rb +24 -37
  82. data/lib/google/cloud/aiplatform/v1/manual_batch_tuning_parameters_pb.rb +24 -4
  83. data/lib/google/cloud/aiplatform/v1/match_service_pb.rb +55 -0
  84. data/lib/google/cloud/aiplatform/v1/match_service_services_pb.rb +49 -0
  85. data/lib/google/cloud/aiplatform/v1/metadata_schema_pb.rb +25 -15
  86. data/lib/google/cloud/aiplatform/v1/metadata_service_pb.rb +32 -203
  87. data/lib/google/cloud/aiplatform/v1/metadata_store_pb.rb +26 -12
  88. data/lib/google/cloud/aiplatform/v1/migratable_resource_pb.rb +25 -32
  89. data/lib/google/cloud/aiplatform/v1/migration_service_pb.rb +27 -66
  90. data/lib/google/cloud/aiplatform/v1/model_deployment_monitoring_job_pb.rb +32 -78
  91. data/lib/google/cloud/aiplatform/v1/model_evaluation_pb.rb +27 -18
  92. data/lib/google/cloud/aiplatform/v1/model_evaluation_slice_pb.rb +28 -34
  93. data/lib/google/cloud/aiplatform/v1/model_garden_service_pb.rb +49 -0
  94. data/lib/google/cloud/aiplatform/v1/model_garden_service_services_pb.rb +45 -0
  95. data/lib/google/cloud/aiplatform/v1/model_monitoring_pb.rb +25 -63
  96. data/lib/google/cloud/aiplatform/v1/model_pb.rb +31 -78
  97. data/lib/google/cloud/aiplatform/v1/model_service_pb.rb +32 -137
  98. data/lib/google/cloud/aiplatform/v1/nas_job_pb.rb +29 -84
  99. data/lib/google/cloud/aiplatform/v1/operation_pb.rb +26 -9
  100. data/lib/google/cloud/aiplatform/v1/pipeline_failure_policy_pb.rb +24 -6
  101. data/lib/google/cloud/aiplatform/v1/pipeline_job_pb.rb +32 -91
  102. data/lib/google/cloud/aiplatform/v1/pipeline_service_pb.rb +27 -51
  103. data/lib/google/cloud/aiplatform/v1/pipeline_state_pb.rb +24 -12
  104. data/lib/google/cloud/aiplatform/v1/prediction_service_pb.rb +27 -29
  105. data/lib/google/cloud/aiplatform/v1/prediction_service_services_pb.rb +1 -2
  106. data/lib/google/cloud/aiplatform/v1/publisher_model_pb.rb +57 -0
  107. data/lib/google/cloud/aiplatform/v1/saved_query_pb.rb +26 -13
  108. data/lib/google/cloud/aiplatform/v1/service_networking_pb.rb +24 -5
  109. data/lib/google/cloud/aiplatform/v1/specialist_pool_pb.rb +24 -9
  110. data/lib/google/cloud/aiplatform/v1/specialist_pool_service_pb.rb +27 -33
  111. data/lib/google/cloud/aiplatform/v1/study_pb.rb +27 -157
  112. data/lib/google/cloud/aiplatform/v1/tensorboard_data_pb.rb +25 -29
  113. data/lib/google/cloud/aiplatform/v1/tensorboard_experiment_pb.rb +25 -11
  114. data/lib/google/cloud/aiplatform/v1/tensorboard_pb.rb +26 -14
  115. data/lib/google/cloud/aiplatform/v1/tensorboard_run_pb.rb +25 -10
  116. data/lib/google/cloud/aiplatform/v1/tensorboard_service_pb.rb +31 -186
  117. data/lib/google/cloud/aiplatform/v1/tensorboard_time_series_pb.rb +25 -24
  118. data/lib/google/cloud/aiplatform/v1/training_pipeline_pb.rb +30 -63
  119. data/lib/google/cloud/aiplatform/v1/types_pb.rb +24 -13
  120. data/lib/google/cloud/aiplatform/v1/unmanaged_container_model_pb.rb +25 -6
  121. data/lib/google/cloud/aiplatform/v1/user_action_reference_pb.rb +24 -8
  122. data/lib/google/cloud/aiplatform/v1/value_pb.rb +24 -8
  123. data/lib/google/cloud/aiplatform/v1/vizier_service_pb.rb +27 -88
  124. data/lib/google/cloud/aiplatform/v1/vizier_service_services_pb.rb +2 -1
  125. data/proto_docs/google/cloud/aiplatform/v1/accelerator_type.rb +3 -0
  126. data/proto_docs/google/cloud/aiplatform/v1/explanation.rb +89 -0
  127. data/proto_docs/google/cloud/aiplatform/v1/featurestore_service.rb +6 -2
  128. data/proto_docs/google/cloud/aiplatform/v1/index_endpoint.rb +7 -8
  129. data/proto_docs/google/cloud/aiplatform/v1/match_service.rb +156 -0
  130. data/proto_docs/google/cloud/aiplatform/v1/metadata_service.rb +12 -3
  131. data/proto_docs/google/cloud/aiplatform/v1/model.rb +14 -0
  132. data/proto_docs/google/cloud/aiplatform/v1/model_evaluation.rb +3 -2
  133. data/proto_docs/google/cloud/aiplatform/v1/model_garden_service.rb +61 -0
  134. data/proto_docs/google/cloud/aiplatform/v1/publisher_model.rb +235 -0
  135. data/proto_docs/google/cloud/aiplatform/v1/tensorboard_experiment.rb +2 -1
  136. data/proto_docs/google/protobuf/any.rb +7 -4
  137. data/proto_docs/google/protobuf/struct.rb +1 -1
  138. data/proto_docs/google/protobuf/timestamp.rb +1 -3
  139. metadata +20 -4
@@ -0,0 +1,533 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/aiplatform/v1/match_service_pb"
21
+ require "google/cloud/location"
22
+ require "google/iam/v1"
23
+
24
+ module Google
25
+ module Cloud
26
+ module AIPlatform
27
+ module V1
28
+ module MatchService
29
+ ##
30
+ # Client for the MatchService service.
31
+ #
32
+ # MatchService is a Google managed service for efficient vector similarity
33
+ # search at scale.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :match_service_stub
40
+
41
+ ##
42
+ # Configure the MatchService Client class.
43
+ #
44
+ # See {::Google::Cloud::AIPlatform::V1::MatchService::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all MatchService clients
50
+ # ::Google::Cloud::AIPlatform::V1::MatchService::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "AIPlatform", "V1"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config
71
+ end
72
+ yield @configure if block_given?
73
+ @configure
74
+ end
75
+
76
+ ##
77
+ # Configure the MatchService Client instance.
78
+ #
79
+ # The configuration is set to the derived mode, meaning that values can be changed,
80
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
81
+ # should be made on {Client.configure}.
82
+ #
83
+ # See {::Google::Cloud::AIPlatform::V1::MatchService::Client::Configuration}
84
+ # for a description of the configuration fields.
85
+ #
86
+ # @yield [config] Configure the Client client.
87
+ # @yieldparam config [Client::Configuration]
88
+ #
89
+ # @return [Client::Configuration]
90
+ #
91
+ def configure
92
+ yield @config if block_given?
93
+ @config
94
+ end
95
+
96
+ ##
97
+ # Create a new MatchService client object.
98
+ #
99
+ # @example
100
+ #
101
+ # # Create a client using the default configuration
102
+ # client = ::Google::Cloud::AIPlatform::V1::MatchService::Client.new
103
+ #
104
+ # # Create a client using a custom configuration
105
+ # client = ::Google::Cloud::AIPlatform::V1::MatchService::Client.new do |config|
106
+ # config.timeout = 10.0
107
+ # end
108
+ #
109
+ # @yield [config] Configure the MatchService client.
110
+ # @yieldparam config [Client::Configuration]
111
+ #
112
+ def initialize
113
+ # These require statements are intentionally placed here to initialize
114
+ # the gRPC module only when it's required.
115
+ # See https://github.com/googleapis/toolkit/issues/446
116
+ require "gapic/grpc"
117
+ require "google/cloud/aiplatform/v1/match_service_services_pb"
118
+
119
+ # Create the configuration object
120
+ @config = Configuration.new Client.configure
121
+
122
+ # Yield the configuration if needed
123
+ yield @config if block_given?
124
+
125
+ # Create credentials
126
+ credentials = @config.credentials
127
+ # Use self-signed JWT if the endpoint is unchanged from default,
128
+ # but only if the default endpoint does not have a region prefix.
129
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
130
+ !@config.endpoint.split(".").first.include?("-")
131
+ credentials ||= Credentials.default scope: @config.scope,
132
+ enable_self_signed_jwt: enable_self_signed_jwt
133
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
134
+ credentials = Credentials.new credentials, scope: @config.scope
135
+ end
136
+ @quota_project_id = @config.quota_project
137
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
138
+
139
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
140
+ config.credentials = credentials
141
+ config.quota_project = @quota_project_id
142
+ config.endpoint = @config.endpoint
143
+ end
144
+
145
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
146
+ config.credentials = credentials
147
+ config.quota_project = @quota_project_id
148
+ config.endpoint = @config.endpoint
149
+ end
150
+
151
+ @match_service_stub = ::Gapic::ServiceStub.new(
152
+ ::Google::Cloud::AIPlatform::V1::MatchService::Stub,
153
+ credentials: credentials,
154
+ endpoint: @config.endpoint,
155
+ channel_args: @config.channel_args,
156
+ interceptors: @config.interceptors
157
+ )
158
+ end
159
+
160
+ ##
161
+ # Get the associated client for mix-in of the Locations.
162
+ #
163
+ # @return [Google::Cloud::Location::Locations::Client]
164
+ #
165
+ attr_reader :location_client
166
+
167
+ ##
168
+ # Get the associated client for mix-in of the IAMPolicy.
169
+ #
170
+ # @return [Google::Iam::V1::IAMPolicy::Client]
171
+ #
172
+ attr_reader :iam_policy_client
173
+
174
+ # Service calls
175
+
176
+ ##
177
+ # Finds the nearest neighbors of each vector within the request.
178
+ #
179
+ # @overload find_neighbors(request, options = nil)
180
+ # Pass arguments to `find_neighbors` via a request object, either of type
181
+ # {::Google::Cloud::AIPlatform::V1::FindNeighborsRequest} or an equivalent Hash.
182
+ #
183
+ # @param request [::Google::Cloud::AIPlatform::V1::FindNeighborsRequest, ::Hash]
184
+ # A request object representing the call parameters. Required. To specify no
185
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
186
+ # @param options [::Gapic::CallOptions, ::Hash]
187
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
188
+ #
189
+ # @overload find_neighbors(index_endpoint: nil, deployed_index_id: nil, queries: nil, return_full_datapoint: nil)
190
+ # Pass arguments to `find_neighbors` via keyword arguments. Note that at
191
+ # least one keyword argument is required. To specify no parameters, or to keep all
192
+ # the default parameter values, pass an empty Hash as a request object (see above).
193
+ #
194
+ # @param index_endpoint [::String]
195
+ # Required. The name of the index endpoint.
196
+ # Format:
197
+ # `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}`
198
+ # @param deployed_index_id [::String]
199
+ # The ID of the DeployedIndex that will serve the request. This request is
200
+ # sent to a specific IndexEndpoint, as per the IndexEndpoint.network. That
201
+ # IndexEndpoint also has IndexEndpoint.deployed_indexes, and each such index
202
+ # has a DeployedIndex.id field.
203
+ # The value of the field below must equal one of the DeployedIndex.id
204
+ # fields of the IndexEndpoint that is being called for this request.
205
+ # @param queries [::Array<::Google::Cloud::AIPlatform::V1::FindNeighborsRequest::Query, ::Hash>]
206
+ # The list of queries.
207
+ # @param return_full_datapoint [::Boolean]
208
+ # If set to true, the full datapoints (including all vector values and
209
+ # restricts) of the nearest neighbors are returned.
210
+ # Note that returning full datapoint will significantly increase the
211
+ # latency and cost of the query.
212
+ #
213
+ # @yield [response, operation] Access the result along with the RPC operation
214
+ # @yieldparam response [::Google::Cloud::AIPlatform::V1::FindNeighborsResponse]
215
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
216
+ #
217
+ # @return [::Google::Cloud::AIPlatform::V1::FindNeighborsResponse]
218
+ #
219
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
220
+ #
221
+ # @example Basic example
222
+ # require "google/cloud/ai_platform/v1"
223
+ #
224
+ # # Create a client object. The client can be reused for multiple calls.
225
+ # client = Google::Cloud::AIPlatform::V1::MatchService::Client.new
226
+ #
227
+ # # Create a request. To set request fields, pass in keyword arguments.
228
+ # request = Google::Cloud::AIPlatform::V1::FindNeighborsRequest.new
229
+ #
230
+ # # Call the find_neighbors method.
231
+ # result = client.find_neighbors request
232
+ #
233
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::FindNeighborsResponse.
234
+ # p result
235
+ #
236
+ def find_neighbors request, options = nil
237
+ raise ::ArgumentError, "request must be provided" if request.nil?
238
+
239
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::FindNeighborsRequest
240
+
241
+ # Converts hash and nil to an options object
242
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
243
+
244
+ # Customize the options with defaults
245
+ metadata = @config.rpcs.find_neighbors.metadata.to_h
246
+
247
+ # Set x-goog-api-client and x-goog-user-project headers
248
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
249
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
250
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
251
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
252
+
253
+ header_params = {}
254
+ if request.index_endpoint
255
+ header_params["index_endpoint"] = request.index_endpoint
256
+ end
257
+
258
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
259
+ metadata[:"x-goog-request-params"] ||= request_params_header
260
+
261
+ options.apply_defaults timeout: @config.rpcs.find_neighbors.timeout,
262
+ metadata: metadata,
263
+ retry_policy: @config.rpcs.find_neighbors.retry_policy
264
+
265
+ options.apply_defaults timeout: @config.timeout,
266
+ metadata: @config.metadata,
267
+ retry_policy: @config.retry_policy
268
+
269
+ @match_service_stub.call_rpc :find_neighbors, request, options: options do |response, operation|
270
+ yield response, operation if block_given?
271
+ return response
272
+ end
273
+ rescue ::GRPC::BadStatus => e
274
+ raise ::Google::Cloud::Error.from_error(e)
275
+ end
276
+
277
+ ##
278
+ # Reads the datapoints/vectors of the given IDs.
279
+ # A maximum of 1000 datapoints can be retrieved in a batch.
280
+ #
281
+ # @overload read_index_datapoints(request, options = nil)
282
+ # Pass arguments to `read_index_datapoints` via a request object, either of type
283
+ # {::Google::Cloud::AIPlatform::V1::ReadIndexDatapointsRequest} or an equivalent Hash.
284
+ #
285
+ # @param request [::Google::Cloud::AIPlatform::V1::ReadIndexDatapointsRequest, ::Hash]
286
+ # A request object representing the call parameters. Required. To specify no
287
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
288
+ # @param options [::Gapic::CallOptions, ::Hash]
289
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
290
+ #
291
+ # @overload read_index_datapoints(index_endpoint: nil, deployed_index_id: nil, ids: nil)
292
+ # Pass arguments to `read_index_datapoints` via keyword arguments. Note that at
293
+ # least one keyword argument is required. To specify no parameters, or to keep all
294
+ # the default parameter values, pass an empty Hash as a request object (see above).
295
+ #
296
+ # @param index_endpoint [::String]
297
+ # Required. The name of the index endpoint.
298
+ # Format:
299
+ # `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}`
300
+ # @param deployed_index_id [::String]
301
+ # The ID of the DeployedIndex that will serve the request.
302
+ # @param ids [::Array<::String>]
303
+ # IDs of the datapoints to be searched for.
304
+ #
305
+ # @yield [response, operation] Access the result along with the RPC operation
306
+ # @yieldparam response [::Google::Cloud::AIPlatform::V1::ReadIndexDatapointsResponse]
307
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
308
+ #
309
+ # @return [::Google::Cloud::AIPlatform::V1::ReadIndexDatapointsResponse]
310
+ #
311
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
312
+ #
313
+ # @example Basic example
314
+ # require "google/cloud/ai_platform/v1"
315
+ #
316
+ # # Create a client object. The client can be reused for multiple calls.
317
+ # client = Google::Cloud::AIPlatform::V1::MatchService::Client.new
318
+ #
319
+ # # Create a request. To set request fields, pass in keyword arguments.
320
+ # request = Google::Cloud::AIPlatform::V1::ReadIndexDatapointsRequest.new
321
+ #
322
+ # # Call the read_index_datapoints method.
323
+ # result = client.read_index_datapoints request
324
+ #
325
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::ReadIndexDatapointsResponse.
326
+ # p result
327
+ #
328
+ def read_index_datapoints request, options = nil
329
+ raise ::ArgumentError, "request must be provided" if request.nil?
330
+
331
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::ReadIndexDatapointsRequest
332
+
333
+ # Converts hash and nil to an options object
334
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
335
+
336
+ # Customize the options with defaults
337
+ metadata = @config.rpcs.read_index_datapoints.metadata.to_h
338
+
339
+ # Set x-goog-api-client and x-goog-user-project headers
340
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
341
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
342
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
343
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
344
+
345
+ header_params = {}
346
+ if request.index_endpoint
347
+ header_params["index_endpoint"] = request.index_endpoint
348
+ end
349
+
350
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
351
+ metadata[:"x-goog-request-params"] ||= request_params_header
352
+
353
+ options.apply_defaults timeout: @config.rpcs.read_index_datapoints.timeout,
354
+ metadata: metadata,
355
+ retry_policy: @config.rpcs.read_index_datapoints.retry_policy
356
+
357
+ options.apply_defaults timeout: @config.timeout,
358
+ metadata: @config.metadata,
359
+ retry_policy: @config.retry_policy
360
+
361
+ @match_service_stub.call_rpc :read_index_datapoints, request, options: options do |response, operation|
362
+ yield response, operation if block_given?
363
+ return response
364
+ end
365
+ rescue ::GRPC::BadStatus => e
366
+ raise ::Google::Cloud::Error.from_error(e)
367
+ end
368
+
369
+ ##
370
+ # Configuration class for the MatchService API.
371
+ #
372
+ # This class represents the configuration for MatchService,
373
+ # providing control over timeouts, retry behavior, logging, transport
374
+ # parameters, and other low-level controls. Certain parameters can also be
375
+ # applied individually to specific RPCs. See
376
+ # {::Google::Cloud::AIPlatform::V1::MatchService::Client::Configuration::Rpcs}
377
+ # for a list of RPCs that can be configured independently.
378
+ #
379
+ # Configuration can be applied globally to all clients, or to a single client
380
+ # on construction.
381
+ #
382
+ # @example
383
+ #
384
+ # # Modify the global config, setting the timeout for
385
+ # # find_neighbors to 20 seconds,
386
+ # # and all remaining timeouts to 10 seconds.
387
+ # ::Google::Cloud::AIPlatform::V1::MatchService::Client.configure do |config|
388
+ # config.timeout = 10.0
389
+ # config.rpcs.find_neighbors.timeout = 20.0
390
+ # end
391
+ #
392
+ # # Apply the above configuration only to a new client.
393
+ # client = ::Google::Cloud::AIPlatform::V1::MatchService::Client.new do |config|
394
+ # config.timeout = 10.0
395
+ # config.rpcs.find_neighbors.timeout = 20.0
396
+ # end
397
+ #
398
+ # @!attribute [rw] endpoint
399
+ # The hostname or hostname:port of the service endpoint.
400
+ # Defaults to `"aiplatform.googleapis.com"`.
401
+ # @return [::String]
402
+ # @!attribute [rw] credentials
403
+ # Credentials to send with calls. You may provide any of the following types:
404
+ # * (`String`) The path to a service account key file in JSON format
405
+ # * (`Hash`) A service account key as a Hash
406
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
407
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
408
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
409
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
410
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
411
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
412
+ # * (`nil`) indicating no credentials
413
+ # @return [::Object]
414
+ # @!attribute [rw] scope
415
+ # The OAuth scopes
416
+ # @return [::Array<::String>]
417
+ # @!attribute [rw] lib_name
418
+ # The library name as recorded in instrumentation and logging
419
+ # @return [::String]
420
+ # @!attribute [rw] lib_version
421
+ # The library version as recorded in instrumentation and logging
422
+ # @return [::String]
423
+ # @!attribute [rw] channel_args
424
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
425
+ # `GRPC::Core::Channel` object is provided as the credential.
426
+ # @return [::Hash]
427
+ # @!attribute [rw] interceptors
428
+ # An array of interceptors that are run before calls are executed.
429
+ # @return [::Array<::GRPC::ClientInterceptor>]
430
+ # @!attribute [rw] timeout
431
+ # The call timeout in seconds.
432
+ # @return [::Numeric]
433
+ # @!attribute [rw] metadata
434
+ # Additional gRPC headers to be sent with the call.
435
+ # @return [::Hash{::Symbol=>::String}]
436
+ # @!attribute [rw] retry_policy
437
+ # The retry policy. The value is a hash with the following keys:
438
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
439
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
440
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
441
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
442
+ # trigger a retry.
443
+ # @return [::Hash]
444
+ # @!attribute [rw] quota_project
445
+ # A separate project against which to charge quota.
446
+ # @return [::String]
447
+ #
448
+ class Configuration
449
+ extend ::Gapic::Config
450
+
451
+ DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
452
+
453
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
454
+ config_attr :credentials, nil do |value|
455
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
456
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
457
+ allowed.any? { |klass| klass === value }
458
+ end
459
+ config_attr :scope, nil, ::String, ::Array, nil
460
+ config_attr :lib_name, nil, ::String, nil
461
+ config_attr :lib_version, nil, ::String, nil
462
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
463
+ config_attr :interceptors, nil, ::Array, nil
464
+ config_attr :timeout, nil, ::Numeric, nil
465
+ config_attr :metadata, nil, ::Hash, nil
466
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
467
+ config_attr :quota_project, nil, ::String, nil
468
+
469
+ # @private
470
+ def initialize parent_config = nil
471
+ @parent_config = parent_config unless parent_config.nil?
472
+
473
+ yield self if block_given?
474
+ end
475
+
476
+ ##
477
+ # Configurations for individual RPCs
478
+ # @return [Rpcs]
479
+ #
480
+ def rpcs
481
+ @rpcs ||= begin
482
+ parent_rpcs = nil
483
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
484
+ Rpcs.new parent_rpcs
485
+ end
486
+ end
487
+
488
+ ##
489
+ # Configuration RPC class for the MatchService API.
490
+ #
491
+ # Includes fields providing the configuration for each RPC in this service.
492
+ # Each configuration object is of type `Gapic::Config::Method` and includes
493
+ # the following configuration fields:
494
+ #
495
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
496
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
497
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
498
+ # include the following keys:
499
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
500
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
501
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
502
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
503
+ # trigger a retry.
504
+ #
505
+ class Rpcs
506
+ ##
507
+ # RPC-specific configuration for `find_neighbors`
508
+ # @return [::Gapic::Config::Method]
509
+ #
510
+ attr_reader :find_neighbors
511
+ ##
512
+ # RPC-specific configuration for `read_index_datapoints`
513
+ # @return [::Gapic::Config::Method]
514
+ #
515
+ attr_reader :read_index_datapoints
516
+
517
+ # @private
518
+ def initialize parent_rpcs = nil
519
+ find_neighbors_config = parent_rpcs.find_neighbors if parent_rpcs.respond_to? :find_neighbors
520
+ @find_neighbors = ::Gapic::Config::Method.new find_neighbors_config
521
+ read_index_datapoints_config = parent_rpcs.read_index_datapoints if parent_rpcs.respond_to? :read_index_datapoints
522
+ @read_index_datapoints = ::Gapic::Config::Method.new read_index_datapoints_config
523
+
524
+ yield self if block_given?
525
+ end
526
+ end
527
+ end
528
+ end
529
+ end
530
+ end
531
+ end
532
+ end
533
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module AIPlatform
24
+ module V1
25
+ module MatchService
26
+ # Credentials for the MatchService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "GOOGLE_CLOUD_CREDENTIALS",
33
+ "GOOGLE_CLOUD_KEYFILE",
34
+ "GCLOUD_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
36
+ "GOOGLE_CLOUD_KEYFILE_JSON",
37
+ "GCLOUD_KEYFILE_JSON"
38
+ ]
39
+ self.paths = [
40
+ "~/.config/google_cloud/application_default_credentials.json"
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module AIPlatform
23
+ module V1
24
+ module MatchService
25
+ # Path helper methods for the MatchService API.
26
+ module Paths
27
+ ##
28
+ # Create a fully-qualified IndexEndpoint resource string.
29
+ #
30
+ # The resource will be in the following format:
31
+ #
32
+ # `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}`
33
+ #
34
+ # @param project [String]
35
+ # @param location [String]
36
+ # @param index_endpoint [String]
37
+ #
38
+ # @return [::String]
39
+ def index_endpoint_path project:, location:, index_endpoint:
40
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
41
+ raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
42
+
43
+ "projects/#{project}/locations/#{location}/indexEndpoints/#{index_endpoint}"
44
+ end
45
+
46
+ extend self
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/ai_platform/v1/version"
24
+
25
+ require "google/cloud/ai_platform/v1/match_service/credentials"
26
+ require "google/cloud/ai_platform/v1/match_service/paths"
27
+ require "google/cloud/ai_platform/v1/match_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module AIPlatform
32
+ module V1
33
+ ##
34
+ # MatchService is a Google managed service for efficient vector similarity
35
+ # search at scale.
36
+ #
37
+ # @example Load this service and instantiate a gRPC client
38
+ #
39
+ # require "google/cloud/ai_platform/v1/match_service"
40
+ # client = ::Google::Cloud::AIPlatform::V1::MatchService::Client.new
41
+ #
42
+ module MatchService
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ helper_path = ::File.join __dir__, "match_service", "helpers.rb"
50
+ require "google/cloud/ai_platform/v1/match_service/helpers" if ::File.file? helper_path