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