google-cloud-ai_platform-v1 0.47.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1a2575dd0d4500a8eecf92ce9e1c7176a51effffc1957f000d124ffdea20cef9
|
|
4
|
+
data.tar.gz: 826b04b88754cfaf266530b6573764aad6d8e42ef3a89e596842fc806c4e626f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a57dcb05530edefa51f6fdb19c77c56e20620221eb065a3720d639285df129719cf7e37929999cdb0037922218206790d19eee0ad2ebe678966162edec54d1e2
|
|
7
|
+
data.tar.gz: 9f21df7f67c69370fb2db35fc8941b47f03e3f73887c7c59190bad8fcf82c7f5d8e7aa6bbdb4d03cf545b66538636aca35dc43fc95f04471ee86afed165b2961
|
|
@@ -802,6 +802,12 @@ module Google
|
|
|
802
802
|
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
|
|
803
803
|
]
|
|
804
804
|
)
|
|
805
|
+
.with_bindings(
|
|
806
|
+
uri_method: :post,
|
|
807
|
+
uri_template: "/v1/datasets",
|
|
808
|
+
body: "dataset",
|
|
809
|
+
matches: []
|
|
810
|
+
)
|
|
805
811
|
transcoder.transcode request_pb
|
|
806
812
|
end
|
|
807
813
|
|
|
@@ -823,6 +829,13 @@ module Google
|
|
|
823
829
|
["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false]
|
|
824
830
|
]
|
|
825
831
|
)
|
|
832
|
+
.with_bindings(
|
|
833
|
+
uri_method: :get,
|
|
834
|
+
uri_template: "/v1/{name}",
|
|
835
|
+
matches: [
|
|
836
|
+
["name", %r{^datasets/[^/]+/?$}, false]
|
|
837
|
+
]
|
|
838
|
+
)
|
|
826
839
|
transcoder.transcode request_pb
|
|
827
840
|
end
|
|
828
841
|
|
|
@@ -845,6 +858,14 @@ module Google
|
|
|
845
858
|
["dataset.name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false]
|
|
846
859
|
]
|
|
847
860
|
)
|
|
861
|
+
.with_bindings(
|
|
862
|
+
uri_method: :patch,
|
|
863
|
+
uri_template: "/v1/{dataset.name}",
|
|
864
|
+
body: "dataset",
|
|
865
|
+
matches: [
|
|
866
|
+
["dataset.name", %r{^datasets/[^/]+/?$}, false]
|
|
867
|
+
]
|
|
868
|
+
)
|
|
848
869
|
transcoder.transcode request_pb
|
|
849
870
|
end
|
|
850
871
|
|
|
@@ -866,6 +887,11 @@ module Google
|
|
|
866
887
|
["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
|
|
867
888
|
]
|
|
868
889
|
)
|
|
890
|
+
.with_bindings(
|
|
891
|
+
uri_method: :get,
|
|
892
|
+
uri_template: "/v1/datasets",
|
|
893
|
+
matches: []
|
|
894
|
+
)
|
|
869
895
|
transcoder.transcode request_pb
|
|
870
896
|
end
|
|
871
897
|
|
|
@@ -887,6 +913,13 @@ module Google
|
|
|
887
913
|
["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false]
|
|
888
914
|
]
|
|
889
915
|
)
|
|
916
|
+
.with_bindings(
|
|
917
|
+
uri_method: :delete,
|
|
918
|
+
uri_template: "/v1/{name}",
|
|
919
|
+
matches: [
|
|
920
|
+
["name", %r{^datasets/[^/]+/?$}, false]
|
|
921
|
+
]
|
|
922
|
+
)
|
|
890
923
|
transcoder.transcode request_pb
|
|
891
924
|
end
|
|
892
925
|
|
|
@@ -953,6 +986,14 @@ module Google
|
|
|
953
986
|
["parent", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false]
|
|
954
987
|
]
|
|
955
988
|
)
|
|
989
|
+
.with_bindings(
|
|
990
|
+
uri_method: :post,
|
|
991
|
+
uri_template: "/v1/{parent}/datasetVersions",
|
|
992
|
+
body: "dataset_version",
|
|
993
|
+
matches: [
|
|
994
|
+
["parent", %r{^datasets/[^/]+/?$}, false]
|
|
995
|
+
]
|
|
996
|
+
)
|
|
956
997
|
transcoder.transcode request_pb
|
|
957
998
|
end
|
|
958
999
|
|
|
@@ -975,6 +1016,14 @@ module Google
|
|
|
975
1016
|
["dataset_version.name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/datasetVersions/[^/]+/?$}, false]
|
|
976
1017
|
]
|
|
977
1018
|
)
|
|
1019
|
+
.with_bindings(
|
|
1020
|
+
uri_method: :patch,
|
|
1021
|
+
uri_template: "/v1/{dataset_version.name}",
|
|
1022
|
+
body: "dataset_version",
|
|
1023
|
+
matches: [
|
|
1024
|
+
["dataset_version.name", %r{^datasets/[^/]+/datasetVersions/[^/]+/?$}, false]
|
|
1025
|
+
]
|
|
1026
|
+
)
|
|
978
1027
|
transcoder.transcode request_pb
|
|
979
1028
|
end
|
|
980
1029
|
|
|
@@ -996,6 +1045,13 @@ module Google
|
|
|
996
1045
|
["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/datasetVersions/[^/]+/?$}, false]
|
|
997
1046
|
]
|
|
998
1047
|
)
|
|
1048
|
+
.with_bindings(
|
|
1049
|
+
uri_method: :delete,
|
|
1050
|
+
uri_template: "/v1/{name}",
|
|
1051
|
+
matches: [
|
|
1052
|
+
["name", %r{^datasets/[^/]+/datasetVersions/[^/]+/?$}, false]
|
|
1053
|
+
]
|
|
1054
|
+
)
|
|
999
1055
|
transcoder.transcode request_pb
|
|
1000
1056
|
end
|
|
1001
1057
|
|
|
@@ -1017,6 +1073,13 @@ module Google
|
|
|
1017
1073
|
["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/datasetVersions/[^/]+/?$}, false]
|
|
1018
1074
|
]
|
|
1019
1075
|
)
|
|
1076
|
+
.with_bindings(
|
|
1077
|
+
uri_method: :get,
|
|
1078
|
+
uri_template: "/v1/{name}",
|
|
1079
|
+
matches: [
|
|
1080
|
+
["name", %r{^datasets/[^/]+/datasetVersions/[^/]+/?$}, false]
|
|
1081
|
+
]
|
|
1082
|
+
)
|
|
1020
1083
|
transcoder.transcode request_pb
|
|
1021
1084
|
end
|
|
1022
1085
|
|
|
@@ -1038,6 +1101,13 @@ module Google
|
|
|
1038
1101
|
["parent", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/?$}, false]
|
|
1039
1102
|
]
|
|
1040
1103
|
)
|
|
1104
|
+
.with_bindings(
|
|
1105
|
+
uri_method: :get,
|
|
1106
|
+
uri_template: "/v1/{parent}/datasetVersions",
|
|
1107
|
+
matches: [
|
|
1108
|
+
["parent", %r{^datasets/[^/]+/?$}, false]
|
|
1109
|
+
]
|
|
1110
|
+
)
|
|
1041
1111
|
transcoder.transcode request_pb
|
|
1042
1112
|
end
|
|
1043
1113
|
|
|
@@ -1059,6 +1129,13 @@ module Google
|
|
|
1059
1129
|
["name", %r{^projects/[^/]+/locations/[^/]+/datasets/[^/]+/datasetVersions/[^/]+/?$}, false]
|
|
1060
1130
|
]
|
|
1061
1131
|
)
|
|
1132
|
+
.with_bindings(
|
|
1133
|
+
uri_method: :get,
|
|
1134
|
+
uri_template: "/v1/{name}:restore",
|
|
1135
|
+
matches: [
|
|
1136
|
+
["name", %r{^datasets/[^/]+/datasetVersions/[^/]+/?$}, false]
|
|
1137
|
+
]
|
|
1138
|
+
)
|
|
1062
1139
|
transcoder.transcode request_pb
|
|
1063
1140
|
end
|
|
1064
1141
|
|
|
@@ -0,0 +1,508 @@
|
|
|
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/location"
|
|
22
|
+
require "google/iam/v1"
|
|
23
|
+
|
|
24
|
+
module Google
|
|
25
|
+
module Cloud
|
|
26
|
+
module AIPlatform
|
|
27
|
+
module V1
|
|
28
|
+
module EvaluationService
|
|
29
|
+
##
|
|
30
|
+
# Client for the EvaluationService service.
|
|
31
|
+
#
|
|
32
|
+
# Vertex AI Online Evaluation Service.
|
|
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 :evaluation_service_stub
|
|
45
|
+
|
|
46
|
+
##
|
|
47
|
+
# Configure the EvaluationService Client class.
|
|
48
|
+
#
|
|
49
|
+
# See {::Google::Cloud::AIPlatform::V1::EvaluationService::Client::Configuration}
|
|
50
|
+
# for a description of the configuration fields.
|
|
51
|
+
#
|
|
52
|
+
# @example
|
|
53
|
+
#
|
|
54
|
+
# # Modify the configuration for all EvaluationService clients
|
|
55
|
+
# ::Google::Cloud::AIPlatform::V1::EvaluationService::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 EvaluationService 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::EvaluationService::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
|
+
@evaluation_service_stub.universe_domain
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
##
|
|
111
|
+
# Create a new EvaluationService client object.
|
|
112
|
+
#
|
|
113
|
+
# @example
|
|
114
|
+
#
|
|
115
|
+
# # Create a client using the default configuration
|
|
116
|
+
# client = ::Google::Cloud::AIPlatform::V1::EvaluationService::Client.new
|
|
117
|
+
#
|
|
118
|
+
# # Create a client using a custom configuration
|
|
119
|
+
# client = ::Google::Cloud::AIPlatform::V1::EvaluationService::Client.new do |config|
|
|
120
|
+
# config.timeout = 10.0
|
|
121
|
+
# end
|
|
122
|
+
#
|
|
123
|
+
# @yield [config] Configure the EvaluationService 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/evaluation_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
|
+
@evaluation_service_stub = ::Gapic::ServiceStub.new(
|
|
155
|
+
::Google::Cloud::AIPlatform::V1::EvaluationService::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 = @evaluation_service_stub.endpoint
|
|
169
|
+
config.universe_domain = @evaluation_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 = @evaluation_service_stub.endpoint
|
|
176
|
+
config.universe_domain = @evaluation_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
|
+
# Evaluates instances based on a given metric.
|
|
198
|
+
#
|
|
199
|
+
# @overload evaluate_instances(request, options = nil)
|
|
200
|
+
# Pass arguments to `evaluate_instances` via a request object, either of type
|
|
201
|
+
# {::Google::Cloud::AIPlatform::V1::EvaluateInstancesRequest} or an equivalent Hash.
|
|
202
|
+
#
|
|
203
|
+
# @param request [::Google::Cloud::AIPlatform::V1::EvaluateInstancesRequest, ::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 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)
|
|
210
|
+
# Pass arguments to `evaluate_instances` 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 exact_match_input [::Google::Cloud::AIPlatform::V1::ExactMatchInput, ::Hash]
|
|
215
|
+
# Auto metric instances.
|
|
216
|
+
# Instances and metric spec for exact match metric.
|
|
217
|
+
# @param bleu_input [::Google::Cloud::AIPlatform::V1::BleuInput, ::Hash]
|
|
218
|
+
# Instances and metric spec for bleu metric.
|
|
219
|
+
# @param rouge_input [::Google::Cloud::AIPlatform::V1::RougeInput, ::Hash]
|
|
220
|
+
# Instances and metric spec for rouge metric.
|
|
221
|
+
# @param fluency_input [::Google::Cloud::AIPlatform::V1::FluencyInput, ::Hash]
|
|
222
|
+
# LLM-based metric instance.
|
|
223
|
+
# General text generation metrics, applicable to other categories.
|
|
224
|
+
# Input for fluency metric.
|
|
225
|
+
# @param coherence_input [::Google::Cloud::AIPlatform::V1::CoherenceInput, ::Hash]
|
|
226
|
+
# Input for coherence metric.
|
|
227
|
+
# @param safety_input [::Google::Cloud::AIPlatform::V1::SafetyInput, ::Hash]
|
|
228
|
+
# Input for safety metric.
|
|
229
|
+
# @param groundedness_input [::Google::Cloud::AIPlatform::V1::GroundednessInput, ::Hash]
|
|
230
|
+
# Input for groundedness metric.
|
|
231
|
+
# @param fulfillment_input [::Google::Cloud::AIPlatform::V1::FulfillmentInput, ::Hash]
|
|
232
|
+
# Input for fulfillment metric.
|
|
233
|
+
# @param summarization_quality_input [::Google::Cloud::AIPlatform::V1::SummarizationQualityInput, ::Hash]
|
|
234
|
+
# Input for summarization quality metric.
|
|
235
|
+
# @param pairwise_summarization_quality_input [::Google::Cloud::AIPlatform::V1::PairwiseSummarizationQualityInput, ::Hash]
|
|
236
|
+
# Input for pairwise summarization quality metric.
|
|
237
|
+
# @param summarization_helpfulness_input [::Google::Cloud::AIPlatform::V1::SummarizationHelpfulnessInput, ::Hash]
|
|
238
|
+
# Input for summarization helpfulness metric.
|
|
239
|
+
# @param summarization_verbosity_input [::Google::Cloud::AIPlatform::V1::SummarizationVerbosityInput, ::Hash]
|
|
240
|
+
# Input for summarization verbosity metric.
|
|
241
|
+
# @param question_answering_quality_input [::Google::Cloud::AIPlatform::V1::QuestionAnsweringQualityInput, ::Hash]
|
|
242
|
+
# Input for question answering quality metric.
|
|
243
|
+
# @param pairwise_question_answering_quality_input [::Google::Cloud::AIPlatform::V1::PairwiseQuestionAnsweringQualityInput, ::Hash]
|
|
244
|
+
# Input for pairwise question answering quality metric.
|
|
245
|
+
# @param question_answering_relevance_input [::Google::Cloud::AIPlatform::V1::QuestionAnsweringRelevanceInput, ::Hash]
|
|
246
|
+
# Input for question answering relevance metric.
|
|
247
|
+
# @param question_answering_helpfulness_input [::Google::Cloud::AIPlatform::V1::QuestionAnsweringHelpfulnessInput, ::Hash]
|
|
248
|
+
# Input for question answering helpfulness
|
|
249
|
+
# metric.
|
|
250
|
+
# @param question_answering_correctness_input [::Google::Cloud::AIPlatform::V1::QuestionAnsweringCorrectnessInput, ::Hash]
|
|
251
|
+
# Input for question answering correctness
|
|
252
|
+
# metric.
|
|
253
|
+
# @param pointwise_metric_input [::Google::Cloud::AIPlatform::V1::PointwiseMetricInput, ::Hash]
|
|
254
|
+
# Input for pointwise metric.
|
|
255
|
+
# @param pairwise_metric_input [::Google::Cloud::AIPlatform::V1::PairwiseMetricInput, ::Hash]
|
|
256
|
+
# Input for pairwise metric.
|
|
257
|
+
# @param tool_call_valid_input [::Google::Cloud::AIPlatform::V1::ToolCallValidInput, ::Hash]
|
|
258
|
+
# Tool call metric instances.
|
|
259
|
+
# Input for tool call valid metric.
|
|
260
|
+
# @param tool_name_match_input [::Google::Cloud::AIPlatform::V1::ToolNameMatchInput, ::Hash]
|
|
261
|
+
# Input for tool name match metric.
|
|
262
|
+
# @param tool_parameter_key_match_input [::Google::Cloud::AIPlatform::V1::ToolParameterKeyMatchInput, ::Hash]
|
|
263
|
+
# Input for tool parameter key match metric.
|
|
264
|
+
# @param tool_parameter_kv_match_input [::Google::Cloud::AIPlatform::V1::ToolParameterKVMatchInput, ::Hash]
|
|
265
|
+
# Input for tool parameter key value match metric.
|
|
266
|
+
# @param location [::String]
|
|
267
|
+
# Required. The resource name of the Location to evaluate the instances.
|
|
268
|
+
# Format: `projects/{project}/locations/{location}`
|
|
269
|
+
#
|
|
270
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
|
271
|
+
# @yieldparam response [::Google::Cloud::AIPlatform::V1::EvaluateInstancesResponse]
|
|
272
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
|
273
|
+
#
|
|
274
|
+
# @return [::Google::Cloud::AIPlatform::V1::EvaluateInstancesResponse]
|
|
275
|
+
#
|
|
276
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
|
277
|
+
#
|
|
278
|
+
# @example Basic example
|
|
279
|
+
# require "google/cloud/ai_platform/v1"
|
|
280
|
+
#
|
|
281
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
282
|
+
# client = Google::Cloud::AIPlatform::V1::EvaluationService::Client.new
|
|
283
|
+
#
|
|
284
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
285
|
+
# request = Google::Cloud::AIPlatform::V1::EvaluateInstancesRequest.new
|
|
286
|
+
#
|
|
287
|
+
# # Call the evaluate_instances method.
|
|
288
|
+
# result = client.evaluate_instances request
|
|
289
|
+
#
|
|
290
|
+
# # The returned object is of type Google::Cloud::AIPlatform::V1::EvaluateInstancesResponse.
|
|
291
|
+
# p result
|
|
292
|
+
#
|
|
293
|
+
def evaluate_instances request, options = nil
|
|
294
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
295
|
+
|
|
296
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::EvaluateInstancesRequest
|
|
297
|
+
|
|
298
|
+
# Converts hash and nil to an options object
|
|
299
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
300
|
+
|
|
301
|
+
# Customize the options with defaults
|
|
302
|
+
metadata = @config.rpcs.evaluate_instances.metadata.to_h
|
|
303
|
+
|
|
304
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
305
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
306
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
307
|
+
gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
|
|
308
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
309
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
310
|
+
|
|
311
|
+
header_params = {}
|
|
312
|
+
if request.location
|
|
313
|
+
header_params["location"] = request.location
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
|
317
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
|
318
|
+
|
|
319
|
+
options.apply_defaults timeout: @config.rpcs.evaluate_instances.timeout,
|
|
320
|
+
metadata: metadata,
|
|
321
|
+
retry_policy: @config.rpcs.evaluate_instances.retry_policy
|
|
322
|
+
|
|
323
|
+
options.apply_defaults timeout: @config.timeout,
|
|
324
|
+
metadata: @config.metadata,
|
|
325
|
+
retry_policy: @config.retry_policy
|
|
326
|
+
|
|
327
|
+
@evaluation_service_stub.call_rpc :evaluate_instances, request, options: options do |response, operation|
|
|
328
|
+
yield response, operation if block_given?
|
|
329
|
+
return response
|
|
330
|
+
end
|
|
331
|
+
rescue ::GRPC::BadStatus => e
|
|
332
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
##
|
|
336
|
+
# Configuration class for the EvaluationService API.
|
|
337
|
+
#
|
|
338
|
+
# This class represents the configuration for EvaluationService,
|
|
339
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
340
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
341
|
+
# applied individually to specific RPCs. See
|
|
342
|
+
# {::Google::Cloud::AIPlatform::V1::EvaluationService::Client::Configuration::Rpcs}
|
|
343
|
+
# for a list of RPCs that can be configured independently.
|
|
344
|
+
#
|
|
345
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
346
|
+
# on construction.
|
|
347
|
+
#
|
|
348
|
+
# @example
|
|
349
|
+
#
|
|
350
|
+
# # Modify the global config, setting the timeout for
|
|
351
|
+
# # evaluate_instances to 20 seconds,
|
|
352
|
+
# # and all remaining timeouts to 10 seconds.
|
|
353
|
+
# ::Google::Cloud::AIPlatform::V1::EvaluationService::Client.configure do |config|
|
|
354
|
+
# config.timeout = 10.0
|
|
355
|
+
# config.rpcs.evaluate_instances.timeout = 20.0
|
|
356
|
+
# end
|
|
357
|
+
#
|
|
358
|
+
# # Apply the above configuration only to a new client.
|
|
359
|
+
# client = ::Google::Cloud::AIPlatform::V1::EvaluationService::Client.new do |config|
|
|
360
|
+
# config.timeout = 10.0
|
|
361
|
+
# config.rpcs.evaluate_instances.timeout = 20.0
|
|
362
|
+
# end
|
|
363
|
+
#
|
|
364
|
+
# @!attribute [rw] endpoint
|
|
365
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
366
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
367
|
+
# @return [::String,nil]
|
|
368
|
+
# @!attribute [rw] credentials
|
|
369
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
370
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
371
|
+
# * (`Hash`) A service account key as a Hash
|
|
372
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
373
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
374
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
375
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
376
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
|
377
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
|
378
|
+
# * (`nil`) indicating no credentials
|
|
379
|
+
# @return [::Object]
|
|
380
|
+
# @!attribute [rw] scope
|
|
381
|
+
# The OAuth scopes
|
|
382
|
+
# @return [::Array<::String>]
|
|
383
|
+
# @!attribute [rw] lib_name
|
|
384
|
+
# The library name as recorded in instrumentation and logging
|
|
385
|
+
# @return [::String]
|
|
386
|
+
# @!attribute [rw] lib_version
|
|
387
|
+
# The library version as recorded in instrumentation and logging
|
|
388
|
+
# @return [::String]
|
|
389
|
+
# @!attribute [rw] channel_args
|
|
390
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
|
391
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
|
392
|
+
# @return [::Hash]
|
|
393
|
+
# @!attribute [rw] interceptors
|
|
394
|
+
# An array of interceptors that are run before calls are executed.
|
|
395
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
|
396
|
+
# @!attribute [rw] timeout
|
|
397
|
+
# The call timeout in seconds.
|
|
398
|
+
# @return [::Numeric]
|
|
399
|
+
# @!attribute [rw] metadata
|
|
400
|
+
# Additional gRPC headers to be sent with the call.
|
|
401
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
402
|
+
# @!attribute [rw] retry_policy
|
|
403
|
+
# The retry policy. The value is a hash with the following keys:
|
|
404
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
405
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
406
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
407
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
408
|
+
# trigger a retry.
|
|
409
|
+
# @return [::Hash]
|
|
410
|
+
# @!attribute [rw] quota_project
|
|
411
|
+
# A separate project against which to charge quota.
|
|
412
|
+
# @return [::String]
|
|
413
|
+
# @!attribute [rw] universe_domain
|
|
414
|
+
# The universe domain within which to make requests. This determines the
|
|
415
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
416
|
+
# universe (usually the default "googleapis.com" universe).
|
|
417
|
+
# @return [::String,nil]
|
|
418
|
+
#
|
|
419
|
+
class Configuration
|
|
420
|
+
extend ::Gapic::Config
|
|
421
|
+
|
|
422
|
+
# @private
|
|
423
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
424
|
+
DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
|
|
425
|
+
|
|
426
|
+
config_attr :endpoint, nil, ::String, nil
|
|
427
|
+
config_attr :credentials, nil do |value|
|
|
428
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
|
429
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
|
430
|
+
allowed.any? { |klass| klass === value }
|
|
431
|
+
end
|
|
432
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
433
|
+
config_attr :lib_name, nil, ::String, nil
|
|
434
|
+
config_attr :lib_version, nil, ::String, nil
|
|
435
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
|
436
|
+
config_attr :interceptors, nil, ::Array, nil
|
|
437
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
438
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
439
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
440
|
+
config_attr :quota_project, nil, ::String, nil
|
|
441
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
442
|
+
|
|
443
|
+
# @private
|
|
444
|
+
def initialize parent_config = nil
|
|
445
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
446
|
+
|
|
447
|
+
yield self if block_given?
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
##
|
|
451
|
+
# Configurations for individual RPCs
|
|
452
|
+
# @return [Rpcs]
|
|
453
|
+
#
|
|
454
|
+
def rpcs
|
|
455
|
+
@rpcs ||= begin
|
|
456
|
+
parent_rpcs = nil
|
|
457
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
458
|
+
Rpcs.new parent_rpcs
|
|
459
|
+
end
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
##
|
|
463
|
+
# Configuration for the channel pool
|
|
464
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
|
465
|
+
#
|
|
466
|
+
def channel_pool
|
|
467
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
##
|
|
471
|
+
# Configuration RPC class for the EvaluationService API.
|
|
472
|
+
#
|
|
473
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
474
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
475
|
+
# the following configuration fields:
|
|
476
|
+
#
|
|
477
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
478
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
|
479
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
480
|
+
# include the following keys:
|
|
481
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
482
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
483
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
484
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
485
|
+
# trigger a retry.
|
|
486
|
+
#
|
|
487
|
+
class Rpcs
|
|
488
|
+
##
|
|
489
|
+
# RPC-specific configuration for `evaluate_instances`
|
|
490
|
+
# @return [::Gapic::Config::Method]
|
|
491
|
+
#
|
|
492
|
+
attr_reader :evaluate_instances
|
|
493
|
+
|
|
494
|
+
# @private
|
|
495
|
+
def initialize parent_rpcs = nil
|
|
496
|
+
evaluate_instances_config = parent_rpcs.evaluate_instances if parent_rpcs.respond_to? :evaluate_instances
|
|
497
|
+
@evaluate_instances = ::Gapic::Config::Method.new evaluate_instances_config
|
|
498
|
+
|
|
499
|
+
yield self if block_given?
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
end
|
|
505
|
+
end
|
|
506
|
+
end
|
|
507
|
+
end
|
|
508
|
+
end
|