Class: Google::Cloud::AIPlatform::V1::PredictionService::Rest::ServiceStub
- Inherits:
-
Object
- Object
- Google::Cloud::AIPlatform::V1::PredictionService::Rest::ServiceStub
- Defined in:
- lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb
Overview
REST service stub for the PredictionService service. Service stub contains baseline method implementations including transcoding, making the REST call, and deserialing the response.
Instance Method Summary collapse
-
#direct_predict(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::DirectPredictResponse
Baseline implementation for the direct_predict REST call.
-
#direct_raw_predict(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::DirectRawPredictResponse
Baseline implementation for the direct_raw_predict REST call.
-
#embed_content(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::EmbedContentResponse
Baseline implementation for the embed_content REST call.
-
#endpoint ⇒ String
The effective endpoint.
-
#explain(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::ExplainResponse
Baseline implementation for the explain REST call.
-
#generate_content(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::GenerateContentResponse
Baseline implementation for the generate_content REST call.
-
#logger(stub: false) ⇒ Logger
The logger used for request/response debug logging.
-
#predict(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::PredictResponse
Baseline implementation for the predict REST call.
-
#raw_predict(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Api::HttpBody
Baseline implementation for the raw_predict REST call.
-
#server_streaming_predict(request_pb, options = nil) {|chunk| ... } ⇒ ::Gapic::Rest::TransportOperation
Baseline implementation for the server_streaming_predict REST call.
-
#stream_generate_content(request_pb, options = nil) {|chunk| ... } ⇒ ::Gapic::Rest::TransportOperation
Baseline implementation for the stream_generate_content REST call.
-
#stream_raw_predict(request_pb, options = nil) {|chunk| ... } ⇒ ::Gapic::Rest::TransportOperation
Baseline implementation for the stream_raw_predict REST call.
-
#universe_domain ⇒ String
The effective universe domain.
Instance Method Details
#direct_predict(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::DirectPredictResponse
Baseline implementation for the direct_predict REST call
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 204 def direct_predict request_pb, = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_direct_predict_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "direct_predict", options: ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::AIPlatform::V1::DirectPredictResponse.decode_json response.body, ignore_unknown_fields: true catch :response do yield result, operation if block_given? result end end |
#direct_raw_predict(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::DirectRawPredictResponse
Baseline implementation for the direct_raw_predict REST call
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 244 def direct_raw_predict request_pb, = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_direct_raw_predict_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "direct_raw_predict", options: ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::AIPlatform::V1::DirectRawPredictResponse.decode_json response.body, ignore_unknown_fields: true catch :response do yield result, operation if block_given? result end end |
#embed_content(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::EmbedContentResponse
Baseline implementation for the embed_content REST call
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 432 def request_pb, = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub. request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "embed_content", options: ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::AIPlatform::V1::EmbedContentResponse.decode_json response.body, ignore_unknown_fields: true catch :response do yield result, operation if block_given? result end end |
#endpoint ⇒ String
The effective endpoint
63 64 65 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 63 def endpoint @client_stub.endpoint end |
#explain(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::ExplainResponse
Baseline implementation for the explain REST call
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 318 def explain request_pb, = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_explain_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "explain", options: ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::AIPlatform::V1::ExplainResponse.decode_json response.body, ignore_unknown_fields: true catch :response do yield result, operation if block_given? result end end |
#generate_content(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::GenerateContentResponse
Baseline implementation for the generate_content REST call
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 358 def generate_content request_pb, = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_generate_content_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "generate_content", options: ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::AIPlatform::V1::GenerateContentResponse.decode_json response.body, ignore_unknown_fields: true catch :response do yield result, operation if block_given? result end end |
#logger(stub: false) ⇒ Logger
The logger used for request/response debug logging.
72 73 74 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 72 def logger stub: false stub ? @client_stub.stub_logger : @client_stub.logger end |
#predict(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Cloud::AIPlatform::V1::PredictResponse
Baseline implementation for the predict REST call
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 90 def predict request_pb, = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_predict_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "predict", options: ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::AIPlatform::V1::PredictResponse.decode_json response.body, ignore_unknown_fields: true catch :response do yield result, operation if block_given? result end end |
#raw_predict(request_pb, options = nil) {|result, operation| ... } ⇒ ::Google::Api::HttpBody
Baseline implementation for the raw_predict REST call
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 130 def raw_predict request_pb, = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_raw_predict_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "raw_predict", options: ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Api::HttpBody.decode_json response.body, ignore_unknown_fields: true catch :response do yield result, operation if block_given? result end end |
#server_streaming_predict(request_pb, options = nil) {|chunk| ... } ⇒ ::Gapic::Rest::TransportOperation
Baseline implementation for the server_streaming_predict REST call
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 281 def server_streaming_predict(request_pb, = nil, &) raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_server_streaming_predict_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "server_streaming_predict", options: , is_server_streaming: true, & ) ::Gapic::Rest::TransportOperation.new response end |
#stream_generate_content(request_pb, options = nil) {|chunk| ... } ⇒ ::Gapic::Rest::TransportOperation
Baseline implementation for the stream_generate_content REST call
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 395 def stream_generate_content(request_pb, = nil, &) raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_stream_generate_content_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "stream_generate_content", options: , is_server_streaming: true, & ) ::Gapic::Rest::TransportOperation.new response end |
#stream_raw_predict(request_pb, options = nil) {|chunk| ... } ⇒ ::Gapic::Rest::TransportOperation
Baseline implementation for the stream_raw_predict REST call
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 167 def stream_raw_predict(request_pb, = nil, &) raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_stream_raw_predict_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, method_name: "stream_raw_predict", options: , is_server_streaming: true, & ) ::Gapic::Rest::TransportOperation.new response end |
#universe_domain ⇒ String
The effective universe domain
54 55 56 |
# File 'lib/google/cloud/ai_platform/v1/prediction_service/rest/service_stub.rb', line 54 def universe_domain @client_stub.universe_domain end |