google-cloud-ai_platform-v1 0.47.0 → 0.48.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/rest/service_stub.rb +77 -0
- data/lib/google/cloud/ai_platform/v1/evaluation_service/client.rb +508 -0
- data/lib/google/cloud/ai_platform/v1/evaluation_service/credentials.rb +47 -0
- data/lib/google/cloud/ai_platform/v1/evaluation_service/paths.rb +50 -0
- data/lib/google/cloud/ai_platform/v1/evaluation_service/rest/client.rb +484 -0
- data/lib/google/cloud/ai_platform/v1/evaluation_service/rest/service_stub.rb +129 -0
- data/lib/google/cloud/ai_platform/v1/evaluation_service/rest.rb +53 -0
- data/lib/google/cloud/ai_platform/v1/evaluation_service.rb +55 -0
- data/lib/google/cloud/ai_platform/v1/llm_utility_service/rest/service_stub.rb +32 -0
- data/lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb +32 -0
- data/lib/google/cloud/ai_platform/v1/rest.rb +1 -0
- data/lib/google/cloud/ai_platform/v1/version.rb +1 -1
- data/lib/google/cloud/ai_platform/v1.rb +1 -0
- data/lib/google/cloud/aiplatform/v1/dataset_service_pb.rb +1 -1
- data/lib/google/cloud/aiplatform/v1/evaluation_service_pb.rb +148 -0
- data/lib/google/cloud/aiplatform/v1/evaluation_service_services_pb.rb +45 -0
- data/lib/google/cloud/aiplatform/v1/llm_utility_service_pb.rb +1 -1
- data/lib/google/cloud/aiplatform/v1/prediction_service_pb.rb +1 -1
- data/proto_docs/google/cloud/aiplatform/v1/evaluation_service.rb +1412 -0
- data/proto_docs/google/cloud/aiplatform/v1/prediction_service.rb +3 -1
- metadata +12 -2
@@ -0,0 +1,47 @@
|
|
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 "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module AIPlatform
|
24
|
+
module V1
|
25
|
+
module EvaluationService
|
26
|
+
# Credentials for the EvaluationService API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
33
|
+
"GOOGLE_CLOUD_KEYFILE",
|
34
|
+
"GCLOUD_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
37
|
+
"GCLOUD_KEYFILE_JSON"
|
38
|
+
]
|
39
|
+
self.paths = [
|
40
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
41
|
+
]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,50 @@
|
|
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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module AIPlatform
|
23
|
+
module V1
|
24
|
+
module EvaluationService
|
25
|
+
# Path helper methods for the EvaluationService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Location resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `projects/{project}/locations/{location}`
|
33
|
+
#
|
34
|
+
# @param project [String]
|
35
|
+
# @param location [String]
|
36
|
+
#
|
37
|
+
# @return [::String]
|
38
|
+
def location_path project:, location:
|
39
|
+
raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
|
40
|
+
|
41
|
+
"projects/#{project}/locations/#{location}"
|
42
|
+
end
|
43
|
+
|
44
|
+
extend self
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,484 @@
|
|
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/evaluation_service_pb"
|
21
|
+
require "google/cloud/ai_platform/v1/evaluation_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 EvaluationService
|
30
|
+
module Rest
|
31
|
+
##
|
32
|
+
# REST client for the EvaluationService service.
|
33
|
+
#
|
34
|
+
# Vertex AI Online Evaluation Service.
|
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 :evaluation_service_stub
|
47
|
+
|
48
|
+
##
|
49
|
+
# Configure the EvaluationService Client class.
|
50
|
+
#
|
51
|
+
# See {::Google::Cloud::AIPlatform::V1::EvaluationService::Rest::Client::Configuration}
|
52
|
+
# for a description of the configuration fields.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
#
|
56
|
+
# # Modify the configuration for all EvaluationService clients
|
57
|
+
# ::Google::Cloud::AIPlatform::V1::EvaluationService::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 EvaluationService 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::EvaluationService::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
|
+
@evaluation_service_stub.universe_domain
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# Create a new EvaluationService REST client object.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
#
|
117
|
+
# # Create a client using the default configuration
|
118
|
+
# client = ::Google::Cloud::AIPlatform::V1::EvaluationService::Rest::Client.new
|
119
|
+
#
|
120
|
+
# # Create a client using a custom configuration
|
121
|
+
# client = ::Google::Cloud::AIPlatform::V1::EvaluationService::Rest::Client.new do |config|
|
122
|
+
# config.timeout = 10.0
|
123
|
+
# end
|
124
|
+
#
|
125
|
+
# @yield [config] Configure the EvaluationService 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
|
+
@evaluation_service_stub = ::Google::Cloud::AIPlatform::V1::EvaluationService::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 = @evaluation_service_stub.endpoint
|
162
|
+
config.universe_domain = @evaluation_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 = @evaluation_service_stub.endpoint
|
170
|
+
config.universe_domain = @evaluation_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
|
+
# Evaluates instances based on a given metric.
|
193
|
+
#
|
194
|
+
# @overload evaluate_instances(request, options = nil)
|
195
|
+
# Pass arguments to `evaluate_instances` via a request object, either of type
|
196
|
+
# {::Google::Cloud::AIPlatform::V1::EvaluateInstancesRequest} or an equivalent Hash.
|
197
|
+
#
|
198
|
+
# @param request [::Google::Cloud::AIPlatform::V1::EvaluateInstancesRequest, ::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 evaluate_instances(exact_match_input: nil, bleu_input: nil, rouge_input: nil, fluency_input: nil, coherence_input: nil, safety_input: nil, groundedness_input: nil, fulfillment_input: nil, summarization_quality_input: nil, pairwise_summarization_quality_input: nil, summarization_helpfulness_input: nil, summarization_verbosity_input: nil, question_answering_quality_input: nil, pairwise_question_answering_quality_input: nil, question_answering_relevance_input: nil, question_answering_helpfulness_input: nil, question_answering_correctness_input: nil, pointwise_metric_input: nil, pairwise_metric_input: nil, tool_call_valid_input: nil, tool_name_match_input: nil, tool_parameter_key_match_input: nil, tool_parameter_kv_match_input: nil, location: nil)
|
205
|
+
# Pass arguments to `evaluate_instances` 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 exact_match_input [::Google::Cloud::AIPlatform::V1::ExactMatchInput, ::Hash]
|
210
|
+
# Auto metric instances.
|
211
|
+
# Instances and metric spec for exact match metric.
|
212
|
+
# @param bleu_input [::Google::Cloud::AIPlatform::V1::BleuInput, ::Hash]
|
213
|
+
# Instances and metric spec for bleu metric.
|
214
|
+
# @param rouge_input [::Google::Cloud::AIPlatform::V1::RougeInput, ::Hash]
|
215
|
+
# Instances and metric spec for rouge metric.
|
216
|
+
# @param fluency_input [::Google::Cloud::AIPlatform::V1::FluencyInput, ::Hash]
|
217
|
+
# LLM-based metric instance.
|
218
|
+
# General text generation metrics, applicable to other categories.
|
219
|
+
# Input for fluency metric.
|
220
|
+
# @param coherence_input [::Google::Cloud::AIPlatform::V1::CoherenceInput, ::Hash]
|
221
|
+
# Input for coherence metric.
|
222
|
+
# @param safety_input [::Google::Cloud::AIPlatform::V1::SafetyInput, ::Hash]
|
223
|
+
# Input for safety metric.
|
224
|
+
# @param groundedness_input [::Google::Cloud::AIPlatform::V1::GroundednessInput, ::Hash]
|
225
|
+
# Input for groundedness metric.
|
226
|
+
# @param fulfillment_input [::Google::Cloud::AIPlatform::V1::FulfillmentInput, ::Hash]
|
227
|
+
# Input for fulfillment metric.
|
228
|
+
# @param summarization_quality_input [::Google::Cloud::AIPlatform::V1::SummarizationQualityInput, ::Hash]
|
229
|
+
# Input for summarization quality metric.
|
230
|
+
# @param pairwise_summarization_quality_input [::Google::Cloud::AIPlatform::V1::PairwiseSummarizationQualityInput, ::Hash]
|
231
|
+
# Input for pairwise summarization quality metric.
|
232
|
+
# @param summarization_helpfulness_input [::Google::Cloud::AIPlatform::V1::SummarizationHelpfulnessInput, ::Hash]
|
233
|
+
# Input for summarization helpfulness metric.
|
234
|
+
# @param summarization_verbosity_input [::Google::Cloud::AIPlatform::V1::SummarizationVerbosityInput, ::Hash]
|
235
|
+
# Input for summarization verbosity metric.
|
236
|
+
# @param question_answering_quality_input [::Google::Cloud::AIPlatform::V1::QuestionAnsweringQualityInput, ::Hash]
|
237
|
+
# Input for question answering quality metric.
|
238
|
+
# @param pairwise_question_answering_quality_input [::Google::Cloud::AIPlatform::V1::PairwiseQuestionAnsweringQualityInput, ::Hash]
|
239
|
+
# Input for pairwise question answering quality metric.
|
240
|
+
# @param question_answering_relevance_input [::Google::Cloud::AIPlatform::V1::QuestionAnsweringRelevanceInput, ::Hash]
|
241
|
+
# Input for question answering relevance metric.
|
242
|
+
# @param question_answering_helpfulness_input [::Google::Cloud::AIPlatform::V1::QuestionAnsweringHelpfulnessInput, ::Hash]
|
243
|
+
# Input for question answering helpfulness
|
244
|
+
# metric.
|
245
|
+
# @param question_answering_correctness_input [::Google::Cloud::AIPlatform::V1::QuestionAnsweringCorrectnessInput, ::Hash]
|
246
|
+
# Input for question answering correctness
|
247
|
+
# metric.
|
248
|
+
# @param pointwise_metric_input [::Google::Cloud::AIPlatform::V1::PointwiseMetricInput, ::Hash]
|
249
|
+
# Input for pointwise metric.
|
250
|
+
# @param pairwise_metric_input [::Google::Cloud::AIPlatform::V1::PairwiseMetricInput, ::Hash]
|
251
|
+
# Input for pairwise metric.
|
252
|
+
# @param tool_call_valid_input [::Google::Cloud::AIPlatform::V1::ToolCallValidInput, ::Hash]
|
253
|
+
# Tool call metric instances.
|
254
|
+
# Input for tool call valid metric.
|
255
|
+
# @param tool_name_match_input [::Google::Cloud::AIPlatform::V1::ToolNameMatchInput, ::Hash]
|
256
|
+
# Input for tool name match metric.
|
257
|
+
# @param tool_parameter_key_match_input [::Google::Cloud::AIPlatform::V1::ToolParameterKeyMatchInput, ::Hash]
|
258
|
+
# Input for tool parameter key match metric.
|
259
|
+
# @param tool_parameter_kv_match_input [::Google::Cloud::AIPlatform::V1::ToolParameterKVMatchInput, ::Hash]
|
260
|
+
# Input for tool parameter key value match metric.
|
261
|
+
# @param location [::String]
|
262
|
+
# Required. The resource name of the Location to evaluate the instances.
|
263
|
+
# Format: `projects/{project}/locations/{location}`
|
264
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
265
|
+
# @yieldparam result [::Google::Cloud::AIPlatform::V1::EvaluateInstancesResponse]
|
266
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
267
|
+
#
|
268
|
+
# @return [::Google::Cloud::AIPlatform::V1::EvaluateInstancesResponse]
|
269
|
+
#
|
270
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
271
|
+
#
|
272
|
+
# @example Basic example
|
273
|
+
# require "google/cloud/ai_platform/v1"
|
274
|
+
#
|
275
|
+
# # Create a client object. The client can be reused for multiple calls.
|
276
|
+
# client = Google::Cloud::AIPlatform::V1::EvaluationService::Rest::Client.new
|
277
|
+
#
|
278
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
279
|
+
# request = Google::Cloud::AIPlatform::V1::EvaluateInstancesRequest.new
|
280
|
+
#
|
281
|
+
# # Call the evaluate_instances method.
|
282
|
+
# result = client.evaluate_instances request
|
283
|
+
#
|
284
|
+
# # The returned object is of type Google::Cloud::AIPlatform::V1::EvaluateInstancesResponse.
|
285
|
+
# p result
|
286
|
+
#
|
287
|
+
def evaluate_instances request, options = nil
|
288
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
289
|
+
|
290
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::EvaluateInstancesRequest
|
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.evaluate_instances.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::AIPlatform::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.evaluate_instances.timeout,
|
308
|
+
metadata: call_metadata,
|
309
|
+
retry_policy: @config.rpcs.evaluate_instances.retry_policy
|
310
|
+
|
311
|
+
options.apply_defaults timeout: @config.timeout,
|
312
|
+
metadata: @config.metadata,
|
313
|
+
retry_policy: @config.retry_policy
|
314
|
+
|
315
|
+
@evaluation_service_stub.evaluate_instances request, options do |result, operation|
|
316
|
+
yield result, operation if block_given?
|
317
|
+
return result
|
318
|
+
end
|
319
|
+
rescue ::Gapic::Rest::Error => e
|
320
|
+
raise ::Google::Cloud::Error.from_error(e)
|
321
|
+
end
|
322
|
+
|
323
|
+
##
|
324
|
+
# Configuration class for the EvaluationService REST API.
|
325
|
+
#
|
326
|
+
# This class represents the configuration for EvaluationService REST,
|
327
|
+
# providing control over timeouts, retry behavior, logging, transport
|
328
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
329
|
+
# applied individually to specific RPCs. See
|
330
|
+
# {::Google::Cloud::AIPlatform::V1::EvaluationService::Rest::Client::Configuration::Rpcs}
|
331
|
+
# for a list of RPCs that can be configured independently.
|
332
|
+
#
|
333
|
+
# Configuration can be applied globally to all clients, or to a single client
|
334
|
+
# on construction.
|
335
|
+
#
|
336
|
+
# @example
|
337
|
+
#
|
338
|
+
# # Modify the global config, setting the timeout for
|
339
|
+
# # evaluate_instances to 20 seconds,
|
340
|
+
# # and all remaining timeouts to 10 seconds.
|
341
|
+
# ::Google::Cloud::AIPlatform::V1::EvaluationService::Rest::Client.configure do |config|
|
342
|
+
# config.timeout = 10.0
|
343
|
+
# config.rpcs.evaluate_instances.timeout = 20.0
|
344
|
+
# end
|
345
|
+
#
|
346
|
+
# # Apply the above configuration only to a new client.
|
347
|
+
# client = ::Google::Cloud::AIPlatform::V1::EvaluationService::Rest::Client.new do |config|
|
348
|
+
# config.timeout = 10.0
|
349
|
+
# config.rpcs.evaluate_instances.timeout = 20.0
|
350
|
+
# end
|
351
|
+
#
|
352
|
+
# @!attribute [rw] endpoint
|
353
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
354
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
355
|
+
# @return [::String,nil]
|
356
|
+
# @!attribute [rw] credentials
|
357
|
+
# Credentials to send with calls. You may provide any of the following types:
|
358
|
+
# * (`String`) The path to a service account key file in JSON format
|
359
|
+
# * (`Hash`) A service account key as a Hash
|
360
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
361
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
362
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
363
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
364
|
+
# * (`nil`) indicating no credentials
|
365
|
+
# @return [::Object]
|
366
|
+
# @!attribute [rw] scope
|
367
|
+
# The OAuth scopes
|
368
|
+
# @return [::Array<::String>]
|
369
|
+
# @!attribute [rw] lib_name
|
370
|
+
# The library name as recorded in instrumentation and logging
|
371
|
+
# @return [::String]
|
372
|
+
# @!attribute [rw] lib_version
|
373
|
+
# The library version as recorded in instrumentation and logging
|
374
|
+
# @return [::String]
|
375
|
+
# @!attribute [rw] timeout
|
376
|
+
# The call timeout in seconds.
|
377
|
+
# @return [::Numeric]
|
378
|
+
# @!attribute [rw] metadata
|
379
|
+
# Additional headers to be sent with the call.
|
380
|
+
# @return [::Hash{::Symbol=>::String}]
|
381
|
+
# @!attribute [rw] retry_policy
|
382
|
+
# The retry policy. The value is a hash with the following keys:
|
383
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
384
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
385
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
386
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
387
|
+
# trigger a retry.
|
388
|
+
# @return [::Hash]
|
389
|
+
# @!attribute [rw] quota_project
|
390
|
+
# A separate project against which to charge quota.
|
391
|
+
# @return [::String]
|
392
|
+
# @!attribute [rw] universe_domain
|
393
|
+
# The universe domain within which to make requests. This determines the
|
394
|
+
# default endpoint URL. The default value of nil uses the environment
|
395
|
+
# universe (usually the default "googleapis.com" universe).
|
396
|
+
# @return [::String,nil]
|
397
|
+
#
|
398
|
+
class Configuration
|
399
|
+
extend ::Gapic::Config
|
400
|
+
|
401
|
+
# @private
|
402
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
403
|
+
DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
|
404
|
+
|
405
|
+
config_attr :endpoint, nil, ::String, nil
|
406
|
+
config_attr :credentials, nil do |value|
|
407
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
408
|
+
allowed.any? { |klass| klass === value }
|
409
|
+
end
|
410
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
411
|
+
config_attr :lib_name, nil, ::String, nil
|
412
|
+
config_attr :lib_version, nil, ::String, nil
|
413
|
+
config_attr :timeout, nil, ::Numeric, nil
|
414
|
+
config_attr :metadata, nil, ::Hash, nil
|
415
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
416
|
+
config_attr :quota_project, nil, ::String, nil
|
417
|
+
config_attr :universe_domain, nil, ::String, nil
|
418
|
+
|
419
|
+
# @private
|
420
|
+
# Overrides for http bindings for the RPCs of this service
|
421
|
+
# are only used when this service is used as mixin, and only
|
422
|
+
# by the host service.
|
423
|
+
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
424
|
+
config_attr :bindings_override, {}, ::Hash, nil
|
425
|
+
|
426
|
+
# @private
|
427
|
+
def initialize parent_config = nil
|
428
|
+
@parent_config = parent_config unless parent_config.nil?
|
429
|
+
|
430
|
+
yield self if block_given?
|
431
|
+
end
|
432
|
+
|
433
|
+
##
|
434
|
+
# Configurations for individual RPCs
|
435
|
+
# @return [Rpcs]
|
436
|
+
#
|
437
|
+
def rpcs
|
438
|
+
@rpcs ||= begin
|
439
|
+
parent_rpcs = nil
|
440
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
441
|
+
Rpcs.new parent_rpcs
|
442
|
+
end
|
443
|
+
end
|
444
|
+
|
445
|
+
##
|
446
|
+
# Configuration RPC class for the EvaluationService API.
|
447
|
+
#
|
448
|
+
# Includes fields providing the configuration for each RPC in this service.
|
449
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
450
|
+
# the following configuration fields:
|
451
|
+
#
|
452
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
453
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
454
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
455
|
+
# include the following keys:
|
456
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
457
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
458
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
459
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
460
|
+
# trigger a retry.
|
461
|
+
#
|
462
|
+
class Rpcs
|
463
|
+
##
|
464
|
+
# RPC-specific configuration for `evaluate_instances`
|
465
|
+
# @return [::Gapic::Config::Method]
|
466
|
+
#
|
467
|
+
attr_reader :evaluate_instances
|
468
|
+
|
469
|
+
# @private
|
470
|
+
def initialize parent_rpcs = nil
|
471
|
+
evaluate_instances_config = parent_rpcs.evaluate_instances if parent_rpcs.respond_to? :evaluate_instances
|
472
|
+
@evaluate_instances = ::Gapic::Config::Method.new evaluate_instances_config
|
473
|
+
|
474
|
+
yield self if block_given?
|
475
|
+
end
|
476
|
+
end
|
477
|
+
end
|
478
|
+
end
|
479
|
+
end
|
480
|
+
end
|
481
|
+
end
|
482
|
+
end
|
483
|
+
end
|
484
|
+
end
|