google-cloud-ai_platform-v1 0.58.0 → 0.59.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/ai_platform/v1/dataset_service/operations.rb +3 -10
  3. data/lib/google/cloud/ai_platform/v1/dataset_service/rest/operations.rb +73 -10
  4. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/operations.rb +3 -10
  5. data/lib/google/cloud/ai_platform/v1/deployment_resource_pool_service/rest/operations.rb +73 -10
  6. data/lib/google/cloud/ai_platform/v1/endpoint_service/client.rb +103 -0
  7. data/lib/google/cloud/ai_platform/v1/endpoint_service/operations.rb +3 -10
  8. data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/client.rb +96 -0
  9. data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/operations.rb +73 -10
  10. data/lib/google/cloud/ai_platform/v1/endpoint_service/rest/service_stub.rb +60 -0
  11. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/operations.rb +3 -10
  12. data/lib/google/cloud/ai_platform/v1/feature_online_store_admin_service/rest/operations.rb +73 -10
  13. data/lib/google/cloud/ai_platform/v1/feature_registry_service/operations.rb +3 -10
  14. data/lib/google/cloud/ai_platform/v1/feature_registry_service/rest/operations.rb +73 -10
  15. data/lib/google/cloud/ai_platform/v1/featurestore_service/operations.rb +3 -10
  16. data/lib/google/cloud/ai_platform/v1/featurestore_service/rest/operations.rb +73 -10
  17. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/operations.rb +3 -10
  18. data/lib/google/cloud/ai_platform/v1/gen_ai_tuning_service/rest/operations.rb +73 -10
  19. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/operations.rb +3 -10
  20. data/lib/google/cloud/ai_platform/v1/index_endpoint_service/rest/operations.rb +73 -10
  21. data/lib/google/cloud/ai_platform/v1/index_service/operations.rb +3 -10
  22. data/lib/google/cloud/ai_platform/v1/index_service/rest/operations.rb +73 -10
  23. data/lib/google/cloud/ai_platform/v1/job_service/operations.rb +3 -10
  24. data/lib/google/cloud/ai_platform/v1/job_service/rest/operations.rb +73 -10
  25. data/lib/google/cloud/ai_platform/v1/llm_utility_service/paths.rb +19 -0
  26. data/lib/google/cloud/ai_platform/v1/metadata_service/operations.rb +3 -10
  27. data/lib/google/cloud/ai_platform/v1/metadata_service/rest/operations.rb +73 -10
  28. data/lib/google/cloud/ai_platform/v1/migration_service/operations.rb +3 -10
  29. data/lib/google/cloud/ai_platform/v1/migration_service/rest/operations.rb +73 -10
  30. data/lib/google/cloud/ai_platform/v1/model_service/operations.rb +3 -10
  31. data/lib/google/cloud/ai_platform/v1/model_service/rest/operations.rb +73 -10
  32. data/lib/google/cloud/ai_platform/v1/notebook_service/operations.rb +3 -10
  33. data/lib/google/cloud/ai_platform/v1/notebook_service/rest/operations.rb +73 -10
  34. data/lib/google/cloud/ai_platform/v1/persistent_resource_service/operations.rb +3 -10
  35. data/lib/google/cloud/ai_platform/v1/persistent_resource_service/rest/operations.rb +73 -10
  36. data/lib/google/cloud/ai_platform/v1/pipeline_service/operations.rb +3 -10
  37. data/lib/google/cloud/ai_platform/v1/pipeline_service/rest/operations.rb +73 -10
  38. data/lib/google/cloud/ai_platform/v1/prediction_service/paths.rb +19 -0
  39. data/lib/google/cloud/ai_platform/v1/rest.rb +2 -0
  40. data/lib/google/cloud/ai_platform/v1/schedule_service/operations.rb +3 -10
  41. data/lib/google/cloud/ai_platform/v1/schedule_service/paths.rb +38 -0
  42. data/lib/google/cloud/ai_platform/v1/schedule_service/rest/operations.rb +73 -10
  43. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/operations.rb +3 -10
  44. data/lib/google/cloud/ai_platform/v1/specialist_pool_service/rest/operations.rb +73 -10
  45. data/lib/google/cloud/ai_platform/v1/tensorboard_service/operations.rb +3 -10
  46. data/lib/google/cloud/ai_platform/v1/tensorboard_service/rest/operations.rb +73 -10
  47. data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
  48. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/client.rb +1405 -0
  49. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/credentials.rb +47 -0
  50. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/operations.rb +810 -0
  51. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/paths.rb +173 -0
  52. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest/client.rb +1318 -0
  53. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest/operations.rb +4244 -0
  54. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest/service_stub.rb +663 -0
  55. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service/rest.rb +54 -0
  56. data/lib/google/cloud/ai_platform/v1/vertex_rag_data_service.rb +56 -0
  57. data/lib/google/cloud/ai_platform/v1/vertex_rag_service/client.rb +672 -0
  58. data/lib/google/cloud/ai_platform/v1/vertex_rag_service/credentials.rb +47 -0
  59. data/lib/google/cloud/ai_platform/v1/vertex_rag_service/paths.rb +69 -0
  60. data/lib/google/cloud/ai_platform/v1/vertex_rag_service/rest/client.rb +634 -0
  61. data/lib/google/cloud/ai_platform/v1/vertex_rag_service/rest/service_stub.rb +249 -0
  62. data/lib/google/cloud/ai_platform/v1/vertex_rag_service/rest.rb +53 -0
  63. data/lib/google/cloud/ai_platform/v1/vertex_rag_service.rb +55 -0
  64. data/lib/google/cloud/ai_platform/v1/vizier_service/operations.rb +3 -10
  65. data/lib/google/cloud/ai_platform/v1/vizier_service/rest/operations.rb +73 -10
  66. data/lib/google/cloud/ai_platform/v1.rb +2 -0
  67. data/lib/google/cloud/aiplatform/v1/api_auth_pb.rb +46 -0
  68. data/lib/google/cloud/aiplatform/v1/endpoint_pb.rb +5 -1
  69. data/lib/google/cloud/aiplatform/v1/endpoint_service_pb.rb +3 -1
  70. data/lib/google/cloud/aiplatform/v1/endpoint_service_services_pb.rb +2 -0
  71. data/lib/google/cloud/aiplatform/v1/io_pb.rb +16 -1
  72. data/lib/google/cloud/aiplatform/v1/machine_resources_pb.rb +1 -1
  73. data/lib/google/cloud/aiplatform/v1/notebook_execution_job_pb.rb +6 -1
  74. data/lib/google/cloud/aiplatform/v1/tool_pb.rb +5 -1
  75. data/lib/google/cloud/aiplatform/v1/vertex_rag_data_pb.rb +67 -0
  76. data/lib/google/cloud/aiplatform/v1/vertex_rag_data_service_pb.rb +71 -0
  77. data/lib/google/cloud/aiplatform/v1/vertex_rag_data_service_services_pb.rb +63 -0
  78. data/lib/google/cloud/aiplatform/v1/vertex_rag_service_pb.rb +65 -0
  79. data/lib/google/cloud/aiplatform/v1/vertex_rag_service_services_pb.rb +52 -0
  80. data/proto_docs/google/cloud/aiplatform/v1/api_auth.rb +45 -0
  81. data/proto_docs/google/cloud/aiplatform/v1/endpoint.rb +30 -0
  82. data/proto_docs/google/cloud/aiplatform/v1/endpoint_service.rb +22 -0
  83. data/proto_docs/google/cloud/aiplatform/v1/io.rb +158 -0
  84. data/proto_docs/google/cloud/aiplatform/v1/machine_resources.rb +8 -0
  85. data/proto_docs/google/cloud/aiplatform/v1/notebook_execution_job.rb +18 -0
  86. data/proto_docs/google/cloud/aiplatform/v1/tool.rb +72 -0
  87. data/proto_docs/google/cloud/aiplatform/v1/vertex_rag_data.rb +334 -0
  88. data/proto_docs/google/cloud/aiplatform/v1/vertex_rag_data_service.rb +293 -0
  89. data/proto_docs/google/cloud/aiplatform/v1/vertex_rag_service.rb +279 -0
  90. data/proto_docs/google/longrunning/operations.rb +19 -14
  91. metadata +28 -2
@@ -0,0 +1,634 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2024 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/vertex_rag_service_pb"
21
+ require "google/cloud/ai_platform/v1/vertex_rag_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+ require "google/iam/v1/rest"
24
+
25
+ module Google
26
+ module Cloud
27
+ module AIPlatform
28
+ module V1
29
+ module VertexRagService
30
+ module Rest
31
+ ##
32
+ # REST client for the VertexRagService service.
33
+ #
34
+ # A service for retrieving relevant contexts.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "aiplatform.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :vertex_rag_service_stub
47
+
48
+ ##
49
+ # Configure the VertexRagService Client class.
50
+ #
51
+ # See {::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all VertexRagService clients
57
+ # ::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "AIPlatform", "V1"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the VertexRagService Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # The effective universe domain
105
+ #
106
+ # @return [String]
107
+ #
108
+ def universe_domain
109
+ @vertex_rag_service_stub.universe_domain
110
+ end
111
+
112
+ ##
113
+ # Create a new VertexRagService REST client object.
114
+ #
115
+ # @example
116
+ #
117
+ # # Create a client using the default configuration
118
+ # client = ::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client.new
119
+ #
120
+ # # Create a client using a custom configuration
121
+ # client = ::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
124
+ #
125
+ # @yield [config] Configure the VertexRagService client.
126
+ # @yieldparam config [Client::Configuration]
127
+ #
128
+ def initialize
129
+ # Create the configuration object
130
+ @config = Configuration.new Client.configure
131
+
132
+ # Yield the configuration if needed
133
+ yield @config if block_given?
134
+
135
+ # Create credentials
136
+ credentials = @config.credentials
137
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
+ # but only if the default endpoint does not have a region prefix.
139
+ enable_self_signed_jwt = @config.endpoint.nil? ||
140
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
+ !@config.endpoint.split(".").first.include?("-"))
142
+ credentials ||= Credentials.default scope: @config.scope,
143
+ enable_self_signed_jwt: enable_self_signed_jwt
144
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
+ credentials = Credentials.new credentials, scope: @config.scope
146
+ end
147
+
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @vertex_rag_service_stub = ::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::ServiceStub.new(
152
+ endpoint: @config.endpoint,
153
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
154
+ universe_domain: @config.universe_domain,
155
+ credentials: credentials
156
+ )
157
+
158
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
159
+ config.credentials = credentials
160
+ config.quota_project = @quota_project_id
161
+ config.endpoint = @vertex_rag_service_stub.endpoint
162
+ config.universe_domain = @vertex_rag_service_stub.universe_domain
163
+ config.bindings_override = @config.bindings_override
164
+ end
165
+
166
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
167
+ config.credentials = credentials
168
+ config.quota_project = @quota_project_id
169
+ config.endpoint = @vertex_rag_service_stub.endpoint
170
+ config.universe_domain = @vertex_rag_service_stub.universe_domain
171
+ config.bindings_override = @config.bindings_override
172
+ end
173
+ end
174
+
175
+ ##
176
+ # Get the associated client for mix-in of the Locations.
177
+ #
178
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
179
+ #
180
+ attr_reader :location_client
181
+
182
+ ##
183
+ # Get the associated client for mix-in of the IAMPolicy.
184
+ #
185
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
186
+ #
187
+ attr_reader :iam_policy_client
188
+
189
+ # Service calls
190
+
191
+ ##
192
+ # Retrieves relevant contexts for a query.
193
+ #
194
+ # @overload retrieve_contexts(request, options = nil)
195
+ # Pass arguments to `retrieve_contexts` via a request object, either of type
196
+ # {::Google::Cloud::AIPlatform::V1::RetrieveContextsRequest} or an equivalent Hash.
197
+ #
198
+ # @param request [::Google::Cloud::AIPlatform::V1::RetrieveContextsRequest, ::Hash]
199
+ # A request object representing the call parameters. Required. To specify no
200
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
201
+ # @param options [::Gapic::CallOptions, ::Hash]
202
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
203
+ #
204
+ # @overload retrieve_contexts(vertex_rag_store: nil, parent: nil, query: nil)
205
+ # Pass arguments to `retrieve_contexts` via keyword arguments. Note that at
206
+ # least one keyword argument is required. To specify no parameters, or to keep all
207
+ # the default parameter values, pass an empty Hash as a request object (see above).
208
+ #
209
+ # @param vertex_rag_store [::Google::Cloud::AIPlatform::V1::RetrieveContextsRequest::VertexRagStore, ::Hash]
210
+ # The data source for Vertex RagStore.
211
+ # @param parent [::String]
212
+ # Required. The resource name of the Location from which to retrieve
213
+ # RagContexts. The users must have permission to make a call in the project.
214
+ # Format:
215
+ # `projects/{project}/locations/{location}`.
216
+ # @param query [::Google::Cloud::AIPlatform::V1::RagQuery, ::Hash]
217
+ # Required. Single RAG retrieve query.
218
+ # @yield [result, operation] Access the result along with the TransportOperation object
219
+ # @yieldparam result [::Google::Cloud::AIPlatform::V1::RetrieveContextsResponse]
220
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
221
+ #
222
+ # @return [::Google::Cloud::AIPlatform::V1::RetrieveContextsResponse]
223
+ #
224
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
225
+ #
226
+ # @example Basic example
227
+ # require "google/cloud/ai_platform/v1"
228
+ #
229
+ # # Create a client object. The client can be reused for multiple calls.
230
+ # client = Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client.new
231
+ #
232
+ # # Create a request. To set request fields, pass in keyword arguments.
233
+ # request = Google::Cloud::AIPlatform::V1::RetrieveContextsRequest.new
234
+ #
235
+ # # Call the retrieve_contexts method.
236
+ # result = client.retrieve_contexts request
237
+ #
238
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::RetrieveContextsResponse.
239
+ # p result
240
+ #
241
+ def retrieve_contexts request, options = nil
242
+ raise ::ArgumentError, "request must be provided" if request.nil?
243
+
244
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::RetrieveContextsRequest
245
+
246
+ # Converts hash and nil to an options object
247
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
248
+
249
+ # Customize the options with defaults
250
+ call_metadata = @config.rpcs.retrieve_contexts.metadata.to_h
251
+
252
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
253
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
254
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
255
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
256
+ transports_version_send: [:rest]
257
+
258
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
259
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
260
+
261
+ options.apply_defaults timeout: @config.rpcs.retrieve_contexts.timeout,
262
+ metadata: call_metadata,
263
+ retry_policy: @config.rpcs.retrieve_contexts.retry_policy
264
+
265
+ options.apply_defaults timeout: @config.timeout,
266
+ metadata: @config.metadata,
267
+ retry_policy: @config.retry_policy
268
+
269
+ @vertex_rag_service_stub.retrieve_contexts request, options do |result, operation|
270
+ yield result, operation if block_given?
271
+ return result
272
+ end
273
+ rescue ::Gapic::Rest::Error => e
274
+ raise ::Google::Cloud::Error.from_error(e)
275
+ end
276
+
277
+ ##
278
+ # Given an input prompt, it returns augmented prompt from vertex rag store
279
+ # to guide LLM towards generating grounded responses.
280
+ #
281
+ # @overload augment_prompt(request, options = nil)
282
+ # Pass arguments to `augment_prompt` via a request object, either of type
283
+ # {::Google::Cloud::AIPlatform::V1::AugmentPromptRequest} or an equivalent Hash.
284
+ #
285
+ # @param request [::Google::Cloud::AIPlatform::V1::AugmentPromptRequest, ::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 augment_prompt(vertex_rag_store: nil, parent: nil, contents: nil, model: nil)
292
+ # Pass arguments to `augment_prompt` 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 vertex_rag_store [::Google::Cloud::AIPlatform::V1::VertexRagStore, ::Hash]
297
+ # Optional. Retrieves contexts from the Vertex RagStore.
298
+ # @param parent [::String]
299
+ # Required. The resource name of the Location from which to augment prompt.
300
+ # The users must have permission to make a call in the project.
301
+ # Format:
302
+ # `projects/{project}/locations/{location}`.
303
+ # @param contents [::Array<::Google::Cloud::AIPlatform::V1::Content, ::Hash>]
304
+ # Optional. Input content to augment, only text format is supported for now.
305
+ # @param model [::Google::Cloud::AIPlatform::V1::AugmentPromptRequest::Model, ::Hash]
306
+ # Optional. Metadata of the backend deployed model.
307
+ # @yield [result, operation] Access the result along with the TransportOperation object
308
+ # @yieldparam result [::Google::Cloud::AIPlatform::V1::AugmentPromptResponse]
309
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
310
+ #
311
+ # @return [::Google::Cloud::AIPlatform::V1::AugmentPromptResponse]
312
+ #
313
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
314
+ #
315
+ # @example Basic example
316
+ # require "google/cloud/ai_platform/v1"
317
+ #
318
+ # # Create a client object. The client can be reused for multiple calls.
319
+ # client = Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client.new
320
+ #
321
+ # # Create a request. To set request fields, pass in keyword arguments.
322
+ # request = Google::Cloud::AIPlatform::V1::AugmentPromptRequest.new
323
+ #
324
+ # # Call the augment_prompt method.
325
+ # result = client.augment_prompt request
326
+ #
327
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::AugmentPromptResponse.
328
+ # p result
329
+ #
330
+ def augment_prompt request, options = nil
331
+ raise ::ArgumentError, "request must be provided" if request.nil?
332
+
333
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::AugmentPromptRequest
334
+
335
+ # Converts hash and nil to an options object
336
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
337
+
338
+ # Customize the options with defaults
339
+ call_metadata = @config.rpcs.augment_prompt.metadata.to_h
340
+
341
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
342
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
343
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
344
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
345
+ transports_version_send: [:rest]
346
+
347
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
348
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
349
+
350
+ options.apply_defaults timeout: @config.rpcs.augment_prompt.timeout,
351
+ metadata: call_metadata,
352
+ retry_policy: @config.rpcs.augment_prompt.retry_policy
353
+
354
+ options.apply_defaults timeout: @config.timeout,
355
+ metadata: @config.metadata,
356
+ retry_policy: @config.retry_policy
357
+
358
+ @vertex_rag_service_stub.augment_prompt request, options do |result, operation|
359
+ yield result, operation if block_given?
360
+ return result
361
+ end
362
+ rescue ::Gapic::Rest::Error => e
363
+ raise ::Google::Cloud::Error.from_error(e)
364
+ end
365
+
366
+ ##
367
+ # Given an input text, it returns a score that evaluates the factuality of
368
+ # the text. It also extracts and returns claims from the text and provides
369
+ # supporting facts.
370
+ #
371
+ # @overload corroborate_content(request, options = nil)
372
+ # Pass arguments to `corroborate_content` via a request object, either of type
373
+ # {::Google::Cloud::AIPlatform::V1::CorroborateContentRequest} or an equivalent Hash.
374
+ #
375
+ # @param request [::Google::Cloud::AIPlatform::V1::CorroborateContentRequest, ::Hash]
376
+ # A request object representing the call parameters. Required. To specify no
377
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
378
+ # @param options [::Gapic::CallOptions, ::Hash]
379
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
380
+ #
381
+ # @overload corroborate_content(parent: nil, content: nil, facts: nil, parameters: nil)
382
+ # Pass arguments to `corroborate_content` via keyword arguments. Note that at
383
+ # least one keyword argument is required. To specify no parameters, or to keep all
384
+ # the default parameter values, pass an empty Hash as a request object (see above).
385
+ #
386
+ # @param parent [::String]
387
+ # Required. The resource name of the Location from which to corroborate text.
388
+ # The users must have permission to make a call in the project.
389
+ # Format:
390
+ # `projects/{project}/locations/{location}`.
391
+ # @param content [::Google::Cloud::AIPlatform::V1::Content, ::Hash]
392
+ # Optional. Input content to corroborate, only text format is supported for
393
+ # now.
394
+ # @param facts [::Array<::Google::Cloud::AIPlatform::V1::Fact, ::Hash>]
395
+ # Optional. Facts used to generate the text can also be used to corroborate
396
+ # the text.
397
+ # @param parameters [::Google::Cloud::AIPlatform::V1::CorroborateContentRequest::Parameters, ::Hash]
398
+ # Optional. Parameters that can be set to override default settings per
399
+ # request.
400
+ # @yield [result, operation] Access the result along with the TransportOperation object
401
+ # @yieldparam result [::Google::Cloud::AIPlatform::V1::CorroborateContentResponse]
402
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
403
+ #
404
+ # @return [::Google::Cloud::AIPlatform::V1::CorroborateContentResponse]
405
+ #
406
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
407
+ #
408
+ # @example Basic example
409
+ # require "google/cloud/ai_platform/v1"
410
+ #
411
+ # # Create a client object. The client can be reused for multiple calls.
412
+ # client = Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client.new
413
+ #
414
+ # # Create a request. To set request fields, pass in keyword arguments.
415
+ # request = Google::Cloud::AIPlatform::V1::CorroborateContentRequest.new
416
+ #
417
+ # # Call the corroborate_content method.
418
+ # result = client.corroborate_content request
419
+ #
420
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::CorroborateContentResponse.
421
+ # p result
422
+ #
423
+ def corroborate_content request, options = nil
424
+ raise ::ArgumentError, "request must be provided" if request.nil?
425
+
426
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::CorroborateContentRequest
427
+
428
+ # Converts hash and nil to an options object
429
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
430
+
431
+ # Customize the options with defaults
432
+ call_metadata = @config.rpcs.corroborate_content.metadata.to_h
433
+
434
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
435
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
436
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
437
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION,
438
+ transports_version_send: [:rest]
439
+
440
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
441
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
442
+
443
+ options.apply_defaults timeout: @config.rpcs.corroborate_content.timeout,
444
+ metadata: call_metadata,
445
+ retry_policy: @config.rpcs.corroborate_content.retry_policy
446
+
447
+ options.apply_defaults timeout: @config.timeout,
448
+ metadata: @config.metadata,
449
+ retry_policy: @config.retry_policy
450
+
451
+ @vertex_rag_service_stub.corroborate_content request, options do |result, operation|
452
+ yield result, operation if block_given?
453
+ return result
454
+ end
455
+ rescue ::Gapic::Rest::Error => e
456
+ raise ::Google::Cloud::Error.from_error(e)
457
+ end
458
+
459
+ ##
460
+ # Configuration class for the VertexRagService REST API.
461
+ #
462
+ # This class represents the configuration for VertexRagService REST,
463
+ # providing control over timeouts, retry behavior, logging, transport
464
+ # parameters, and other low-level controls. Certain parameters can also be
465
+ # applied individually to specific RPCs. See
466
+ # {::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client::Configuration::Rpcs}
467
+ # for a list of RPCs that can be configured independently.
468
+ #
469
+ # Configuration can be applied globally to all clients, or to a single client
470
+ # on construction.
471
+ #
472
+ # @example
473
+ #
474
+ # # Modify the global config, setting the timeout for
475
+ # # retrieve_contexts to 20 seconds,
476
+ # # and all remaining timeouts to 10 seconds.
477
+ # ::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client.configure do |config|
478
+ # config.timeout = 10.0
479
+ # config.rpcs.retrieve_contexts.timeout = 20.0
480
+ # end
481
+ #
482
+ # # Apply the above configuration only to a new client.
483
+ # client = ::Google::Cloud::AIPlatform::V1::VertexRagService::Rest::Client.new do |config|
484
+ # config.timeout = 10.0
485
+ # config.rpcs.retrieve_contexts.timeout = 20.0
486
+ # end
487
+ #
488
+ # @!attribute [rw] endpoint
489
+ # A custom service endpoint, as a hostname or hostname:port. The default is
490
+ # nil, indicating to use the default endpoint in the current universe domain.
491
+ # @return [::String,nil]
492
+ # @!attribute [rw] credentials
493
+ # Credentials to send with calls. You may provide any of the following types:
494
+ # * (`String`) The path to a service account key file in JSON format
495
+ # * (`Hash`) A service account key as a Hash
496
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
497
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
498
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
499
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
500
+ # * (`nil`) indicating no credentials
501
+ # @return [::Object]
502
+ # @!attribute [rw] scope
503
+ # The OAuth scopes
504
+ # @return [::Array<::String>]
505
+ # @!attribute [rw] lib_name
506
+ # The library name as recorded in instrumentation and logging
507
+ # @return [::String]
508
+ # @!attribute [rw] lib_version
509
+ # The library version as recorded in instrumentation and logging
510
+ # @return [::String]
511
+ # @!attribute [rw] timeout
512
+ # The call timeout in seconds.
513
+ # @return [::Numeric]
514
+ # @!attribute [rw] metadata
515
+ # Additional headers to be sent with the call.
516
+ # @return [::Hash{::Symbol=>::String}]
517
+ # @!attribute [rw] retry_policy
518
+ # The retry policy. The value is a hash with the following keys:
519
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
520
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
521
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
522
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
523
+ # trigger a retry.
524
+ # @return [::Hash]
525
+ # @!attribute [rw] quota_project
526
+ # A separate project against which to charge quota.
527
+ # @return [::String]
528
+ # @!attribute [rw] universe_domain
529
+ # The universe domain within which to make requests. This determines the
530
+ # default endpoint URL. The default value of nil uses the environment
531
+ # universe (usually the default "googleapis.com" universe).
532
+ # @return [::String,nil]
533
+ #
534
+ class Configuration
535
+ extend ::Gapic::Config
536
+
537
+ # @private
538
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
539
+ DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
540
+
541
+ config_attr :endpoint, nil, ::String, nil
542
+ config_attr :credentials, nil do |value|
543
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
544
+ allowed.any? { |klass| klass === value }
545
+ end
546
+ config_attr :scope, nil, ::String, ::Array, nil
547
+ config_attr :lib_name, nil, ::String, nil
548
+ config_attr :lib_version, nil, ::String, nil
549
+ config_attr :timeout, nil, ::Numeric, nil
550
+ config_attr :metadata, nil, ::Hash, nil
551
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
552
+ config_attr :quota_project, nil, ::String, nil
553
+ config_attr :universe_domain, nil, ::String, nil
554
+
555
+ # @private
556
+ # Overrides for http bindings for the RPCs of this service
557
+ # are only used when this service is used as mixin, and only
558
+ # by the host service.
559
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
560
+ config_attr :bindings_override, {}, ::Hash, nil
561
+
562
+ # @private
563
+ def initialize parent_config = nil
564
+ @parent_config = parent_config unless parent_config.nil?
565
+
566
+ yield self if block_given?
567
+ end
568
+
569
+ ##
570
+ # Configurations for individual RPCs
571
+ # @return [Rpcs]
572
+ #
573
+ def rpcs
574
+ @rpcs ||= begin
575
+ parent_rpcs = nil
576
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
577
+ Rpcs.new parent_rpcs
578
+ end
579
+ end
580
+
581
+ ##
582
+ # Configuration RPC class for the VertexRagService API.
583
+ #
584
+ # Includes fields providing the configuration for each RPC in this service.
585
+ # Each configuration object is of type `Gapic::Config::Method` and includes
586
+ # the following configuration fields:
587
+ #
588
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
589
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
590
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
591
+ # include the following keys:
592
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
593
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
594
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
595
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
596
+ # trigger a retry.
597
+ #
598
+ class Rpcs
599
+ ##
600
+ # RPC-specific configuration for `retrieve_contexts`
601
+ # @return [::Gapic::Config::Method]
602
+ #
603
+ attr_reader :retrieve_contexts
604
+ ##
605
+ # RPC-specific configuration for `augment_prompt`
606
+ # @return [::Gapic::Config::Method]
607
+ #
608
+ attr_reader :augment_prompt
609
+ ##
610
+ # RPC-specific configuration for `corroborate_content`
611
+ # @return [::Gapic::Config::Method]
612
+ #
613
+ attr_reader :corroborate_content
614
+
615
+ # @private
616
+ def initialize parent_rpcs = nil
617
+ retrieve_contexts_config = parent_rpcs.retrieve_contexts if parent_rpcs.respond_to? :retrieve_contexts
618
+ @retrieve_contexts = ::Gapic::Config::Method.new retrieve_contexts_config
619
+ augment_prompt_config = parent_rpcs.augment_prompt if parent_rpcs.respond_to? :augment_prompt
620
+ @augment_prompt = ::Gapic::Config::Method.new augment_prompt_config
621
+ corroborate_content_config = parent_rpcs.corroborate_content if parent_rpcs.respond_to? :corroborate_content
622
+ @corroborate_content = ::Gapic::Config::Method.new corroborate_content_config
623
+
624
+ yield self if block_given?
625
+ end
626
+ end
627
+ end
628
+ end
629
+ end
630
+ end
631
+ end
632
+ end
633
+ end
634
+ end