google-cloud-vector_search-v1 0.a → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/cloud/vector_search/v1/bindings_override.rb +75 -0
  6. data/lib/google/cloud/vector_search/v1/data_object_search_service/client.rb +851 -0
  7. data/lib/google/cloud/vector_search/v1/data_object_search_service/credentials.rb +47 -0
  8. data/lib/google/cloud/vector_search/v1/data_object_search_service/paths.rb +73 -0
  9. data/lib/google/cloud/vector_search/v1/data_object_search_service/rest/client.rb +788 -0
  10. data/lib/google/cloud/vector_search/v1/data_object_search_service/rest/service_stub.rb +329 -0
  11. data/lib/google/cloud/vector_search/v1/data_object_search_service/rest.rb +53 -0
  12. data/lib/google/cloud/vector_search/v1/data_object_search_service.rb +55 -0
  13. data/lib/google/cloud/vector_search/v1/data_object_service/client.rb +1115 -0
  14. data/lib/google/cloud/vector_search/v1/data_object_service/credentials.rb +47 -0
  15. data/lib/google/cloud/vector_search/v1/data_object_service/paths.rb +73 -0
  16. data/lib/google/cloud/vector_search/v1/data_object_service/rest/client.rb +1031 -0
  17. data/lib/google/cloud/vector_search/v1/data_object_service/rest/service_stub.rb +513 -0
  18. data/lib/google/cloud/vector_search/v1/data_object_service/rest.rb +53 -0
  19. data/lib/google/cloud/vector_search/v1/data_object_service.rb +55 -0
  20. data/lib/google/cloud/vector_search/v1/rest.rb +40 -0
  21. data/lib/google/cloud/vector_search/v1/vector_search_service/client.rb +1831 -0
  22. data/lib/google/cloud/vector_search/v1/vector_search_service/credentials.rb +47 -0
  23. data/lib/google/cloud/vector_search/v1/vector_search_service/operations.rb +843 -0
  24. data/lib/google/cloud/vector_search/v1/vector_search_service/paths.rb +111 -0
  25. data/lib/google/cloud/vector_search/v1/vector_search_service/rest/client.rb +1712 -0
  26. data/lib/google/cloud/vector_search/v1/vector_search_service/rest/operations.rb +927 -0
  27. data/lib/google/cloud/vector_search/v1/vector_search_service/rest/service_stub.rb +819 -0
  28. data/lib/google/cloud/vector_search/v1/vector_search_service/rest.rb +58 -0
  29. data/lib/google/cloud/vector_search/v1/vector_search_service.rb +60 -0
  30. data/lib/google/cloud/vector_search/v1/version.rb +7 -2
  31. data/lib/google/cloud/vector_search/v1.rb +47 -0
  32. data/lib/google/cloud/vectorsearch/v1/common_pb.rb +21 -0
  33. data/lib/google/cloud/vectorsearch/v1/data_object_pb.rb +29 -0
  34. data/lib/google/cloud/vectorsearch/v1/data_object_search_service_pb.rb +50 -0
  35. data/lib/google/cloud/vectorsearch/v1/data_object_search_service_services_pb.rb +51 -0
  36. data/lib/google/cloud/vectorsearch/v1/data_object_service_pb.rb +37 -0
  37. data/lib/google/cloud/vectorsearch/v1/data_object_service_services_pb.rb +57 -0
  38. data/lib/google/cloud/vectorsearch/v1/embedding_config_pb.rb +24 -0
  39. data/lib/google/cloud/vectorsearch/v1/encryption_spec_pb.rb +24 -0
  40. data/lib/google/cloud/vectorsearch/v1/vectorsearch_service_pb.rb +69 -0
  41. data/lib/google/cloud/vectorsearch/v1/vectorsearch_service_services_pb.rb +71 -0
  42. data/lib/google-cloud-vector_search-v1.rb +21 -0
  43. data/proto_docs/README.md +4 -0
  44. data/proto_docs/google/api/client.rb +593 -0
  45. data/proto_docs/google/api/field_behavior.rb +85 -0
  46. data/proto_docs/google/api/field_info.rb +88 -0
  47. data/proto_docs/google/api/launch_stage.rb +71 -0
  48. data/proto_docs/google/api/resource.rb +227 -0
  49. data/proto_docs/google/cloud/vectorsearch/v1/common.rb +38 -0
  50. data/proto_docs/google/cloud/vectorsearch/v1/data_object.rb +104 -0
  51. data/proto_docs/google/cloud/vectorsearch/v1/data_object_search_service.rb +397 -0
  52. data/proto_docs/google/cloud/vectorsearch/v1/data_object_service.rb +156 -0
  53. data/proto_docs/google/cloud/vectorsearch/v1/embedding_config.rb +76 -0
  54. data/proto_docs/google/cloud/vectorsearch/v1/encryption_spec.rb +40 -0
  55. data/proto_docs/google/cloud/vectorsearch/v1/vectorsearch_service.rb +723 -0
  56. data/proto_docs/google/longrunning/operations.rb +191 -0
  57. data/proto_docs/google/protobuf/any.rb +145 -0
  58. data/proto_docs/google/protobuf/duration.rb +98 -0
  59. data/proto_docs/google/protobuf/empty.rb +34 -0
  60. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  61. data/proto_docs/google/protobuf/struct.rb +108 -0
  62. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  63. data/proto_docs/google/rpc/status.rb +48 -0
  64. metadata +122 -9
@@ -0,0 +1,851 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 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/vectorsearch/v1/data_object_search_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module VectorSearch
26
+ module V1
27
+ module DataObjectSearchService
28
+ ##
29
+ # Client for the DataObjectSearchService service.
30
+ #
31
+ # Service for searching data objects.
32
+ #
33
+ class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "vectorsearch.$UNIVERSE_DOMAIN$"
39
+
40
+ include Paths
41
+
42
+ # @private
43
+ attr_reader :data_object_search_service_stub
44
+
45
+ ##
46
+ # Configure the DataObjectSearchService Client class.
47
+ #
48
+ # See {::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client::Configuration}
49
+ # for a description of the configuration fields.
50
+ #
51
+ # @example
52
+ #
53
+ # # Modify the configuration for all DataObjectSearchService clients
54
+ # ::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
57
+ #
58
+ # @yield [config] Configure the Client client.
59
+ # @yieldparam config [Client::Configuration]
60
+ #
61
+ # @return [Client::Configuration]
62
+ #
63
+ def self.configure
64
+ @configure ||= begin
65
+ namespace = ["Google", "Cloud", "VectorSearch", "V1"]
66
+ parent_config = while namespace.any?
67
+ parent_name = namespace.join "::"
68
+ parent_const = const_get parent_name
69
+ break parent_const.configure if parent_const.respond_to? :configure
70
+ namespace.pop
71
+ end
72
+ default_config = Client::Configuration.new parent_config
73
+
74
+ default_config.rpcs.search_data_objects.timeout = 300.0
75
+ default_config.rpcs.search_data_objects.retry_policy = {
76
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
77
+ }
78
+
79
+ default_config.rpcs.query_data_objects.timeout = 300.0
80
+ default_config.rpcs.query_data_objects.retry_policy = {
81
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
82
+ }
83
+
84
+ default_config.rpcs.aggregate_data_objects.timeout = 300.0
85
+ default_config.rpcs.aggregate_data_objects.retry_policy = {
86
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
87
+ }
88
+
89
+ default_config.rpcs.batch_search_data_objects.timeout = 300.0
90
+ default_config.rpcs.batch_search_data_objects.retry_policy = {
91
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
92
+ }
93
+
94
+ default_config
95
+ end
96
+ yield @configure if block_given?
97
+ @configure
98
+ end
99
+
100
+ ##
101
+ # Configure the DataObjectSearchService Client instance.
102
+ #
103
+ # The configuration is set to the derived mode, meaning that values can be changed,
104
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
105
+ # should be made on {Client.configure}.
106
+ #
107
+ # See {::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client::Configuration}
108
+ # for a description of the configuration fields.
109
+ #
110
+ # @yield [config] Configure the Client client.
111
+ # @yieldparam config [Client::Configuration]
112
+ #
113
+ # @return [Client::Configuration]
114
+ #
115
+ def configure
116
+ yield @config if block_given?
117
+ @config
118
+ end
119
+
120
+ ##
121
+ # The effective universe domain
122
+ #
123
+ # @return [String]
124
+ #
125
+ def universe_domain
126
+ @data_object_search_service_stub.universe_domain
127
+ end
128
+
129
+ ##
130
+ # Create a new DataObjectSearchService client object.
131
+ #
132
+ # @example
133
+ #
134
+ # # Create a client using the default configuration
135
+ # client = ::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.new
136
+ #
137
+ # # Create a client using a custom configuration
138
+ # client = ::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.new do |config|
139
+ # config.timeout = 10.0
140
+ # end
141
+ #
142
+ # @yield [config] Configure the DataObjectSearchService client.
143
+ # @yieldparam config [Client::Configuration]
144
+ #
145
+ def initialize
146
+ # These require statements are intentionally placed here to initialize
147
+ # the gRPC module only when it's required.
148
+ # See https://github.com/googleapis/toolkit/issues/446
149
+ require "gapic/grpc"
150
+ require "google/cloud/vectorsearch/v1/data_object_search_service_services_pb"
151
+
152
+ # Create the configuration object
153
+ @config = Configuration.new Client.configure
154
+
155
+ # Yield the configuration if needed
156
+ yield @config if block_given?
157
+
158
+ # Create credentials
159
+ credentials = @config.credentials
160
+ # Use self-signed JWT if the endpoint is unchanged from default,
161
+ # but only if the default endpoint does not have a region prefix.
162
+ enable_self_signed_jwt = @config.endpoint.nil? ||
163
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
164
+ !@config.endpoint.split(".").first.include?("-"))
165
+ credentials ||= Credentials.default scope: @config.scope,
166
+ enable_self_signed_jwt: enable_self_signed_jwt
167
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
168
+ credentials = Credentials.new credentials, scope: @config.scope
169
+ end
170
+ @quota_project_id = @config.quota_project
171
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
172
+
173
+ @data_object_search_service_stub = ::Gapic::ServiceStub.new(
174
+ ::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Stub,
175
+ credentials: credentials,
176
+ endpoint: @config.endpoint,
177
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
178
+ universe_domain: @config.universe_domain,
179
+ channel_args: @config.channel_args,
180
+ interceptors: @config.interceptors,
181
+ channel_pool_config: @config.channel_pool,
182
+ logger: @config.logger
183
+ )
184
+
185
+ @data_object_search_service_stub.stub_logger&.info do |entry|
186
+ entry.set_system_name
187
+ entry.set_service
188
+ entry.message = "Created client for #{entry.service}"
189
+ entry.set_credentials_fields credentials
190
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
191
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
192
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
193
+ end
194
+
195
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
196
+ config.credentials = credentials
197
+ config.quota_project = @quota_project_id
198
+ config.endpoint = @data_object_search_service_stub.endpoint
199
+ config.universe_domain = @data_object_search_service_stub.universe_domain
200
+ config.logger = @data_object_search_service_stub.logger if config.respond_to? :logger=
201
+ end
202
+ end
203
+
204
+ ##
205
+ # Get the associated client for mix-in of the Locations.
206
+ #
207
+ # @return [Google::Cloud::Location::Locations::Client]
208
+ #
209
+ attr_reader :location_client
210
+
211
+ ##
212
+ # The logger used for request/response debug logging.
213
+ #
214
+ # @return [Logger]
215
+ #
216
+ def logger
217
+ @data_object_search_service_stub.logger
218
+ end
219
+
220
+ # Service calls
221
+
222
+ ##
223
+ # Searches data objects.
224
+ #
225
+ # @overload search_data_objects(request, options = nil)
226
+ # Pass arguments to `search_data_objects` via a request object, either of type
227
+ # {::Google::Cloud::VectorSearch::V1::SearchDataObjectsRequest} or an equivalent Hash.
228
+ #
229
+ # @param request [::Google::Cloud::VectorSearch::V1::SearchDataObjectsRequest, ::Hash]
230
+ # A request object representing the call parameters. Required. To specify no
231
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
232
+ # @param options [::Gapic::CallOptions, ::Hash]
233
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
234
+ #
235
+ # @overload search_data_objects(vector_search: nil, semantic_search: nil, text_search: nil, parent: nil, page_size: nil, page_token: nil)
236
+ # Pass arguments to `search_data_objects` via keyword arguments. Note that at
237
+ # least one keyword argument is required. To specify no parameters, or to keep all
238
+ # the default parameter values, pass an empty Hash as a request object (see above).
239
+ #
240
+ # @param vector_search [::Google::Cloud::VectorSearch::V1::VectorSearch, ::Hash]
241
+ # A vector search operation.
242
+ #
243
+ # Note: The following parameters are mutually exclusive: `vector_search`, `semantic_search`, `text_search`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
244
+ # @param semantic_search [::Google::Cloud::VectorSearch::V1::SemanticSearch, ::Hash]
245
+ # A semantic search operation.
246
+ #
247
+ # Note: The following parameters are mutually exclusive: `semantic_search`, `vector_search`, `text_search`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
248
+ # @param text_search [::Google::Cloud::VectorSearch::V1::TextSearch, ::Hash]
249
+ # Optional. A text search operation.
250
+ #
251
+ # Note: The following parameters are mutually exclusive: `text_search`, `vector_search`, `semantic_search`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
252
+ # @param parent [::String]
253
+ # Required. The resource name of the Collection for which to search.
254
+ # Format: `projects/{project}/locations/{location}/collections/{collection}`
255
+ # @param page_size [::Integer]
256
+ # Optional. The standard list page size. Only supported for KNN. If not set,
257
+ # up to search_type.top_k results will be returned. The maximum value is
258
+ # 1000; values above 1000 will be coerced to 1000.
259
+ # @param page_token [::String]
260
+ # Optional. The standard list page token.
261
+ # Typically obtained via
262
+ # {::Google::Cloud::VectorSearch::V1::SearchDataObjectsResponse#next_page_token SearchDataObjectsResponse.next_page_token}
263
+ # of the previous
264
+ # {::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client#search_data_objects DataObjectSearchService.SearchDataObjects}
265
+ # call.
266
+ #
267
+ # @yield [response, operation] Access the result along with the RPC operation
268
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::VectorSearch::V1::SearchResult>]
269
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
270
+ #
271
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::VectorSearch::V1::SearchResult>]
272
+ #
273
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
274
+ #
275
+ # @example Basic example
276
+ # require "google/cloud/vector_search/v1"
277
+ #
278
+ # # Create a client object. The client can be reused for multiple calls.
279
+ # client = Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.new
280
+ #
281
+ # # Create a request. To set request fields, pass in keyword arguments.
282
+ # request = Google::Cloud::VectorSearch::V1::SearchDataObjectsRequest.new
283
+ #
284
+ # # Call the search_data_objects method.
285
+ # result = client.search_data_objects request
286
+ #
287
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
288
+ # # over elements, and API calls will be issued to fetch pages as needed.
289
+ # result.each do |item|
290
+ # # Each element is of type ::Google::Cloud::VectorSearch::V1::SearchResult.
291
+ # p item
292
+ # end
293
+ #
294
+ def search_data_objects request, options = nil
295
+ raise ::ArgumentError, "request must be provided" if request.nil?
296
+
297
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::SearchDataObjectsRequest
298
+
299
+ # Converts hash and nil to an options object
300
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
301
+
302
+ # Customize the options with defaults
303
+ metadata = @config.rpcs.search_data_objects.metadata.to_h
304
+
305
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
306
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
307
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
308
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
309
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
310
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
311
+
312
+ header_params = {}
313
+ if request.parent
314
+ header_params["parent"] = request.parent
315
+ end
316
+
317
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
318
+ metadata[:"x-goog-request-params"] ||= request_params_header
319
+
320
+ options.apply_defaults timeout: @config.rpcs.search_data_objects.timeout,
321
+ metadata: metadata,
322
+ retry_policy: @config.rpcs.search_data_objects.retry_policy
323
+
324
+ options.apply_defaults timeout: @config.timeout,
325
+ metadata: @config.metadata,
326
+ retry_policy: @config.retry_policy
327
+
328
+ @data_object_search_service_stub.call_rpc :search_data_objects, request, options: options do |response, operation|
329
+ response = ::Gapic::PagedEnumerable.new @data_object_search_service_stub, :search_data_objects, request, response, operation, options
330
+ yield response, operation if block_given?
331
+ throw :response, response
332
+ end
333
+ rescue ::GRPC::BadStatus => e
334
+ raise ::Google::Cloud::Error.from_error(e)
335
+ end
336
+
337
+ ##
338
+ # Queries data objects.
339
+ #
340
+ # @overload query_data_objects(request, options = nil)
341
+ # Pass arguments to `query_data_objects` via a request object, either of type
342
+ # {::Google::Cloud::VectorSearch::V1::QueryDataObjectsRequest} or an equivalent Hash.
343
+ #
344
+ # @param request [::Google::Cloud::VectorSearch::V1::QueryDataObjectsRequest, ::Hash]
345
+ # A request object representing the call parameters. Required. To specify no
346
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
347
+ # @param options [::Gapic::CallOptions, ::Hash]
348
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
349
+ #
350
+ # @overload query_data_objects(parent: nil, filter: nil, output_fields: nil, page_size: nil, page_token: nil)
351
+ # Pass arguments to `query_data_objects` via keyword arguments. Note that at
352
+ # least one keyword argument is required. To specify no parameters, or to keep all
353
+ # the default parameter values, pass an empty Hash as a request object (see above).
354
+ #
355
+ # @param parent [::String]
356
+ # Required. The resource name of the Collection for which to query.
357
+ # Format: `projects/{project}/locations/{location}/collections/{collection}`
358
+ # @param filter [::Google::Protobuf::Struct, ::Hash]
359
+ # Optional. A JSON filter expression, e.g. \\{"genre": \\{"$eq": "sci-fi"}},
360
+ # represented as a google.protobuf.Struct.
361
+ # @param output_fields [::Google::Cloud::VectorSearch::V1::OutputFields, ::Hash]
362
+ # Optional. Mask specifying which fields to return.
363
+ # @param page_size [::Integer]
364
+ # Optional. The standard list page size. Default is 100.
365
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
366
+ # @param page_token [::String]
367
+ # Optional. The standard list page token.
368
+ # Typically obtained via
369
+ # {::Google::Cloud::VectorSearch::V1::QueryDataObjectsResponse#next_page_token QueryDataObjectsResponse.next_page_token}
370
+ # of the previous
371
+ # {::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client#query_data_objects DataObjectSearchService.QueryDataObjects}
372
+ # call.
373
+ #
374
+ # @yield [response, operation] Access the result along with the RPC operation
375
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::VectorSearch::V1::DataObject>]
376
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
377
+ #
378
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::VectorSearch::V1::DataObject>]
379
+ #
380
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
381
+ #
382
+ # @example Basic example
383
+ # require "google/cloud/vector_search/v1"
384
+ #
385
+ # # Create a client object. The client can be reused for multiple calls.
386
+ # client = Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.new
387
+ #
388
+ # # Create a request. To set request fields, pass in keyword arguments.
389
+ # request = Google::Cloud::VectorSearch::V1::QueryDataObjectsRequest.new
390
+ #
391
+ # # Call the query_data_objects method.
392
+ # result = client.query_data_objects request
393
+ #
394
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
395
+ # # over elements, and API calls will be issued to fetch pages as needed.
396
+ # result.each do |item|
397
+ # # Each element is of type ::Google::Cloud::VectorSearch::V1::DataObject.
398
+ # p item
399
+ # end
400
+ #
401
+ def query_data_objects request, options = nil
402
+ raise ::ArgumentError, "request must be provided" if request.nil?
403
+
404
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::QueryDataObjectsRequest
405
+
406
+ # Converts hash and nil to an options object
407
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
408
+
409
+ # Customize the options with defaults
410
+ metadata = @config.rpcs.query_data_objects.metadata.to_h
411
+
412
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
413
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
414
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
415
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
416
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
417
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
418
+
419
+ header_params = {}
420
+ if request.parent
421
+ header_params["parent"] = request.parent
422
+ end
423
+
424
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
425
+ metadata[:"x-goog-request-params"] ||= request_params_header
426
+
427
+ options.apply_defaults timeout: @config.rpcs.query_data_objects.timeout,
428
+ metadata: metadata,
429
+ retry_policy: @config.rpcs.query_data_objects.retry_policy
430
+
431
+ options.apply_defaults timeout: @config.timeout,
432
+ metadata: @config.metadata,
433
+ retry_policy: @config.retry_policy
434
+
435
+ @data_object_search_service_stub.call_rpc :query_data_objects, request, options: options do |response, operation|
436
+ response = ::Gapic::PagedEnumerable.new @data_object_search_service_stub, :query_data_objects, request, response, operation, options
437
+ yield response, operation if block_given?
438
+ throw :response, response
439
+ end
440
+ rescue ::GRPC::BadStatus => e
441
+ raise ::Google::Cloud::Error.from_error(e)
442
+ end
443
+
444
+ ##
445
+ # Aggregates data objects.
446
+ #
447
+ # @overload aggregate_data_objects(request, options = nil)
448
+ # Pass arguments to `aggregate_data_objects` via a request object, either of type
449
+ # {::Google::Cloud::VectorSearch::V1::AggregateDataObjectsRequest} or an equivalent Hash.
450
+ #
451
+ # @param request [::Google::Cloud::VectorSearch::V1::AggregateDataObjectsRequest, ::Hash]
452
+ # A request object representing the call parameters. Required. To specify no
453
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
454
+ # @param options [::Gapic::CallOptions, ::Hash]
455
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
456
+ #
457
+ # @overload aggregate_data_objects(parent: nil, filter: nil, aggregate: nil)
458
+ # Pass arguments to `aggregate_data_objects` via keyword arguments. Note that at
459
+ # least one keyword argument is required. To specify no parameters, or to keep all
460
+ # the default parameter values, pass an empty Hash as a request object (see above).
461
+ #
462
+ # @param parent [::String]
463
+ # Required. The resource name of the Collection for which to query.
464
+ # Format: `projects/{project}/locations/{location}/collections/{collection}`
465
+ # @param filter [::Google::Protobuf::Struct, ::Hash]
466
+ # Optional. A JSON filter expression, e.g. \\{"genre": \\{"$eq": "sci-fi"}},
467
+ # represented as a google.protobuf.Struct.
468
+ # @param aggregate [::Google::Cloud::VectorSearch::V1::AggregationMethod]
469
+ # Required. The aggregation method to apply to the query.
470
+ #
471
+ # @yield [response, operation] Access the result along with the RPC operation
472
+ # @yieldparam response [::Google::Cloud::VectorSearch::V1::AggregateDataObjectsResponse]
473
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
474
+ #
475
+ # @return [::Google::Cloud::VectorSearch::V1::AggregateDataObjectsResponse]
476
+ #
477
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
478
+ #
479
+ # @example Basic example
480
+ # require "google/cloud/vector_search/v1"
481
+ #
482
+ # # Create a client object. The client can be reused for multiple calls.
483
+ # client = Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.new
484
+ #
485
+ # # Create a request. To set request fields, pass in keyword arguments.
486
+ # request = Google::Cloud::VectorSearch::V1::AggregateDataObjectsRequest.new
487
+ #
488
+ # # Call the aggregate_data_objects method.
489
+ # result = client.aggregate_data_objects request
490
+ #
491
+ # # The returned object is of type Google::Cloud::VectorSearch::V1::AggregateDataObjectsResponse.
492
+ # p result
493
+ #
494
+ def aggregate_data_objects request, options = nil
495
+ raise ::ArgumentError, "request must be provided" if request.nil?
496
+
497
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::AggregateDataObjectsRequest
498
+
499
+ # Converts hash and nil to an options object
500
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
501
+
502
+ # Customize the options with defaults
503
+ metadata = @config.rpcs.aggregate_data_objects.metadata.to_h
504
+
505
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
506
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
507
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
508
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
509
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
510
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
511
+
512
+ header_params = {}
513
+ if request.parent
514
+ header_params["parent"] = request.parent
515
+ end
516
+
517
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
518
+ metadata[:"x-goog-request-params"] ||= request_params_header
519
+
520
+ options.apply_defaults timeout: @config.rpcs.aggregate_data_objects.timeout,
521
+ metadata: metadata,
522
+ retry_policy: @config.rpcs.aggregate_data_objects.retry_policy
523
+
524
+ options.apply_defaults timeout: @config.timeout,
525
+ metadata: @config.metadata,
526
+ retry_policy: @config.retry_policy
527
+
528
+ @data_object_search_service_stub.call_rpc :aggregate_data_objects, request, options: options do |response, operation|
529
+ yield response, operation if block_given?
530
+ end
531
+ rescue ::GRPC::BadStatus => e
532
+ raise ::Google::Cloud::Error.from_error(e)
533
+ end
534
+
535
+ ##
536
+ # Batch searches data objects.
537
+ #
538
+ # @overload batch_search_data_objects(request, options = nil)
539
+ # Pass arguments to `batch_search_data_objects` via a request object, either of type
540
+ # {::Google::Cloud::VectorSearch::V1::BatchSearchDataObjectsRequest} or an equivalent Hash.
541
+ #
542
+ # @param request [::Google::Cloud::VectorSearch::V1::BatchSearchDataObjectsRequest, ::Hash]
543
+ # A request object representing the call parameters. Required. To specify no
544
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
545
+ # @param options [::Gapic::CallOptions, ::Hash]
546
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
547
+ #
548
+ # @overload batch_search_data_objects(parent: nil, searches: nil, combine: nil)
549
+ # Pass arguments to `batch_search_data_objects` via keyword arguments. Note that at
550
+ # least one keyword argument is required. To specify no parameters, or to keep all
551
+ # the default parameter values, pass an empty Hash as a request object (see above).
552
+ #
553
+ # @param parent [::String]
554
+ # Required. The resource name of the Collection for which to search.
555
+ # Format: `projects/{project}/locations/{location}/collections/{collection}`
556
+ # @param searches [::Array<::Google::Cloud::VectorSearch::V1::Search, ::Hash>]
557
+ # Required. A list of search requests to execute in parallel.
558
+ # @param combine [::Google::Cloud::VectorSearch::V1::BatchSearchDataObjectsRequest::CombineResultsOptions, ::Hash]
559
+ # Optional. Options for combining the results of the batch search operations.
560
+ #
561
+ # @yield [response, operation] Access the result along with the RPC operation
562
+ # @yieldparam response [::Google::Cloud::VectorSearch::V1::BatchSearchDataObjectsResponse]
563
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
564
+ #
565
+ # @return [::Google::Cloud::VectorSearch::V1::BatchSearchDataObjectsResponse]
566
+ #
567
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
568
+ #
569
+ # @example Basic example
570
+ # require "google/cloud/vector_search/v1"
571
+ #
572
+ # # Create a client object. The client can be reused for multiple calls.
573
+ # client = Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.new
574
+ #
575
+ # # Create a request. To set request fields, pass in keyword arguments.
576
+ # request = Google::Cloud::VectorSearch::V1::BatchSearchDataObjectsRequest.new
577
+ #
578
+ # # Call the batch_search_data_objects method.
579
+ # result = client.batch_search_data_objects request
580
+ #
581
+ # # The returned object is of type Google::Cloud::VectorSearch::V1::BatchSearchDataObjectsResponse.
582
+ # p result
583
+ #
584
+ def batch_search_data_objects request, options = nil
585
+ raise ::ArgumentError, "request must be provided" if request.nil?
586
+
587
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::VectorSearch::V1::BatchSearchDataObjectsRequest
588
+
589
+ # Converts hash and nil to an options object
590
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
591
+
592
+ # Customize the options with defaults
593
+ metadata = @config.rpcs.batch_search_data_objects.metadata.to_h
594
+
595
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
596
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
597
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
598
+ gapic_version: ::Google::Cloud::VectorSearch::V1::VERSION
599
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
600
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
601
+
602
+ header_params = {}
603
+ if request.parent
604
+ header_params["parent"] = request.parent
605
+ end
606
+
607
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
608
+ metadata[:"x-goog-request-params"] ||= request_params_header
609
+
610
+ options.apply_defaults timeout: @config.rpcs.batch_search_data_objects.timeout,
611
+ metadata: metadata,
612
+ retry_policy: @config.rpcs.batch_search_data_objects.retry_policy
613
+
614
+ options.apply_defaults timeout: @config.timeout,
615
+ metadata: @config.metadata,
616
+ retry_policy: @config.retry_policy
617
+
618
+ @data_object_search_service_stub.call_rpc :batch_search_data_objects, request, options: options do |response, operation|
619
+ yield response, operation if block_given?
620
+ end
621
+ rescue ::GRPC::BadStatus => e
622
+ raise ::Google::Cloud::Error.from_error(e)
623
+ end
624
+
625
+ ##
626
+ # Configuration class for the DataObjectSearchService API.
627
+ #
628
+ # This class represents the configuration for DataObjectSearchService,
629
+ # providing control over timeouts, retry behavior, logging, transport
630
+ # parameters, and other low-level controls. Certain parameters can also be
631
+ # applied individually to specific RPCs. See
632
+ # {::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client::Configuration::Rpcs}
633
+ # for a list of RPCs that can be configured independently.
634
+ #
635
+ # Configuration can be applied globally to all clients, or to a single client
636
+ # on construction.
637
+ #
638
+ # @example
639
+ #
640
+ # # Modify the global config, setting the timeout for
641
+ # # search_data_objects to 20 seconds,
642
+ # # and all remaining timeouts to 10 seconds.
643
+ # ::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.configure do |config|
644
+ # config.timeout = 10.0
645
+ # config.rpcs.search_data_objects.timeout = 20.0
646
+ # end
647
+ #
648
+ # # Apply the above configuration only to a new client.
649
+ # client = ::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.new do |config|
650
+ # config.timeout = 10.0
651
+ # config.rpcs.search_data_objects.timeout = 20.0
652
+ # end
653
+ #
654
+ # @!attribute [rw] endpoint
655
+ # A custom service endpoint, as a hostname or hostname:port. The default is
656
+ # nil, indicating to use the default endpoint in the current universe domain.
657
+ # @return [::String,nil]
658
+ # @!attribute [rw] credentials
659
+ # Credentials to send with calls. You may provide any of the following types:
660
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
661
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
662
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
663
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
664
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
665
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
666
+ # * (`nil`) indicating no credentials
667
+ #
668
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
669
+ # is deprecated. Providing an unvalidated credential configuration to
670
+ # Google APIs can compromise the security of your systems and data.
671
+ #
672
+ # @example
673
+ #
674
+ # # The recommended way to provide credentials is to use the `make_creds` method
675
+ # # on the appropriate credentials class for your environment.
676
+ #
677
+ # require "googleauth"
678
+ #
679
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
680
+ # json_key_io: ::File.open("/path/to/keyfile.json")
681
+ # )
682
+ #
683
+ # client = ::Google::Cloud::VectorSearch::V1::DataObjectSearchService::Client.new do |config|
684
+ # config.credentials = credentials
685
+ # end
686
+ #
687
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
688
+ # external source for authentication to Google Cloud, you must validate it before
689
+ # providing it to a Google API client library. Providing an unvalidated credential
690
+ # configuration to Google APIs can compromise the security of your systems and data.
691
+ # For more information, refer to [Validate credential configurations from external
692
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
693
+ # @return [::Object]
694
+ # @!attribute [rw] scope
695
+ # The OAuth scopes
696
+ # @return [::Array<::String>]
697
+ # @!attribute [rw] lib_name
698
+ # The library name as recorded in instrumentation and logging
699
+ # @return [::String]
700
+ # @!attribute [rw] lib_version
701
+ # The library version as recorded in instrumentation and logging
702
+ # @return [::String]
703
+ # @!attribute [rw] channel_args
704
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
705
+ # `GRPC::Core::Channel` object is provided as the credential.
706
+ # @return [::Hash]
707
+ # @!attribute [rw] interceptors
708
+ # An array of interceptors that are run before calls are executed.
709
+ # @return [::Array<::GRPC::ClientInterceptor>]
710
+ # @!attribute [rw] timeout
711
+ # The call timeout in seconds.
712
+ # @return [::Numeric]
713
+ # @!attribute [rw] metadata
714
+ # Additional gRPC headers to be sent with the call.
715
+ # @return [::Hash{::Symbol=>::String}]
716
+ # @!attribute [rw] retry_policy
717
+ # The retry policy. The value is a hash with the following keys:
718
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
719
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
720
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
721
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
722
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
723
+ # trigger a retry.
724
+ # @return [::Hash]
725
+ # @!attribute [rw] quota_project
726
+ # A separate project against which to charge quota.
727
+ # @return [::String]
728
+ # @!attribute [rw] universe_domain
729
+ # The universe domain within which to make requests. This determines the
730
+ # default endpoint URL. The default value of nil uses the environment
731
+ # universe (usually the default "googleapis.com" universe).
732
+ # @return [::String,nil]
733
+ # @!attribute [rw] logger
734
+ # A custom logger to use for request/response debug logging, or the value
735
+ # `:default` (the default) to construct a default logger, or `nil` to
736
+ # explicitly disable logging.
737
+ # @return [::Logger,:default,nil]
738
+ #
739
+ class Configuration
740
+ extend ::Gapic::Config
741
+
742
+ # @private
743
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
744
+ DEFAULT_ENDPOINT = "vectorsearch.googleapis.com"
745
+
746
+ config_attr :endpoint, nil, ::String, nil
747
+ config_attr :credentials, nil do |value|
748
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
749
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
750
+ allowed.any? { |klass| klass === value }
751
+ end
752
+ config_attr :scope, nil, ::String, ::Array, nil
753
+ config_attr :lib_name, nil, ::String, nil
754
+ config_attr :lib_version, nil, ::String, nil
755
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
756
+ config_attr :interceptors, nil, ::Array, nil
757
+ config_attr :timeout, nil, ::Numeric, nil
758
+ config_attr :metadata, nil, ::Hash, nil
759
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
760
+ config_attr :quota_project, nil, ::String, nil
761
+ config_attr :universe_domain, nil, ::String, nil
762
+ config_attr :logger, :default, ::Logger, nil, :default
763
+
764
+ # @private
765
+ def initialize parent_config = nil
766
+ @parent_config = parent_config unless parent_config.nil?
767
+
768
+ yield self if block_given?
769
+ end
770
+
771
+ ##
772
+ # Configurations for individual RPCs
773
+ # @return [Rpcs]
774
+ #
775
+ def rpcs
776
+ @rpcs ||= begin
777
+ parent_rpcs = nil
778
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
779
+ Rpcs.new parent_rpcs
780
+ end
781
+ end
782
+
783
+ ##
784
+ # Configuration for the channel pool
785
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
786
+ #
787
+ def channel_pool
788
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
789
+ end
790
+
791
+ ##
792
+ # Configuration RPC class for the DataObjectSearchService API.
793
+ #
794
+ # Includes fields providing the configuration for each RPC in this service.
795
+ # Each configuration object is of type `Gapic::Config::Method` and includes
796
+ # the following configuration fields:
797
+ #
798
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
799
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
800
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
801
+ # include the following keys:
802
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
803
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
804
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
805
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
806
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
807
+ # trigger a retry.
808
+ #
809
+ class Rpcs
810
+ ##
811
+ # RPC-specific configuration for `search_data_objects`
812
+ # @return [::Gapic::Config::Method]
813
+ #
814
+ attr_reader :search_data_objects
815
+ ##
816
+ # RPC-specific configuration for `query_data_objects`
817
+ # @return [::Gapic::Config::Method]
818
+ #
819
+ attr_reader :query_data_objects
820
+ ##
821
+ # RPC-specific configuration for `aggregate_data_objects`
822
+ # @return [::Gapic::Config::Method]
823
+ #
824
+ attr_reader :aggregate_data_objects
825
+ ##
826
+ # RPC-specific configuration for `batch_search_data_objects`
827
+ # @return [::Gapic::Config::Method]
828
+ #
829
+ attr_reader :batch_search_data_objects
830
+
831
+ # @private
832
+ def initialize parent_rpcs = nil
833
+ search_data_objects_config = parent_rpcs.search_data_objects if parent_rpcs.respond_to? :search_data_objects
834
+ @search_data_objects = ::Gapic::Config::Method.new search_data_objects_config
835
+ query_data_objects_config = parent_rpcs.query_data_objects if parent_rpcs.respond_to? :query_data_objects
836
+ @query_data_objects = ::Gapic::Config::Method.new query_data_objects_config
837
+ aggregate_data_objects_config = parent_rpcs.aggregate_data_objects if parent_rpcs.respond_to? :aggregate_data_objects
838
+ @aggregate_data_objects = ::Gapic::Config::Method.new aggregate_data_objects_config
839
+ batch_search_data_objects_config = parent_rpcs.batch_search_data_objects if parent_rpcs.respond_to? :batch_search_data_objects
840
+ @batch_search_data_objects = ::Gapic::Config::Method.new batch_search_data_objects_config
841
+
842
+ yield self if block_given?
843
+ end
844
+ end
845
+ end
846
+ end
847
+ end
848
+ end
849
+ end
850
+ end
851
+ end