google-cloud-ai_platform-v1 0.23.0 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/ai_platform/v1/match_service/client.rb +531 -0
- data/lib/google/cloud/ai_platform/v1/match_service/credentials.rb +47 -0
- data/lib/google/cloud/ai_platform/v1/match_service/paths.rb +52 -0
- data/lib/google/cloud/ai_platform/v1/match_service.rb +50 -0
- data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
- data/lib/google/cloud/ai_platform/v1.rb +1 -0
- data/lib/google/cloud/aiplatform/v1/explanation_pb.rb +40 -0
- data/lib/google/cloud/aiplatform/v1/match_service_pb.rb +63 -0
- data/lib/google/cloud/aiplatform/v1/match_service_services_pb.rb +49 -0
- data/proto_docs/google/cloud/aiplatform/v1/explanation.rb +89 -0
- data/proto_docs/google/cloud/aiplatform/v1/match_service.rb +156 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4fb9d2c0c08f62d6c6e350e8067e9a771da919c7c3465092afd576e7d94f159
|
4
|
+
data.tar.gz: 4e997cf49e37e81613dcaf4ad0aa887c07ff65524c2400b8121ab059ac6a17ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6cdd0917326e4ce3681327bfdd7fc81f0b274bc810a00a05863115f8d4bc192d901b55119c34d262758d1328eb59e6a73285731efdfd405b5c7af84ba53068b
|
7
|
+
data.tar.gz: 636944fb0edbe7846bf0354bafb5f7af97d87b856c4d68c5a0f6668b3e1a15e1d79bbe8878337b3ad85c5822f0e502f9954938ea29092603e3850b27996d9c63
|
@@ -0,0 +1,531 @@
|
|
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 == Client.configure.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
|
+
config_attr :endpoint, "aiplatform.googleapis.com", ::String
|
452
|
+
config_attr :credentials, nil do |value|
|
453
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
454
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
455
|
+
allowed.any? { |klass| klass === value }
|
456
|
+
end
|
457
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
458
|
+
config_attr :lib_name, nil, ::String, nil
|
459
|
+
config_attr :lib_version, nil, ::String, nil
|
460
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
461
|
+
config_attr :interceptors, nil, ::Array, nil
|
462
|
+
config_attr :timeout, nil, ::Numeric, nil
|
463
|
+
config_attr :metadata, nil, ::Hash, nil
|
464
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
465
|
+
config_attr :quota_project, nil, ::String, nil
|
466
|
+
|
467
|
+
# @private
|
468
|
+
def initialize parent_config = nil
|
469
|
+
@parent_config = parent_config unless parent_config.nil?
|
470
|
+
|
471
|
+
yield self if block_given?
|
472
|
+
end
|
473
|
+
|
474
|
+
##
|
475
|
+
# Configurations for individual RPCs
|
476
|
+
# @return [Rpcs]
|
477
|
+
#
|
478
|
+
def rpcs
|
479
|
+
@rpcs ||= begin
|
480
|
+
parent_rpcs = nil
|
481
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
482
|
+
Rpcs.new parent_rpcs
|
483
|
+
end
|
484
|
+
end
|
485
|
+
|
486
|
+
##
|
487
|
+
# Configuration RPC class for the MatchService API.
|
488
|
+
#
|
489
|
+
# Includes fields providing the configuration for each RPC in this service.
|
490
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
491
|
+
# the following configuration fields:
|
492
|
+
#
|
493
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
494
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
495
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
496
|
+
# include the following keys:
|
497
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
498
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
499
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
500
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
501
|
+
# trigger a retry.
|
502
|
+
#
|
503
|
+
class Rpcs
|
504
|
+
##
|
505
|
+
# RPC-specific configuration for `find_neighbors`
|
506
|
+
# @return [::Gapic::Config::Method]
|
507
|
+
#
|
508
|
+
attr_reader :find_neighbors
|
509
|
+
##
|
510
|
+
# RPC-specific configuration for `read_index_datapoints`
|
511
|
+
# @return [::Gapic::Config::Method]
|
512
|
+
#
|
513
|
+
attr_reader :read_index_datapoints
|
514
|
+
|
515
|
+
# @private
|
516
|
+
def initialize parent_rpcs = nil
|
517
|
+
find_neighbors_config = parent_rpcs.find_neighbors if parent_rpcs.respond_to? :find_neighbors
|
518
|
+
@find_neighbors = ::Gapic::Config::Method.new find_neighbors_config
|
519
|
+
read_index_datapoints_config = parent_rpcs.read_index_datapoints if parent_rpcs.respond_to? :read_index_datapoints
|
520
|
+
@read_index_datapoints = ::Gapic::Config::Method.new read_index_datapoints_config
|
521
|
+
|
522
|
+
yield self if block_given?
|
523
|
+
end
|
524
|
+
end
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
530
|
+
end
|
531
|
+
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
|
@@ -23,6 +23,7 @@ require "google/cloud/ai_platform/v1/featurestore_service"
|
|
23
23
|
require "google/cloud/ai_platform/v1/index_endpoint_service"
|
24
24
|
require "google/cloud/ai_platform/v1/index_service"
|
25
25
|
require "google/cloud/ai_platform/v1/job_service"
|
26
|
+
require "google/cloud/ai_platform/v1/match_service"
|
26
27
|
require "google/cloud/ai_platform/v1/metadata_service"
|
27
28
|
require "google/cloud/ai_platform/v1/migration_service"
|
28
29
|
require "google/cloud/ai_platform/v1/model_service"
|
@@ -5,6 +5,7 @@ require 'google/protobuf'
|
|
5
5
|
|
6
6
|
require 'google/api/field_behavior_pb'
|
7
7
|
require 'google/cloud/aiplatform/v1/explanation_metadata_pb'
|
8
|
+
require 'google/cloud/aiplatform/v1/io_pb'
|
8
9
|
require 'google/protobuf/struct_pb'
|
9
10
|
|
10
11
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
@@ -40,6 +41,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
40
41
|
optional :sampled_shapley_attribution, :message, 1, "google.cloud.aiplatform.v1.SampledShapleyAttribution"
|
41
42
|
optional :integrated_gradients_attribution, :message, 2, "google.cloud.aiplatform.v1.IntegratedGradientsAttribution"
|
42
43
|
optional :xrai_attribution, :message, 3, "google.cloud.aiplatform.v1.XraiAttribution"
|
44
|
+
optional :examples, :message, 7, "google.cloud.aiplatform.v1.Examples"
|
43
45
|
end
|
44
46
|
end
|
45
47
|
add_message "google.cloud.aiplatform.v1.SampledShapleyAttribution" do
|
@@ -72,6 +74,38 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
72
74
|
add_message "google.cloud.aiplatform.v1.BlurBaselineConfig" do
|
73
75
|
optional :max_blur_sigma, :float, 1
|
74
76
|
end
|
77
|
+
add_message "google.cloud.aiplatform.v1.Examples" do
|
78
|
+
optional :neighbor_count, :int32, 3
|
79
|
+
oneof :source do
|
80
|
+
optional :example_gcs_source, :message, 5, "google.cloud.aiplatform.v1.Examples.ExampleGcsSource"
|
81
|
+
end
|
82
|
+
oneof :config do
|
83
|
+
optional :nearest_neighbor_search_config, :message, 2, "google.protobuf.Value"
|
84
|
+
optional :presets, :message, 4, "google.cloud.aiplatform.v1.Presets"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
add_message "google.cloud.aiplatform.v1.Examples.ExampleGcsSource" do
|
88
|
+
optional :data_format, :enum, 1, "google.cloud.aiplatform.v1.Examples.ExampleGcsSource.DataFormat"
|
89
|
+
optional :gcs_source, :message, 2, "google.cloud.aiplatform.v1.GcsSource"
|
90
|
+
end
|
91
|
+
add_enum "google.cloud.aiplatform.v1.Examples.ExampleGcsSource.DataFormat" do
|
92
|
+
value :DATA_FORMAT_UNSPECIFIED, 0
|
93
|
+
value :JSONL, 1
|
94
|
+
end
|
95
|
+
add_message "google.cloud.aiplatform.v1.Presets" do
|
96
|
+
proto3_optional :query, :enum, 1, "google.cloud.aiplatform.v1.Presets.Query"
|
97
|
+
optional :modality, :enum, 2, "google.cloud.aiplatform.v1.Presets.Modality"
|
98
|
+
end
|
99
|
+
add_enum "google.cloud.aiplatform.v1.Presets.Query" do
|
100
|
+
value :PRECISE, 0
|
101
|
+
value :FAST, 1
|
102
|
+
end
|
103
|
+
add_enum "google.cloud.aiplatform.v1.Presets.Modality" do
|
104
|
+
value :MODALITY_UNSPECIFIED, 0
|
105
|
+
value :IMAGE, 1
|
106
|
+
value :TEXT, 2
|
107
|
+
value :TABULAR, 3
|
108
|
+
end
|
75
109
|
add_message "google.cloud.aiplatform.v1.ExplanationSpecOverride" do
|
76
110
|
optional :parameters, :message, 1, "google.cloud.aiplatform.v1.ExplanationParameters"
|
77
111
|
optional :metadata, :message, 2, "google.cloud.aiplatform.v1.ExplanationMetadataOverride"
|
@@ -120,6 +154,12 @@ module Google
|
|
120
154
|
FeatureNoiseSigma = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.FeatureNoiseSigma").msgclass
|
121
155
|
FeatureNoiseSigma::NoiseSigmaForFeature = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.FeatureNoiseSigma.NoiseSigmaForFeature").msgclass
|
122
156
|
BlurBaselineConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.BlurBaselineConfig").msgclass
|
157
|
+
Examples = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.Examples").msgclass
|
158
|
+
Examples::ExampleGcsSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.Examples.ExampleGcsSource").msgclass
|
159
|
+
Examples::ExampleGcsSource::DataFormat = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.Examples.ExampleGcsSource.DataFormat").enummodule
|
160
|
+
Presets = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.Presets").msgclass
|
161
|
+
Presets::Query = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.Presets.Query").enummodule
|
162
|
+
Presets::Modality = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.Presets.Modality").enummodule
|
123
163
|
ExplanationSpecOverride = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.ExplanationSpecOverride").msgclass
|
124
164
|
ExplanationMetadataOverride = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.ExplanationMetadataOverride").msgclass
|
125
165
|
ExplanationMetadataOverride::InputMetadataOverride = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.ExplanationMetadataOverride.InputMetadataOverride").msgclass
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/aiplatform/v1/match_service.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/annotations_pb'
|
7
|
+
require 'google/api/client_pb'
|
8
|
+
require 'google/api/field_behavior_pb'
|
9
|
+
require 'google/api/resource_pb'
|
10
|
+
require 'google/cloud/aiplatform/v1/index_pb'
|
11
|
+
|
12
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
13
|
+
add_file("google/cloud/aiplatform/v1/match_service.proto", :syntax => :proto3) do
|
14
|
+
add_message "google.cloud.aiplatform.v1.FindNeighborsRequest" do
|
15
|
+
optional :index_endpoint, :string, 1
|
16
|
+
optional :deployed_index_id, :string, 2
|
17
|
+
repeated :queries, :message, 3, "google.cloud.aiplatform.v1.FindNeighborsRequest.Query"
|
18
|
+
optional :return_full_datapoint, :bool, 4
|
19
|
+
end
|
20
|
+
add_message "google.cloud.aiplatform.v1.FindNeighborsRequest.Query" do
|
21
|
+
optional :datapoint, :message, 1, "google.cloud.aiplatform.v1.IndexDatapoint"
|
22
|
+
optional :neighbor_count, :int32, 2
|
23
|
+
optional :per_crowding_attribute_neighbor_count, :int32, 3
|
24
|
+
optional :approximate_neighbor_count, :int32, 4
|
25
|
+
optional :fraction_leaf_nodes_to_search_override, :double, 5
|
26
|
+
end
|
27
|
+
add_message "google.cloud.aiplatform.v1.FindNeighborsResponse" do
|
28
|
+
repeated :nearest_neighbors, :message, 1, "google.cloud.aiplatform.v1.FindNeighborsResponse.NearestNeighbors"
|
29
|
+
end
|
30
|
+
add_message "google.cloud.aiplatform.v1.FindNeighborsResponse.Neighbor" do
|
31
|
+
optional :datapoint, :message, 1, "google.cloud.aiplatform.v1.IndexDatapoint"
|
32
|
+
optional :distance, :double, 2
|
33
|
+
end
|
34
|
+
add_message "google.cloud.aiplatform.v1.FindNeighborsResponse.NearestNeighbors" do
|
35
|
+
optional :id, :string, 1
|
36
|
+
repeated :neighbors, :message, 2, "google.cloud.aiplatform.v1.FindNeighborsResponse.Neighbor"
|
37
|
+
end
|
38
|
+
add_message "google.cloud.aiplatform.v1.ReadIndexDatapointsRequest" do
|
39
|
+
optional :index_endpoint, :string, 1
|
40
|
+
optional :deployed_index_id, :string, 2
|
41
|
+
repeated :ids, :string, 3
|
42
|
+
end
|
43
|
+
add_message "google.cloud.aiplatform.v1.ReadIndexDatapointsResponse" do
|
44
|
+
repeated :datapoints, :message, 1, "google.cloud.aiplatform.v1.IndexDatapoint"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
module Google
|
50
|
+
module Cloud
|
51
|
+
module AIPlatform
|
52
|
+
module V1
|
53
|
+
FindNeighborsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.FindNeighborsRequest").msgclass
|
54
|
+
FindNeighborsRequest::Query = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.FindNeighborsRequest.Query").msgclass
|
55
|
+
FindNeighborsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.FindNeighborsResponse").msgclass
|
56
|
+
FindNeighborsResponse::Neighbor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.FindNeighborsResponse.Neighbor").msgclass
|
57
|
+
FindNeighborsResponse::NearestNeighbors = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.FindNeighborsResponse.NearestNeighbors").msgclass
|
58
|
+
ReadIndexDatapointsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.ReadIndexDatapointsRequest").msgclass
|
59
|
+
ReadIndexDatapointsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.aiplatform.v1.ReadIndexDatapointsResponse").msgclass
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: google/cloud/aiplatform/v1/match_service.proto for package 'Google.Cloud.AIPlatform.V1'
|
3
|
+
# Original file comments:
|
4
|
+
# Copyright 2023 Google LLC
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'grpc'
|
20
|
+
require 'google/cloud/aiplatform/v1/match_service_pb'
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module AIPlatform
|
25
|
+
module V1
|
26
|
+
module MatchService
|
27
|
+
# MatchService is a Google managed service for efficient vector similarity
|
28
|
+
# search at scale.
|
29
|
+
class Service
|
30
|
+
|
31
|
+
include ::GRPC::GenericService
|
32
|
+
|
33
|
+
self.marshal_class_method = :encode
|
34
|
+
self.unmarshal_class_method = :decode
|
35
|
+
self.service_name = 'google.cloud.aiplatform.v1.MatchService'
|
36
|
+
|
37
|
+
# Finds the nearest neighbors of each vector within the request.
|
38
|
+
rpc :FindNeighbors, ::Google::Cloud::AIPlatform::V1::FindNeighborsRequest, ::Google::Cloud::AIPlatform::V1::FindNeighborsResponse
|
39
|
+
# Reads the datapoints/vectors of the given IDs.
|
40
|
+
# A maximum of 1000 datapoints can be retrieved in a batch.
|
41
|
+
rpc :ReadIndexDatapoints, ::Google::Cloud::AIPlatform::V1::ReadIndexDatapointsRequest, ::Google::Cloud::AIPlatform::V1::ReadIndexDatapointsResponse
|
42
|
+
end
|
43
|
+
|
44
|
+
Stub = Service.rpc_stub_class
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -245,6 +245,10 @@ module Google
|
|
245
245
|
# house or an animal. If the images are taken in artificial environments,
|
246
246
|
# like a lab or manufacturing line, or from diagnostic equipment, like
|
247
247
|
# x-rays or quality-control cameras, use Integrated Gradients instead.
|
248
|
+
# @!attribute [rw] examples
|
249
|
+
# @return [::Google::Cloud::AIPlatform::V1::Examples]
|
250
|
+
# Example-based explanations that returns the nearest neighbors from the
|
251
|
+
# provided dataset.
|
248
252
|
# @!attribute [rw] top_k
|
249
253
|
# @return [::Integer]
|
250
254
|
# If populated, returns attributions for top K indices of outputs
|
@@ -437,6 +441,91 @@ module Google
|
|
437
441
|
extend ::Google::Protobuf::MessageExts::ClassMethods
|
438
442
|
end
|
439
443
|
|
444
|
+
# Example-based explainability that returns the nearest neighbors from the
|
445
|
+
# provided dataset.
|
446
|
+
# @!attribute [rw] example_gcs_source
|
447
|
+
# @return [::Google::Cloud::AIPlatform::V1::Examples::ExampleGcsSource]
|
448
|
+
# The Cloud Storage input instances.
|
449
|
+
# @!attribute [rw] nearest_neighbor_search_config
|
450
|
+
# @return [::Google::Protobuf::Value]
|
451
|
+
# The full configuration for the generated index, the semantics are the
|
452
|
+
# same as {::Google::Cloud::AIPlatform::V1::Index#metadata metadata} and should
|
453
|
+
# match
|
454
|
+
# [NearestNeighborSearchConfig](https://cloud.google.com/vertex-ai/docs/explainable-ai/configuring-explanations-example-based#nearest-neighbor-search-config).
|
455
|
+
# @!attribute [rw] presets
|
456
|
+
# @return [::Google::Cloud::AIPlatform::V1::Presets]
|
457
|
+
# Simplified preset configuration, which automatically sets configuration
|
458
|
+
# values based on the desired query speed-precision trade-off and modality.
|
459
|
+
# @!attribute [rw] neighbor_count
|
460
|
+
# @return [::Integer]
|
461
|
+
# The number of neighbors to return when querying for examples.
|
462
|
+
class Examples
|
463
|
+
include ::Google::Protobuf::MessageExts
|
464
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
465
|
+
|
466
|
+
# The Cloud Storage input instances.
|
467
|
+
# @!attribute [rw] data_format
|
468
|
+
# @return [::Google::Cloud::AIPlatform::V1::Examples::ExampleGcsSource::DataFormat]
|
469
|
+
# The format in which instances are given, if not specified, assume it's
|
470
|
+
# JSONL format. Currently only JSONL format is supported.
|
471
|
+
# @!attribute [rw] gcs_source
|
472
|
+
# @return [::Google::Cloud::AIPlatform::V1::GcsSource]
|
473
|
+
# The Cloud Storage location for the input instances.
|
474
|
+
class ExampleGcsSource
|
475
|
+
include ::Google::Protobuf::MessageExts
|
476
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
477
|
+
|
478
|
+
# The format of the input example instances.
|
479
|
+
module DataFormat
|
480
|
+
# Format unspecified, used when unset.
|
481
|
+
DATA_FORMAT_UNSPECIFIED = 0
|
482
|
+
|
483
|
+
# Examples are stored in JSONL files.
|
484
|
+
JSONL = 1
|
485
|
+
end
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
# Preset configuration for example-based explanations
|
490
|
+
# @!attribute [rw] query
|
491
|
+
# @return [::Google::Cloud::AIPlatform::V1::Presets::Query]
|
492
|
+
# Preset option controlling parameters for speed-precision trade-off when
|
493
|
+
# querying for examples. If omitted, defaults to `PRECISE`.
|
494
|
+
# @!attribute [rw] modality
|
495
|
+
# @return [::Google::Cloud::AIPlatform::V1::Presets::Modality]
|
496
|
+
# The modality of the uploaded model, which automatically configures the
|
497
|
+
# distance measurement and feature normalization for the underlying example
|
498
|
+
# index and queries. If your model does not precisely fit one of these types,
|
499
|
+
# it is okay to choose the closest type.
|
500
|
+
class Presets
|
501
|
+
include ::Google::Protobuf::MessageExts
|
502
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
503
|
+
|
504
|
+
# Preset option controlling parameters for query speed-precision trade-off
|
505
|
+
module Query
|
506
|
+
# More precise neighbors as a trade-off against slower response.
|
507
|
+
PRECISE = 0
|
508
|
+
|
509
|
+
# Faster response as a trade-off against less precise neighbors.
|
510
|
+
FAST = 1
|
511
|
+
end
|
512
|
+
|
513
|
+
# Preset option controlling parameters for different modalities
|
514
|
+
module Modality
|
515
|
+
# Should not be set. Added as a recommended best practice for enums
|
516
|
+
MODALITY_UNSPECIFIED = 0
|
517
|
+
|
518
|
+
# IMAGE modality
|
519
|
+
IMAGE = 1
|
520
|
+
|
521
|
+
# TEXT modality
|
522
|
+
TEXT = 2
|
523
|
+
|
524
|
+
# TABULAR modality
|
525
|
+
TABULAR = 3
|
526
|
+
end
|
527
|
+
end
|
528
|
+
|
440
529
|
# The {::Google::Cloud::AIPlatform::V1::ExplanationSpec ExplanationSpec} entries
|
441
530
|
# that can be overridden at [online
|
442
531
|
# explanation][google.cloud.aiplatform.v1.PredictionService.Explain] time.
|
@@ -0,0 +1,156 @@
|
|
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
|
+
# The request message for
|
25
|
+
# {::Google::Cloud::AIPlatform::V1::MatchService::Client#find_neighbors MatchService.FindNeighbors}.
|
26
|
+
# @!attribute [rw] index_endpoint
|
27
|
+
# @return [::String]
|
28
|
+
# Required. The name of the index endpoint.
|
29
|
+
# Format:
|
30
|
+
# `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}`
|
31
|
+
# @!attribute [rw] deployed_index_id
|
32
|
+
# @return [::String]
|
33
|
+
# The ID of the DeployedIndex that will serve the request. This request is
|
34
|
+
# sent to a specific IndexEndpoint, as per the IndexEndpoint.network. That
|
35
|
+
# IndexEndpoint also has IndexEndpoint.deployed_indexes, and each such index
|
36
|
+
# has a DeployedIndex.id field.
|
37
|
+
# The value of the field below must equal one of the DeployedIndex.id
|
38
|
+
# fields of the IndexEndpoint that is being called for this request.
|
39
|
+
# @!attribute [rw] queries
|
40
|
+
# @return [::Array<::Google::Cloud::AIPlatform::V1::FindNeighborsRequest::Query>]
|
41
|
+
# The list of queries.
|
42
|
+
# @!attribute [rw] return_full_datapoint
|
43
|
+
# @return [::Boolean]
|
44
|
+
# If set to true, the full datapoints (including all vector values and
|
45
|
+
# restricts) of the nearest neighbors are returned.
|
46
|
+
# Note that returning full datapoint will significantly increase the
|
47
|
+
# latency and cost of the query.
|
48
|
+
class FindNeighborsRequest
|
49
|
+
include ::Google::Protobuf::MessageExts
|
50
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
51
|
+
|
52
|
+
# A query to find a number of the nearest neighbors (most similar vectors)
|
53
|
+
# of a vector.
|
54
|
+
# @!attribute [rw] datapoint
|
55
|
+
# @return [::Google::Cloud::AIPlatform::V1::IndexDatapoint]
|
56
|
+
# Required. The datapoint/vector whose nearest neighbors should be searched
|
57
|
+
# for.
|
58
|
+
# @!attribute [rw] neighbor_count
|
59
|
+
# @return [::Integer]
|
60
|
+
# The number of nearest neighbors to be retrieved from database for each
|
61
|
+
# query. If not set, will use the default from the service configuration
|
62
|
+
# (https://cloud.google.com/vertex-ai/docs/matching-engine/configuring-indexes#nearest-neighbor-search-config).
|
63
|
+
# @!attribute [rw] per_crowding_attribute_neighbor_count
|
64
|
+
# @return [::Integer]
|
65
|
+
# Crowding is a constraint on a neighbor list produced by nearest neighbor
|
66
|
+
# search requiring that no more than some value k' of the k neighbors
|
67
|
+
# returned have the same value of crowding_attribute.
|
68
|
+
# It's used for improving result diversity.
|
69
|
+
# This field is the maximum number of matches with the same crowding tag.
|
70
|
+
# @!attribute [rw] approximate_neighbor_count
|
71
|
+
# @return [::Integer]
|
72
|
+
# The number of neighbors to find via approximate search before
|
73
|
+
# exact reordering is performed. If not set, the default value from scam
|
74
|
+
# config is used; if set, this value must be > 0.
|
75
|
+
# @!attribute [rw] fraction_leaf_nodes_to_search_override
|
76
|
+
# @return [::Float]
|
77
|
+
# The fraction of the number of leaves to search, set at query time allows
|
78
|
+
# user to tune search performance. This value increase result in both
|
79
|
+
# search accuracy and latency increase. The value should be between 0.0
|
80
|
+
# and 1.0. If not set or set to 0.0, query uses the default value specified
|
81
|
+
# in
|
82
|
+
# NearestNeighborSearchConfig.TreeAHConfig.fraction_leaf_nodes_to_search.
|
83
|
+
class Query
|
84
|
+
include ::Google::Protobuf::MessageExts
|
85
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# The response message for
|
90
|
+
# {::Google::Cloud::AIPlatform::V1::MatchService::Client#find_neighbors MatchService.FindNeighbors}.
|
91
|
+
# @!attribute [rw] nearest_neighbors
|
92
|
+
# @return [::Array<::Google::Cloud::AIPlatform::V1::FindNeighborsResponse::NearestNeighbors>]
|
93
|
+
# The nearest neighbors of the query datapoints.
|
94
|
+
class FindNeighborsResponse
|
95
|
+
include ::Google::Protobuf::MessageExts
|
96
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
97
|
+
|
98
|
+
# A neighbor of the query vector.
|
99
|
+
# @!attribute [rw] datapoint
|
100
|
+
# @return [::Google::Cloud::AIPlatform::V1::IndexDatapoint]
|
101
|
+
# The datapoint of the neighbor.
|
102
|
+
# Note that full datapoints are returned only when "return_full_datapoint"
|
103
|
+
# is set to true. Otherwise, only the "datapoint_id" and "crowding_tag"
|
104
|
+
# fields are populated.
|
105
|
+
# @!attribute [rw] distance
|
106
|
+
# @return [::Float]
|
107
|
+
# The distance between the neighbor and the query vector.
|
108
|
+
class Neighbor
|
109
|
+
include ::Google::Protobuf::MessageExts
|
110
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
111
|
+
end
|
112
|
+
|
113
|
+
# Nearest neighbors for one query.
|
114
|
+
# @!attribute [rw] id
|
115
|
+
# @return [::String]
|
116
|
+
# The ID of the query datapoint.
|
117
|
+
# @!attribute [rw] neighbors
|
118
|
+
# @return [::Array<::Google::Cloud::AIPlatform::V1::FindNeighborsResponse::Neighbor>]
|
119
|
+
# All its neighbors.
|
120
|
+
class NearestNeighbors
|
121
|
+
include ::Google::Protobuf::MessageExts
|
122
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# The request message for
|
127
|
+
# {::Google::Cloud::AIPlatform::V1::MatchService::Client#read_index_datapoints MatchService.ReadIndexDatapoints}.
|
128
|
+
# @!attribute [rw] index_endpoint
|
129
|
+
# @return [::String]
|
130
|
+
# Required. The name of the index endpoint.
|
131
|
+
# Format:
|
132
|
+
# `projects/{project}/locations/{location}/indexEndpoints/{index_endpoint}`
|
133
|
+
# @!attribute [rw] deployed_index_id
|
134
|
+
# @return [::String]
|
135
|
+
# The ID of the DeployedIndex that will serve the request.
|
136
|
+
# @!attribute [rw] ids
|
137
|
+
# @return [::Array<::String>]
|
138
|
+
# IDs of the datapoints to be searched for.
|
139
|
+
class ReadIndexDatapointsRequest
|
140
|
+
include ::Google::Protobuf::MessageExts
|
141
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
142
|
+
end
|
143
|
+
|
144
|
+
# The response message for
|
145
|
+
# {::Google::Cloud::AIPlatform::V1::MatchService::Client#read_index_datapoints MatchService.ReadIndexDatapoints}.
|
146
|
+
# @!attribute [rw] datapoints
|
147
|
+
# @return [::Array<::Google::Cloud::AIPlatform::V1::IndexDatapoint>]
|
148
|
+
# The result list of datapoints.
|
149
|
+
class ReadIndexDatapointsResponse
|
150
|
+
include ::Google::Protobuf::MessageExts
|
151
|
+
extend ::Google::Protobuf::MessageExts::ClassMethods
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-ai_platform-v1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gapic-common
|
@@ -246,6 +246,10 @@ files:
|
|
246
246
|
- lib/google/cloud/ai_platform/v1/job_service/credentials.rb
|
247
247
|
- lib/google/cloud/ai_platform/v1/job_service/operations.rb
|
248
248
|
- lib/google/cloud/ai_platform/v1/job_service/paths.rb
|
249
|
+
- lib/google/cloud/ai_platform/v1/match_service.rb
|
250
|
+
- lib/google/cloud/ai_platform/v1/match_service/client.rb
|
251
|
+
- lib/google/cloud/ai_platform/v1/match_service/credentials.rb
|
252
|
+
- lib/google/cloud/ai_platform/v1/match_service/paths.rb
|
249
253
|
- lib/google/cloud/ai_platform/v1/metadata_service.rb
|
250
254
|
- lib/google/cloud/ai_platform/v1/metadata_service/client.rb
|
251
255
|
- lib/google/cloud/ai_platform/v1/metadata_service/credentials.rb
|
@@ -335,6 +339,8 @@ files:
|
|
335
339
|
- lib/google/cloud/aiplatform/v1/lineage_subgraph_pb.rb
|
336
340
|
- lib/google/cloud/aiplatform/v1/machine_resources_pb.rb
|
337
341
|
- lib/google/cloud/aiplatform/v1/manual_batch_tuning_parameters_pb.rb
|
342
|
+
- lib/google/cloud/aiplatform/v1/match_service_pb.rb
|
343
|
+
- lib/google/cloud/aiplatform/v1/match_service_services_pb.rb
|
338
344
|
- lib/google/cloud/aiplatform/v1/metadata_schema_pb.rb
|
339
345
|
- lib/google/cloud/aiplatform/v1/metadata_service_pb.rb
|
340
346
|
- lib/google/cloud/aiplatform/v1/metadata_service_services_pb.rb
|
@@ -426,6 +432,7 @@ files:
|
|
426
432
|
- proto_docs/google/cloud/aiplatform/v1/lineage_subgraph.rb
|
427
433
|
- proto_docs/google/cloud/aiplatform/v1/machine_resources.rb
|
428
434
|
- proto_docs/google/cloud/aiplatform/v1/manual_batch_tuning_parameters.rb
|
435
|
+
- proto_docs/google/cloud/aiplatform/v1/match_service.rb
|
429
436
|
- proto_docs/google/cloud/aiplatform/v1/metadata_schema.rb
|
430
437
|
- proto_docs/google/cloud/aiplatform/v1/metadata_service.rb
|
431
438
|
- proto_docs/google/cloud/aiplatform/v1/metadata_store.rb
|