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