From 736ff8bf73959cbc6e0caa0125bf4dd2ba0776dc Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:08:01 -0800 Subject: [PATCH] feat: add grpc_ports to UploadModel ModelContainerSpec (#4836) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add grpc_ports to UploadModel ModelContainerSpec feat: add DirectPredict to PredictionService feat: add DirectRawPredict to PredictionService feat: add StreamingPredict to PredictionService. feat: add StreamingRawPredict to PredictionService. PiperOrigin-RevId: 583502805 Source-Link: https://github.com/googleapis/googleapis/commit/31c70c91df94c85ee372de99a1a6cb061d018c17 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a041c3d8068cb99a1dcf83124d0cd63eba91a4c7 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFpcGxhdGZvcm0vLk93bEJvdC55YW1sIiwiaCI6ImEwNDFjM2Q4MDY4Y2I5OWExZGNmODMxMjRkMGNkNjNlYmE5MWE0YzcifQ== * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update .OwlBot.lock.yaml * Update .OwlBot.lock.yaml * feat: add grpc_ports to UploadModel ModelContainerSpec feat: add DirectPredict to PredictionService feat: add DirectRawPredict to PredictionService feat: add StreamingPredict to PredictionService. feat: add StreamingRawPredict to PredictionService. PiperOrigin-RevId: 586417186 Source-Link: https://github.com/googleapis/googleapis/commit/362f61ee4a0178ca1e3fe2be4c34cd9d4acd2e12 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a81e5343ce6ca9ee4a545549dc32edc2350530aa Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFpcGxhdGZvcm0vLk93bEJvdC55YW1sIiwiaCI6ImE4MWU1MzQzY2U2Y2E5ZWU0YTU0NTU0OWRjMzJlZGMyMzUwNTMwYWEifQ== * Update .OwlBot.lock.yaml * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com> --- .github/.OwlBot.lock.yaml | 2 +- packages/google-cloud-aiplatform/README.md | 8 + .../google/cloud/aiplatform/v1/model.proto | 11 + .../aiplatform/v1/prediction_service.proto | 134 + .../cloud/aiplatform/v1beta1/model.proto | 11 + .../v1beta1/prediction_service.proto | 134 + .../protos/protos.d.ts | 1428 +++++++ .../google-cloud-aiplatform/protos/protos.js | 3296 +++++++++++++++++ .../protos/protos.json | 284 ++ .../google-cloud-aiplatform/samples/README.md | 144 + .../v1/prediction_service.direct_predict.js | 71 + .../prediction_service.direct_raw_predict.js | 76 + .../prediction_service.streaming_predict.js | 75 + ...rediction_service.streaming_raw_predict.js | 80 + ...t_metadata_google.cloud.aiplatform.v1.json | 192 + .../prediction_service.direct_predict.js | 71 + .../prediction_service.direct_raw_predict.js | 76 + .../prediction_service.streaming_predict.js | 75 + ...rediction_service.streaming_raw_predict.js | 80 + ...adata_google.cloud.aiplatform.v1beta1.json | 192 + .../src/v1/gapic_metadata.json | 30 + .../src/v1/prediction_service_client.ts | 250 ++ .../v1/prediction_service_client_config.json | 16 + .../src/v1beta1/gapic_metadata.json | 30 + .../src/v1beta1/prediction_service_client.ts | 256 ++ .../prediction_service_client_config.json | 16 + .../test/gapic_job_service_v1.ts | 40 +- .../test/gapic_job_service_v1beta1.ts | 40 +- .../test/gapic_prediction_service_v1.ts | 454 +++ .../test/gapic_prediction_service_v1beta1.ts | 466 +++ .../test/gapic_tensorboard_service_v1.ts | 5 +- .../test/gapic_tensorboard_service_v1beta1.ts | 5 +- 32 files changed, 7993 insertions(+), 55 deletions(-) create mode 100644 packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js create mode 100644 packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js create mode 100644 packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js create mode 100644 packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js create mode 100644 packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js create mode 100644 packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js create mode 100644 packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js create mode 100644 packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index af7d503979e..6a0a3f580d4 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,4 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-nodejs-mono-repo:latest - digest: sha256:2bd6069d367ef0365b62f767340e701c9ffc542c8a771bb5acc25372b43e2e15 + digest: sha256:d0e93e9b8200735d340af007596e42db8afaba48e29d06cebf41a06cb4e6f8d2 diff --git a/packages/google-cloud-aiplatform/README.md b/packages/google-cloud-aiplatform/README.md index 704c3bf78e9..5255d09d56b 100644 --- a/packages/google-cloud-aiplatform/README.md +++ b/packages/google-cloud-aiplatform/README.md @@ -293,10 +293,14 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Pipeline_service.get_training_pipeline | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/pipeline_service.get_training_pipeline.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/pipeline_service.get_training_pipeline.js,packages/google-cloud-aiplatform/samples/README.md) | | Pipeline_service.list_pipeline_jobs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/pipeline_service.list_pipeline_jobs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/pipeline_service.list_pipeline_jobs.js,packages/google-cloud-aiplatform/samples/README.md) | | Pipeline_service.list_training_pipelines | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/pipeline_service.list_training_pipelines.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/pipeline_service.list_training_pipelines.js,packages/google-cloud-aiplatform/samples/README.md) | +| Prediction_service.direct_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js,packages/google-cloud-aiplatform/samples/README.md) | +| Prediction_service.direct_raw_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.explain | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.explain.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.explain.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.predict.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.raw_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.raw_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.raw_predict.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.server_streaming_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.server_streaming_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.server_streaming_predict.js,packages/google-cloud-aiplatform/samples/README.md) | +| Prediction_service.streaming_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js,packages/google-cloud-aiplatform/samples/README.md) | +| Prediction_service.streaming_raw_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js,packages/google-cloud-aiplatform/samples/README.md) | | Schedule_service.create_schedule | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/schedule_service.create_schedule.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/schedule_service.create_schedule.js,packages/google-cloud-aiplatform/samples/README.md) | | Schedule_service.delete_schedule | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/schedule_service.delete_schedule.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/schedule_service.delete_schedule.js,packages/google-cloud-aiplatform/samples/README.md) | | Schedule_service.get_schedule | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/schedule_service.get_schedule.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/schedule_service.get_schedule.js,packages/google-cloud-aiplatform/samples/README.md) | @@ -558,10 +562,14 @@ Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/ | Pipeline_service.list_pipeline_jobs | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/pipeline_service.list_pipeline_jobs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/pipeline_service.list_pipeline_jobs.js,packages/google-cloud-aiplatform/samples/README.md) | | Pipeline_service.list_training_pipelines | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/pipeline_service.list_training_pipelines.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/pipeline_service.list_training_pipelines.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.count_tokens | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.count_tokens.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.count_tokens.js,packages/google-cloud-aiplatform/samples/README.md) | +| Prediction_service.direct_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js,packages/google-cloud-aiplatform/samples/README.md) | +| Prediction_service.direct_raw_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.explain | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.explain.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.explain.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.predict.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.raw_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.raw_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.raw_predict.js,packages/google-cloud-aiplatform/samples/README.md) | | Prediction_service.server_streaming_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.server_streaming_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.server_streaming_predict.js,packages/google-cloud-aiplatform/samples/README.md) | +| Prediction_service.streaming_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js,packages/google-cloud-aiplatform/samples/README.md) | +| Prediction_service.streaming_raw_predict | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js,packages/google-cloud-aiplatform/samples/README.md) | | Schedule_service.create_schedule | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/schedule_service.create_schedule.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/schedule_service.create_schedule.js,packages/google-cloud-aiplatform/samples/README.md) | | Schedule_service.delete_schedule | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/schedule_service.delete_schedule.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/schedule_service.delete_schedule.js,packages/google-cloud-aiplatform/samples/README.md) | | Schedule_service.get_schedule | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/schedule_service.get_schedule.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/schedule_service.get_schedule.js,packages/google-cloud-aiplatform/samples/README.md) | diff --git a/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1/model.proto b/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1/model.proto index 05d3ce28380..1ca0ce1d612 100644 --- a/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1/model.proto +++ b/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1/model.proto @@ -692,6 +692,17 @@ message ModelContainerSpec { // variable](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables).) string health_route = 7 [(google.api.field_behavior) = IMMUTABLE]; + // Immutable. List of ports to expose from the container. Vertex AI sends gRPC + // prediction requests that it receives to the first port on this list. Vertex + // AI also sends liveness and health checks to this port. + // + // If you do not specify this field, gRPC requests to the container will be + // disabled. + // + // Vertex AI does not use ports other than the first one listed. This field + // corresponds to the `ports` field of the Kubernetes Containers v1 core API. + repeated Port grpc_ports = 9 [(google.api.field_behavior) = IMMUTABLE]; + // Immutable. Deployment timeout. // Limit for deployment timeout is 2 hours. google.protobuf.Duration deployment_timeout = 10 diff --git a/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1/prediction_service.proto b/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1/prediction_service.proto index 881f981799e..34a848b4ee7 100644 --- a/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1/prediction_service.proto +++ b/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1/prediction_service.proto @@ -75,6 +75,29 @@ service PredictionService { option (google.api.method_signature) = "endpoint,http_body"; } + // Perform an unary online prediction request for Vertex first-party products + // and frameworks. + rpc DirectPredict(DirectPredictRequest) returns (DirectPredictResponse) { + option (google.api.http) = { + post: "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directPredict" + body: "*" + }; + } + + // Perform an online prediction request through gRPC. + rpc DirectRawPredict(DirectRawPredictRequest) + returns (DirectRawPredictResponse) { + option (google.api.http) = { + post: "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directRawPredict" + body: "*" + }; + } + + // Perform a streaming online prediction request for Vertex first-party + // products and frameworks. + rpc StreamingPredict(stream StreamingPredictRequest) + returns (stream StreamingPredictResponse) {} + // Perform a server-side streaming online prediction request for Vertex // LLM streaming. rpc ServerStreamingPredict(StreamingPredictRequest) @@ -89,6 +112,10 @@ service PredictionService { }; } + // Perform a streaming online prediction request through gRPC. + rpc StreamingRawPredict(stream StreamingRawPredictRequest) + returns (stream StreamingRawPredictResponse) {} + // Perform an online explanation. // // If @@ -211,6 +238,69 @@ message RawPredictRequest { google.api.HttpBody http_body = 2; } +// Request message for +// [PredictionService.DirectPredict][google.cloud.aiplatform.v1.PredictionService.DirectPredict]. +message DirectPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // The prediction input. + repeated Tensor inputs = 2; + + // The parameters that govern the prediction. + Tensor parameters = 3; +} + +// Response message for +// [PredictionService.DirectPredict][google.cloud.aiplatform.v1.PredictionService.DirectPredict]. +message DirectPredictResponse { + // The prediction output. + repeated Tensor outputs = 1; + + // The parameters that govern the prediction. + Tensor parameters = 2; +} + +// Request message for +// [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1.PredictionService.DirectRawPredict]. +message DirectRawPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // Fully qualified name of the API method being invoked to perform + // predictions. + // + // Format: + // `/namespace.Service/Method/` + // Example: + // `/tensorflow.serving.PredictionService/Predict` + string method_name = 2; + + // The prediction input. + bytes input = 3; +} + +// Response message for +// [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1.PredictionService.DirectRawPredict]. +message DirectRawPredictResponse { + // The prediction output. + bytes output = 1; +} + // Request message for // [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict]. // @@ -245,6 +335,50 @@ message StreamingPredictResponse { Tensor parameters = 2; } +// Request message for +// [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamingRawPredict]. +// +// The first message must contain +// [endpoint][google.cloud.aiplatform.v1.StreamingRawPredictRequest.endpoint] +// and +// [method_name][google.cloud.aiplatform.v1.StreamingRawPredictRequest.method_name] +// fields and optionally +// [input][google.cloud.aiplatform.v1.StreamingRawPredictRequest.input]. The +// subsequent messages must contain +// [input][google.cloud.aiplatform.v1.StreamingRawPredictRequest.input]. +// [method_name][google.cloud.aiplatform.v1.StreamingRawPredictRequest.method_name] +// in the subsequent messages have no effect. +message StreamingRawPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // Fully qualified name of the API method being invoked to perform + // predictions. + // + // Format: + // `/namespace.Service/Method/` + // Example: + // `/tensorflow.serving.PredictionService/Predict` + string method_name = 2; + + // The prediction input. + bytes input = 3; +} + +// Response message for +// [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamingRawPredict]. +message StreamingRawPredictResponse { + // The prediction output. + bytes output = 1; +} + // Request message for // [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain]. message ExplainRequest { diff --git a/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1beta1/model.proto b/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1beta1/model.proto index 10bf0807c10..ebe34457719 100644 --- a/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1beta1/model.proto +++ b/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1beta1/model.proto @@ -695,6 +695,17 @@ message ModelContainerSpec { // variable](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables).) string health_route = 7 [(google.api.field_behavior) = IMMUTABLE]; + // Immutable. List of ports to expose from the container. Vertex AI sends gRPC + // prediction requests that it receives to the first port on this list. Vertex + // AI also sends liveness and health checks to this port. + // + // If you do not specify this field, gRPC requests to the container will be + // disabled. + // + // Vertex AI does not use ports other than the first one listed. This field + // corresponds to the `ports` field of the Kubernetes Containers v1 core API. + repeated Port grpc_ports = 9 [(google.api.field_behavior) = IMMUTABLE]; + // Immutable. Deployment timeout. // Limit for deployment timeout is 2 hours. google.protobuf.Duration deployment_timeout = 10 diff --git a/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1beta1/prediction_service.proto b/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1beta1/prediction_service.proto index 55b67ed4add..f5bb5d616c1 100644 --- a/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1beta1/prediction_service.proto +++ b/packages/google-cloud-aiplatform/protos/google/cloud/aiplatform/v1beta1/prediction_service.proto @@ -75,6 +75,29 @@ service PredictionService { option (google.api.method_signature) = "endpoint,http_body"; } + // Perform an unary online prediction request for Vertex first-party products + // and frameworks. + rpc DirectPredict(DirectPredictRequest) returns (DirectPredictResponse) { + option (google.api.http) = { + post: "/v1beta1/{endpoint=projects/*/locations/*/endpoints/*}:directPredict" + body: "*" + }; + } + + // Perform an online prediction request through gRPC. + rpc DirectRawPredict(DirectRawPredictRequest) + returns (DirectRawPredictResponse) { + option (google.api.http) = { + post: "/v1beta1/{endpoint=projects/*/locations/*/endpoints/*}:directRawPredict" + body: "*" + }; + } + + // Perform a streaming online prediction request for Vertex first-party + // products and frameworks. + rpc StreamingPredict(stream StreamingPredictRequest) + returns (stream StreamingPredictResponse) {} + // Perform a server-side streaming online prediction request for Vertex // LLM streaming. rpc ServerStreamingPredict(StreamingPredictRequest) @@ -89,6 +112,10 @@ service PredictionService { }; } + // Perform a streaming online prediction request through gRPC. + rpc StreamingRawPredict(stream StreamingRawPredictRequest) + returns (stream StreamingRawPredictResponse) {} + // Perform an online explanation. // // If @@ -226,6 +253,69 @@ message RawPredictRequest { google.api.HttpBody http_body = 2; } +// Request message for +// [PredictionService.DirectPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectPredict]. +message DirectPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // The prediction input. + repeated Tensor inputs = 2; + + // The parameters that govern the prediction. + Tensor parameters = 3; +} + +// Response message for +// [PredictionService.DirectPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectPredict]. +message DirectPredictResponse { + // The prediction output. + repeated Tensor outputs = 1; + + // The parameters that govern the prediction. + Tensor parameters = 2; +} + +// Request message for +// [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredict]. +message DirectRawPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // Fully qualified name of the API method being invoked to perform + // predictions. + // + // Format: + // `/namespace.Service/Method/` + // Example: + // `/tensorflow.serving.PredictionService/Predict` + string method_name = 2; + + // The prediction input. + bytes input = 3; +} + +// Response message for +// [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredict]. +message DirectRawPredictResponse { + // The prediction output. + bytes output = 1; +} + // Request message for // [PredictionService.StreamingPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict]. // @@ -261,6 +351,50 @@ message StreamingPredictResponse { Tensor parameters = 2; } +// Request message for +// [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingRawPredict]. +// +// The first message must contain +// [endpoint][google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.endpoint] +// and +// [method_name][google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.method_name] +// fields and optionally +// [input][google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.input]. +// The subsequent messages must contain +// [input][google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.input]. +// [method_name][google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.method_name] +// in the subsequent messages have no effect. +message StreamingRawPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // Fully qualified name of the API method being invoked to perform + // predictions. + // + // Format: + // `/namespace.Service/Method/` + // Example: + // `/tensorflow.serving.PredictionService/Predict` + string method_name = 2; + + // The prediction input. + bytes input = 3; +} + +// Response message for +// [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingRawPredict]. +message StreamingRawPredictResponse { + // The prediction output. + bytes output = 1; +} + // Request message for // [PredictionService.Explain][google.cloud.aiplatform.v1beta1.PredictionService.Explain]. message ExplainRequest { diff --git a/packages/google-cloud-aiplatform/protos/protos.d.ts b/packages/google-cloud-aiplatform/protos/protos.d.ts index 0c863468355..8e4a669bbce 100644 --- a/packages/google-cloud-aiplatform/protos/protos.d.ts +++ b/packages/google-cloud-aiplatform/protos/protos.d.ts @@ -7262,6 +7262,9 @@ export namespace google { /** ModelContainerSpec healthRoute */ healthRoute?: (string|null); + /** ModelContainerSpec grpcPorts */ + grpcPorts?: (google.cloud.aiplatform.v1.IPort[]|null); + /** ModelContainerSpec deploymentTimeout */ deploymentTimeout?: (google.protobuf.IDuration|null); @@ -7305,6 +7308,9 @@ export namespace google { /** ModelContainerSpec healthRoute. */ public healthRoute: string; + /** ModelContainerSpec grpcPorts. */ + public grpcPorts: google.cloud.aiplatform.v1.IPort[]; + /** ModelContainerSpec deploymentTimeout. */ public deploymentTimeout?: (google.protobuf.IDuration|null); @@ -50171,6 +50177,48 @@ export namespace google { */ public rawPredict(request: google.cloud.aiplatform.v1.IRawPredictRequest): Promise; + /** + * Calls DirectPredict. + * @param request DirectPredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DirectPredictResponse + */ + public directPredict(request: google.cloud.aiplatform.v1.IDirectPredictRequest, callback: google.cloud.aiplatform.v1.PredictionService.DirectPredictCallback): void; + + /** + * Calls DirectPredict. + * @param request DirectPredictRequest message or plain object + * @returns Promise + */ + public directPredict(request: google.cloud.aiplatform.v1.IDirectPredictRequest): Promise; + + /** + * Calls DirectRawPredict. + * @param request DirectRawPredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DirectRawPredictResponse + */ + public directRawPredict(request: google.cloud.aiplatform.v1.IDirectRawPredictRequest, callback: google.cloud.aiplatform.v1.PredictionService.DirectRawPredictCallback): void; + + /** + * Calls DirectRawPredict. + * @param request DirectRawPredictRequest message or plain object + * @returns Promise + */ + public directRawPredict(request: google.cloud.aiplatform.v1.IDirectRawPredictRequest): Promise; + + /** + * Calls StreamingPredict. + * @param request StreamingPredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingPredictResponse + */ + public streamingPredict(request: google.cloud.aiplatform.v1.IStreamingPredictRequest, callback: google.cloud.aiplatform.v1.PredictionService.StreamingPredictCallback): void; + + /** + * Calls StreamingPredict. + * @param request StreamingPredictRequest message or plain object + * @returns Promise + */ + public streamingPredict(request: google.cloud.aiplatform.v1.IStreamingPredictRequest): Promise; + /** * Calls ServerStreamingPredict. * @param request StreamingPredictRequest message or plain object @@ -50185,6 +50233,20 @@ export namespace google { */ public serverStreamingPredict(request: google.cloud.aiplatform.v1.IStreamingPredictRequest): Promise; + /** + * Calls StreamingRawPredict. + * @param request StreamingRawPredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingRawPredictResponse + */ + public streamingRawPredict(request: google.cloud.aiplatform.v1.IStreamingRawPredictRequest, callback: google.cloud.aiplatform.v1.PredictionService.StreamingRawPredictCallback): void; + + /** + * Calls StreamingRawPredict. + * @param request StreamingRawPredictRequest message or plain object + * @returns Promise + */ + public streamingRawPredict(request: google.cloud.aiplatform.v1.IStreamingRawPredictRequest): Promise; + /** * Calls Explain. * @param request ExplainRequest message or plain object @@ -50216,6 +50278,27 @@ export namespace google { */ type RawPredictCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + /** + * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|directPredict}. + * @param error Error, if any + * @param [response] DirectPredictResponse + */ + type DirectPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1.DirectPredictResponse) => void; + + /** + * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|directRawPredict}. + * @param error Error, if any + * @param [response] DirectRawPredictResponse + */ + type DirectRawPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1.DirectRawPredictResponse) => void; + + /** + * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|streamingPredict}. + * @param error Error, if any + * @param [response] StreamingPredictResponse + */ + type StreamingPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1.StreamingPredictResponse) => void; + /** * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|serverStreamingPredict}. * @param error Error, if any @@ -50223,6 +50306,13 @@ export namespace google { */ type ServerStreamingPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1.StreamingPredictResponse) => void; + /** + * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|streamingRawPredict}. + * @param error Error, if any + * @param [response] StreamingRawPredictResponse + */ + type StreamingRawPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1.StreamingRawPredictResponse) => void; + /** * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|explain}. * @param error Error, if any @@ -50570,6 +50660,424 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a DirectPredictRequest. */ + interface IDirectPredictRequest { + + /** DirectPredictRequest endpoint */ + endpoint?: (string|null); + + /** DirectPredictRequest inputs */ + inputs?: (google.cloud.aiplatform.v1.ITensor[]|null); + + /** DirectPredictRequest parameters */ + parameters?: (google.cloud.aiplatform.v1.ITensor|null); + } + + /** Represents a DirectPredictRequest. */ + class DirectPredictRequest implements IDirectPredictRequest { + + /** + * Constructs a new DirectPredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1.IDirectPredictRequest); + + /** DirectPredictRequest endpoint. */ + public endpoint: string; + + /** DirectPredictRequest inputs. */ + public inputs: google.cloud.aiplatform.v1.ITensor[]; + + /** DirectPredictRequest parameters. */ + public parameters?: (google.cloud.aiplatform.v1.ITensor|null); + + /** + * Creates a new DirectPredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectPredictRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1.IDirectPredictRequest): google.cloud.aiplatform.v1.DirectPredictRequest; + + /** + * Encodes the specified DirectPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1.DirectPredictRequest.verify|verify} messages. + * @param message DirectPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1.IDirectPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DirectPredictRequest.verify|verify} messages. + * @param message DirectPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1.IDirectPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectPredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.DirectPredictRequest; + + /** + * Decodes a DirectPredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.DirectPredictRequest; + + /** + * Verifies a DirectPredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectPredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectPredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.DirectPredictRequest; + + /** + * Creates a plain object from a DirectPredictRequest message. Also converts values to other types if specified. + * @param message DirectPredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1.DirectPredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectPredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectPredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DirectPredictResponse. */ + interface IDirectPredictResponse { + + /** DirectPredictResponse outputs */ + outputs?: (google.cloud.aiplatform.v1.ITensor[]|null); + + /** DirectPredictResponse parameters */ + parameters?: (google.cloud.aiplatform.v1.ITensor|null); + } + + /** Represents a DirectPredictResponse. */ + class DirectPredictResponse implements IDirectPredictResponse { + + /** + * Constructs a new DirectPredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1.IDirectPredictResponse); + + /** DirectPredictResponse outputs. */ + public outputs: google.cloud.aiplatform.v1.ITensor[]; + + /** DirectPredictResponse parameters. */ + public parameters?: (google.cloud.aiplatform.v1.ITensor|null); + + /** + * Creates a new DirectPredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectPredictResponse instance + */ + public static create(properties?: google.cloud.aiplatform.v1.IDirectPredictResponse): google.cloud.aiplatform.v1.DirectPredictResponse; + + /** + * Encodes the specified DirectPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1.DirectPredictResponse.verify|verify} messages. + * @param message DirectPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1.IDirectPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DirectPredictResponse.verify|verify} messages. + * @param message DirectPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1.IDirectPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectPredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.DirectPredictResponse; + + /** + * Decodes a DirectPredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.DirectPredictResponse; + + /** + * Verifies a DirectPredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectPredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectPredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.DirectPredictResponse; + + /** + * Creates a plain object from a DirectPredictResponse message. Also converts values to other types if specified. + * @param message DirectPredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1.DirectPredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectPredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectPredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DirectRawPredictRequest. */ + interface IDirectRawPredictRequest { + + /** DirectRawPredictRequest endpoint */ + endpoint?: (string|null); + + /** DirectRawPredictRequest methodName */ + methodName?: (string|null); + + /** DirectRawPredictRequest input */ + input?: (Uint8Array|string|null); + } + + /** Represents a DirectRawPredictRequest. */ + class DirectRawPredictRequest implements IDirectRawPredictRequest { + + /** + * Constructs a new DirectRawPredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1.IDirectRawPredictRequest); + + /** DirectRawPredictRequest endpoint. */ + public endpoint: string; + + /** DirectRawPredictRequest methodName. */ + public methodName: string; + + /** DirectRawPredictRequest input. */ + public input: (Uint8Array|string); + + /** + * Creates a new DirectRawPredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectRawPredictRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1.IDirectRawPredictRequest): google.cloud.aiplatform.v1.DirectRawPredictRequest; + + /** + * Encodes the specified DirectRawPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1.DirectRawPredictRequest.verify|verify} messages. + * @param message DirectRawPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1.IDirectRawPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectRawPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DirectRawPredictRequest.verify|verify} messages. + * @param message DirectRawPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1.IDirectRawPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectRawPredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.DirectRawPredictRequest; + + /** + * Decodes a DirectRawPredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.DirectRawPredictRequest; + + /** + * Verifies a DirectRawPredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectRawPredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectRawPredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.DirectRawPredictRequest; + + /** + * Creates a plain object from a DirectRawPredictRequest message. Also converts values to other types if specified. + * @param message DirectRawPredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1.DirectRawPredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectRawPredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectRawPredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DirectRawPredictResponse. */ + interface IDirectRawPredictResponse { + + /** DirectRawPredictResponse output */ + output?: (Uint8Array|string|null); + } + + /** Represents a DirectRawPredictResponse. */ + class DirectRawPredictResponse implements IDirectRawPredictResponse { + + /** + * Constructs a new DirectRawPredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1.IDirectRawPredictResponse); + + /** DirectRawPredictResponse output. */ + public output: (Uint8Array|string); + + /** + * Creates a new DirectRawPredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectRawPredictResponse instance + */ + public static create(properties?: google.cloud.aiplatform.v1.IDirectRawPredictResponse): google.cloud.aiplatform.v1.DirectRawPredictResponse; + + /** + * Encodes the specified DirectRawPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1.DirectRawPredictResponse.verify|verify} messages. + * @param message DirectRawPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1.IDirectRawPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectRawPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DirectRawPredictResponse.verify|verify} messages. + * @param message DirectRawPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1.IDirectRawPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectRawPredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.DirectRawPredictResponse; + + /** + * Decodes a DirectRawPredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.DirectRawPredictResponse; + + /** + * Verifies a DirectRawPredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectRawPredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectRawPredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.DirectRawPredictResponse; + + /** + * Creates a plain object from a DirectRawPredictResponse message. Also converts values to other types if specified. + * @param message DirectRawPredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1.DirectRawPredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectRawPredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectRawPredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a StreamingPredictRequest. */ interface IStreamingPredictRequest { @@ -50782,6 +51290,212 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a StreamingRawPredictRequest. */ + interface IStreamingRawPredictRequest { + + /** StreamingRawPredictRequest endpoint */ + endpoint?: (string|null); + + /** StreamingRawPredictRequest methodName */ + methodName?: (string|null); + + /** StreamingRawPredictRequest input */ + input?: (Uint8Array|string|null); + } + + /** Represents a StreamingRawPredictRequest. */ + class StreamingRawPredictRequest implements IStreamingRawPredictRequest { + + /** + * Constructs a new StreamingRawPredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1.IStreamingRawPredictRequest); + + /** StreamingRawPredictRequest endpoint. */ + public endpoint: string; + + /** StreamingRawPredictRequest methodName. */ + public methodName: string; + + /** StreamingRawPredictRequest input. */ + public input: (Uint8Array|string); + + /** + * Creates a new StreamingRawPredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingRawPredictRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1.IStreamingRawPredictRequest): google.cloud.aiplatform.v1.StreamingRawPredictRequest; + + /** + * Encodes the specified StreamingRawPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1.StreamingRawPredictRequest.verify|verify} messages. + * @param message StreamingRawPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1.IStreamingRawPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingRawPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.StreamingRawPredictRequest.verify|verify} messages. + * @param message StreamingRawPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1.IStreamingRawPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingRawPredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.StreamingRawPredictRequest; + + /** + * Decodes a StreamingRawPredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.StreamingRawPredictRequest; + + /** + * Verifies a StreamingRawPredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingRawPredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingRawPredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.StreamingRawPredictRequest; + + /** + * Creates a plain object from a StreamingRawPredictRequest message. Also converts values to other types if specified. + * @param message StreamingRawPredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1.StreamingRawPredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingRawPredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingRawPredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingRawPredictResponse. */ + interface IStreamingRawPredictResponse { + + /** StreamingRawPredictResponse output */ + output?: (Uint8Array|string|null); + } + + /** Represents a StreamingRawPredictResponse. */ + class StreamingRawPredictResponse implements IStreamingRawPredictResponse { + + /** + * Constructs a new StreamingRawPredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1.IStreamingRawPredictResponse); + + /** StreamingRawPredictResponse output. */ + public output: (Uint8Array|string); + + /** + * Creates a new StreamingRawPredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingRawPredictResponse instance + */ + public static create(properties?: google.cloud.aiplatform.v1.IStreamingRawPredictResponse): google.cloud.aiplatform.v1.StreamingRawPredictResponse; + + /** + * Encodes the specified StreamingRawPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1.StreamingRawPredictResponse.verify|verify} messages. + * @param message StreamingRawPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1.IStreamingRawPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingRawPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.StreamingRawPredictResponse.verify|verify} messages. + * @param message StreamingRawPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1.IStreamingRawPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingRawPredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.StreamingRawPredictResponse; + + /** + * Decodes a StreamingRawPredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.StreamingRawPredictResponse; + + /** + * Verifies a StreamingRawPredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingRawPredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingRawPredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.StreamingRawPredictResponse; + + /** + * Creates a plain object from a StreamingRawPredictResponse message. Also converts values to other types if specified. + * @param message StreamingRawPredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1.StreamingRawPredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingRawPredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingRawPredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of an ExplainRequest. */ interface IExplainRequest { @@ -98167,6 +98881,9 @@ export namespace google { /** ModelContainerSpec healthRoute */ healthRoute?: (string|null); + /** ModelContainerSpec grpcPorts */ + grpcPorts?: (google.cloud.aiplatform.v1beta1.IPort[]|null); + /** ModelContainerSpec deploymentTimeout */ deploymentTimeout?: (google.protobuf.IDuration|null); @@ -98210,6 +98927,9 @@ export namespace google { /** ModelContainerSpec healthRoute. */ public healthRoute: string; + /** ModelContainerSpec grpcPorts. */ + public grpcPorts: google.cloud.aiplatform.v1beta1.IPort[]; + /** ModelContainerSpec deploymentTimeout. */ public deploymentTimeout?: (google.protobuf.IDuration|null); @@ -163146,6 +163866,48 @@ export namespace google { */ public rawPredict(request: google.cloud.aiplatform.v1beta1.IRawPredictRequest): Promise; + /** + * Calls DirectPredict. + * @param request DirectPredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DirectPredictResponse + */ + public directPredict(request: google.cloud.aiplatform.v1beta1.IDirectPredictRequest, callback: google.cloud.aiplatform.v1beta1.PredictionService.DirectPredictCallback): void; + + /** + * Calls DirectPredict. + * @param request DirectPredictRequest message or plain object + * @returns Promise + */ + public directPredict(request: google.cloud.aiplatform.v1beta1.IDirectPredictRequest): Promise; + + /** + * Calls DirectRawPredict. + * @param request DirectRawPredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DirectRawPredictResponse + */ + public directRawPredict(request: google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest, callback: google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredictCallback): void; + + /** + * Calls DirectRawPredict. + * @param request DirectRawPredictRequest message or plain object + * @returns Promise + */ + public directRawPredict(request: google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest): Promise; + + /** + * Calls StreamingPredict. + * @param request StreamingPredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingPredictResponse + */ + public streamingPredict(request: google.cloud.aiplatform.v1beta1.IStreamingPredictRequest, callback: google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredictCallback): void; + + /** + * Calls StreamingPredict. + * @param request StreamingPredictRequest message or plain object + * @returns Promise + */ + public streamingPredict(request: google.cloud.aiplatform.v1beta1.IStreamingPredictRequest): Promise; + /** * Calls ServerStreamingPredict. * @param request StreamingPredictRequest message or plain object @@ -163160,6 +163922,20 @@ export namespace google { */ public serverStreamingPredict(request: google.cloud.aiplatform.v1beta1.IStreamingPredictRequest): Promise; + /** + * Calls StreamingRawPredict. + * @param request StreamingRawPredictRequest message or plain object + * @param callback Node-style callback called with the error, if any, and StreamingRawPredictResponse + */ + public streamingRawPredict(request: google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest, callback: google.cloud.aiplatform.v1beta1.PredictionService.StreamingRawPredictCallback): void; + + /** + * Calls StreamingRawPredict. + * @param request StreamingRawPredictRequest message or plain object + * @returns Promise + */ + public streamingRawPredict(request: google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest): Promise; + /** * Calls Explain. * @param request ExplainRequest message or plain object @@ -163205,6 +163981,27 @@ export namespace google { */ type RawPredictCallback = (error: (Error|null), response?: google.api.HttpBody) => void; + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|directPredict}. + * @param error Error, if any + * @param [response] DirectPredictResponse + */ + type DirectPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1beta1.DirectPredictResponse) => void; + + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|directRawPredict}. + * @param error Error, if any + * @param [response] DirectRawPredictResponse + */ + type DirectRawPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) => void; + + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|streamingPredict}. + * @param error Error, if any + * @param [response] StreamingPredictResponse + */ + type StreamingPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1beta1.StreamingPredictResponse) => void; + /** * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|serverStreamingPredict}. * @param error Error, if any @@ -163212,6 +164009,13 @@ export namespace google { */ type ServerStreamingPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1beta1.StreamingPredictResponse) => void; + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|streamingRawPredict}. + * @param error Error, if any + * @param [response] StreamingRawPredictResponse + */ + type StreamingRawPredictCallback = (error: (Error|null), response?: google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) => void; + /** * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|explain}. * @param error Error, if any @@ -163566,6 +164370,424 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a DirectPredictRequest. */ + interface IDirectPredictRequest { + + /** DirectPredictRequest endpoint */ + endpoint?: (string|null); + + /** DirectPredictRequest inputs */ + inputs?: (google.cloud.aiplatform.v1beta1.ITensor[]|null); + + /** DirectPredictRequest parameters */ + parameters?: (google.cloud.aiplatform.v1beta1.ITensor|null); + } + + /** Represents a DirectPredictRequest. */ + class DirectPredictRequest implements IDirectPredictRequest { + + /** + * Constructs a new DirectPredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IDirectPredictRequest); + + /** DirectPredictRequest endpoint. */ + public endpoint: string; + + /** DirectPredictRequest inputs. */ + public inputs: google.cloud.aiplatform.v1beta1.ITensor[]; + + /** DirectPredictRequest parameters. */ + public parameters?: (google.cloud.aiplatform.v1beta1.ITensor|null); + + /** + * Creates a new DirectPredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectPredictRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IDirectPredictRequest): google.cloud.aiplatform.v1beta1.DirectPredictRequest; + + /** + * Encodes the specified DirectPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectPredictRequest.verify|verify} messages. + * @param message DirectPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IDirectPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectPredictRequest.verify|verify} messages. + * @param message DirectPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IDirectPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectPredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1beta1.DirectPredictRequest; + + /** + * Decodes a DirectPredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1beta1.DirectPredictRequest; + + /** + * Verifies a DirectPredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectPredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectPredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.DirectPredictRequest; + + /** + * Creates a plain object from a DirectPredictRequest message. Also converts values to other types if specified. + * @param message DirectPredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.DirectPredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectPredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectPredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DirectPredictResponse. */ + interface IDirectPredictResponse { + + /** DirectPredictResponse outputs */ + outputs?: (google.cloud.aiplatform.v1beta1.ITensor[]|null); + + /** DirectPredictResponse parameters */ + parameters?: (google.cloud.aiplatform.v1beta1.ITensor|null); + } + + /** Represents a DirectPredictResponse. */ + class DirectPredictResponse implements IDirectPredictResponse { + + /** + * Constructs a new DirectPredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IDirectPredictResponse); + + /** DirectPredictResponse outputs. */ + public outputs: google.cloud.aiplatform.v1beta1.ITensor[]; + + /** DirectPredictResponse parameters. */ + public parameters?: (google.cloud.aiplatform.v1beta1.ITensor|null); + + /** + * Creates a new DirectPredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectPredictResponse instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IDirectPredictResponse): google.cloud.aiplatform.v1beta1.DirectPredictResponse; + + /** + * Encodes the specified DirectPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectPredictResponse.verify|verify} messages. + * @param message DirectPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IDirectPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectPredictResponse.verify|verify} messages. + * @param message DirectPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IDirectPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectPredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1beta1.DirectPredictResponse; + + /** + * Decodes a DirectPredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1beta1.DirectPredictResponse; + + /** + * Verifies a DirectPredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectPredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectPredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.DirectPredictResponse; + + /** + * Creates a plain object from a DirectPredictResponse message. Also converts values to other types if specified. + * @param message DirectPredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.DirectPredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectPredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectPredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DirectRawPredictRequest. */ + interface IDirectRawPredictRequest { + + /** DirectRawPredictRequest endpoint */ + endpoint?: (string|null); + + /** DirectRawPredictRequest methodName */ + methodName?: (string|null); + + /** DirectRawPredictRequest input */ + input?: (Uint8Array|string|null); + } + + /** Represents a DirectRawPredictRequest. */ + class DirectRawPredictRequest implements IDirectRawPredictRequest { + + /** + * Constructs a new DirectRawPredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest); + + /** DirectRawPredictRequest endpoint. */ + public endpoint: string; + + /** DirectRawPredictRequest methodName. */ + public methodName: string; + + /** DirectRawPredictRequest input. */ + public input: (Uint8Array|string); + + /** + * Creates a new DirectRawPredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectRawPredictRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest): google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; + + /** + * Encodes the specified DirectRawPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.verify|verify} messages. + * @param message DirectRawPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectRawPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.verify|verify} messages. + * @param message DirectRawPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectRawPredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; + + /** + * Decodes a DirectRawPredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; + + /** + * Verifies a DirectRawPredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectRawPredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectRawPredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; + + /** + * Creates a plain object from a DirectRawPredictRequest message. Also converts values to other types if specified. + * @param message DirectRawPredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.DirectRawPredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectRawPredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectRawPredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DirectRawPredictResponse. */ + interface IDirectRawPredictResponse { + + /** DirectRawPredictResponse output */ + output?: (Uint8Array|string|null); + } + + /** Represents a DirectRawPredictResponse. */ + class DirectRawPredictResponse implements IDirectRawPredictResponse { + + /** + * Constructs a new DirectRawPredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse); + + /** DirectRawPredictResponse output. */ + public output: (Uint8Array|string); + + /** + * Creates a new DirectRawPredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DirectRawPredictResponse instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse): google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; + + /** + * Encodes the specified DirectRawPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.verify|verify} messages. + * @param message DirectRawPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DirectRawPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.verify|verify} messages. + * @param message DirectRawPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DirectRawPredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DirectRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; + + /** + * Decodes a DirectRawPredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DirectRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; + + /** + * Verifies a DirectRawPredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DirectRawPredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DirectRawPredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; + + /** + * Creates a plain object from a DirectRawPredictResponse message. Also converts values to other types if specified. + * @param message DirectRawPredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.DirectRawPredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DirectRawPredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DirectRawPredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of a StreamingPredictRequest. */ interface IStreamingPredictRequest { @@ -163778,6 +165000,212 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of a StreamingRawPredictRequest. */ + interface IStreamingRawPredictRequest { + + /** StreamingRawPredictRequest endpoint */ + endpoint?: (string|null); + + /** StreamingRawPredictRequest methodName */ + methodName?: (string|null); + + /** StreamingRawPredictRequest input */ + input?: (Uint8Array|string|null); + } + + /** Represents a StreamingRawPredictRequest. */ + class StreamingRawPredictRequest implements IStreamingRawPredictRequest { + + /** + * Constructs a new StreamingRawPredictRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest); + + /** StreamingRawPredictRequest endpoint. */ + public endpoint: string; + + /** StreamingRawPredictRequest methodName. */ + public methodName: string; + + /** StreamingRawPredictRequest input. */ + public input: (Uint8Array|string); + + /** + * Creates a new StreamingRawPredictRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingRawPredictRequest instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest): google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest; + + /** + * Encodes the specified StreamingRawPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.verify|verify} messages. + * @param message StreamingRawPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingRawPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.verify|verify} messages. + * @param message StreamingRawPredictRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingRawPredictRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest; + + /** + * Decodes a StreamingRawPredictRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest; + + /** + * Verifies a StreamingRawPredictRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingRawPredictRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingRawPredictRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest; + + /** + * Creates a plain object from a StreamingRawPredictRequest message. Also converts values to other types if specified. + * @param message StreamingRawPredictRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingRawPredictRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingRawPredictRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StreamingRawPredictResponse. */ + interface IStreamingRawPredictResponse { + + /** StreamingRawPredictResponse output */ + output?: (Uint8Array|string|null); + } + + /** Represents a StreamingRawPredictResponse. */ + class StreamingRawPredictResponse implements IStreamingRawPredictResponse { + + /** + * Constructs a new StreamingRawPredictResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.aiplatform.v1beta1.IStreamingRawPredictResponse); + + /** StreamingRawPredictResponse output. */ + public output: (Uint8Array|string); + + /** + * Creates a new StreamingRawPredictResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns StreamingRawPredictResponse instance + */ + public static create(properties?: google.cloud.aiplatform.v1beta1.IStreamingRawPredictResponse): google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse; + + /** + * Encodes the specified StreamingRawPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.verify|verify} messages. + * @param message StreamingRawPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.aiplatform.v1beta1.IStreamingRawPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StreamingRawPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.verify|verify} messages. + * @param message StreamingRawPredictResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.aiplatform.v1beta1.IStreamingRawPredictResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StreamingRawPredictResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StreamingRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse; + + /** + * Decodes a StreamingRawPredictResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StreamingRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse; + + /** + * Verifies a StreamingRawPredictResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StreamingRawPredictResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StreamingRawPredictResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse; + + /** + * Creates a plain object from a StreamingRawPredictResponse message. Also converts values to other types if specified. + * @param message StreamingRawPredictResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StreamingRawPredictResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StreamingRawPredictResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of an ExplainRequest. */ interface IExplainRequest { diff --git a/packages/google-cloud-aiplatform/protos/protos.js b/packages/google-cloud-aiplatform/protos/protos.js index 64484430144..cc1cf300e57 100644 --- a/packages/google-cloud-aiplatform/protos/protos.js +++ b/packages/google-cloud-aiplatform/protos/protos.js @@ -18742,6 +18742,7 @@ * @property {Array.|null} [ports] ModelContainerSpec ports * @property {string|null} [predictRoute] ModelContainerSpec predictRoute * @property {string|null} [healthRoute] ModelContainerSpec healthRoute + * @property {Array.|null} [grpcPorts] ModelContainerSpec grpcPorts * @property {google.protobuf.IDuration|null} [deploymentTimeout] ModelContainerSpec deploymentTimeout * @property {number|Long|null} [sharedMemorySizeMb] ModelContainerSpec sharedMemorySizeMb * @property {google.cloud.aiplatform.v1.IProbe|null} [startupProbe] ModelContainerSpec startupProbe @@ -18761,6 +18762,7 @@ this.args = []; this.env = []; this.ports = []; + this.grpcPorts = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -18823,6 +18825,14 @@ */ ModelContainerSpec.prototype.healthRoute = ""; + /** + * ModelContainerSpec grpcPorts. + * @member {Array.} grpcPorts + * @memberof google.cloud.aiplatform.v1.ModelContainerSpec + * @instance + */ + ModelContainerSpec.prototype.grpcPorts = $util.emptyArray; + /** * ModelContainerSpec deploymentTimeout. * @member {google.protobuf.IDuration|null|undefined} deploymentTimeout @@ -18897,6 +18907,9 @@ writer.uint32(/* id 6, wireType 2 =*/50).string(message.predictRoute); if (message.healthRoute != null && Object.hasOwnProperty.call(message, "healthRoute")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.healthRoute); + if (message.grpcPorts != null && message.grpcPorts.length) + for (var i = 0; i < message.grpcPorts.length; ++i) + $root.google.cloud.aiplatform.v1.Port.encode(message.grpcPorts[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); if (message.deploymentTimeout != null && Object.hasOwnProperty.call(message, "deploymentTimeout")) $root.google.protobuf.Duration.encode(message.deploymentTimeout, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); if (message.sharedMemorySizeMb != null && Object.hasOwnProperty.call(message, "sharedMemorySizeMb")) @@ -18975,6 +18988,12 @@ message.healthRoute = reader.string(); break; } + case 9: { + if (!(message.grpcPorts && message.grpcPorts.length)) + message.grpcPorts = []; + message.grpcPorts.push($root.google.cloud.aiplatform.v1.Port.decode(reader, reader.uint32())); + break; + } case 10: { message.deploymentTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); break; @@ -19067,6 +19086,15 @@ if (message.healthRoute != null && message.hasOwnProperty("healthRoute")) if (!$util.isString(message.healthRoute)) return "healthRoute: string expected"; + if (message.grpcPorts != null && message.hasOwnProperty("grpcPorts")) { + if (!Array.isArray(message.grpcPorts)) + return "grpcPorts: array expected"; + for (var i = 0; i < message.grpcPorts.length; ++i) { + var error = $root.google.cloud.aiplatform.v1.Port.verify(message.grpcPorts[i]); + if (error) + return "grpcPorts." + error; + } + } if (message.deploymentTimeout != null && message.hasOwnProperty("deploymentTimeout")) { var error = $root.google.protobuf.Duration.verify(message.deploymentTimeout); if (error) @@ -19140,6 +19168,16 @@ message.predictRoute = String(object.predictRoute); if (object.healthRoute != null) message.healthRoute = String(object.healthRoute); + if (object.grpcPorts) { + if (!Array.isArray(object.grpcPorts)) + throw TypeError(".google.cloud.aiplatform.v1.ModelContainerSpec.grpcPorts: array expected"); + message.grpcPorts = []; + for (var i = 0; i < object.grpcPorts.length; ++i) { + if (typeof object.grpcPorts[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1.ModelContainerSpec.grpcPorts: object expected"); + message.grpcPorts[i] = $root.google.cloud.aiplatform.v1.Port.fromObject(object.grpcPorts[i]); + } + } if (object.deploymentTimeout != null) { if (typeof object.deploymentTimeout !== "object") throw TypeError(".google.cloud.aiplatform.v1.ModelContainerSpec.deploymentTimeout: object expected"); @@ -19185,6 +19223,7 @@ object.args = []; object.env = []; object.ports = []; + object.grpcPorts = []; } if (options.defaults) { object.imageUri = ""; @@ -19225,6 +19264,11 @@ object.predictRoute = message.predictRoute; if (message.healthRoute != null && message.hasOwnProperty("healthRoute")) object.healthRoute = message.healthRoute; + if (message.grpcPorts && message.grpcPorts.length) { + object.grpcPorts = []; + for (var j = 0; j < message.grpcPorts.length; ++j) + object.grpcPorts[j] = $root.google.cloud.aiplatform.v1.Port.toObject(message.grpcPorts[j], options); + } if (message.deploymentTimeout != null && message.hasOwnProperty("deploymentTimeout")) object.deploymentTimeout = $root.google.protobuf.Duration.toObject(message.deploymentTimeout, options); if (message.sharedMemorySizeMb != null && message.hasOwnProperty("sharedMemorySizeMb")) @@ -123167,6 +123211,105 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|directPredict}. + * @memberof google.cloud.aiplatform.v1.PredictionService + * @typedef DirectPredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1.DirectPredictResponse} [response] DirectPredictResponse + */ + + /** + * Calls DirectPredict. + * @function directPredict + * @memberof google.cloud.aiplatform.v1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1.IDirectPredictRequest} request DirectPredictRequest message or plain object + * @param {google.cloud.aiplatform.v1.PredictionService.DirectPredictCallback} callback Node-style callback called with the error, if any, and DirectPredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.directPredict = function directPredict(request, callback) { + return this.rpcCall(directPredict, $root.google.cloud.aiplatform.v1.DirectPredictRequest, $root.google.cloud.aiplatform.v1.DirectPredictResponse, request, callback); + }, "name", { value: "DirectPredict" }); + + /** + * Calls DirectPredict. + * @function directPredict + * @memberof google.cloud.aiplatform.v1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1.IDirectPredictRequest} request DirectPredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|directRawPredict}. + * @memberof google.cloud.aiplatform.v1.PredictionService + * @typedef DirectRawPredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1.DirectRawPredictResponse} [response] DirectRawPredictResponse + */ + + /** + * Calls DirectRawPredict. + * @function directRawPredict + * @memberof google.cloud.aiplatform.v1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1.IDirectRawPredictRequest} request DirectRawPredictRequest message or plain object + * @param {google.cloud.aiplatform.v1.PredictionService.DirectRawPredictCallback} callback Node-style callback called with the error, if any, and DirectRawPredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.directRawPredict = function directRawPredict(request, callback) { + return this.rpcCall(directRawPredict, $root.google.cloud.aiplatform.v1.DirectRawPredictRequest, $root.google.cloud.aiplatform.v1.DirectRawPredictResponse, request, callback); + }, "name", { value: "DirectRawPredict" }); + + /** + * Calls DirectRawPredict. + * @function directRawPredict + * @memberof google.cloud.aiplatform.v1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1.IDirectRawPredictRequest} request DirectRawPredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|streamingPredict}. + * @memberof google.cloud.aiplatform.v1.PredictionService + * @typedef StreamingPredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1.StreamingPredictResponse} [response] StreamingPredictResponse + */ + + /** + * Calls StreamingPredict. + * @function streamingPredict + * @memberof google.cloud.aiplatform.v1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1.IStreamingPredictRequest} request StreamingPredictRequest message or plain object + * @param {google.cloud.aiplatform.v1.PredictionService.StreamingPredictCallback} callback Node-style callback called with the error, if any, and StreamingPredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.streamingPredict = function streamingPredict(request, callback) { + return this.rpcCall(streamingPredict, $root.google.cloud.aiplatform.v1.StreamingPredictRequest, $root.google.cloud.aiplatform.v1.StreamingPredictResponse, request, callback); + }, "name", { value: "StreamingPredict" }); + + /** + * Calls StreamingPredict. + * @function streamingPredict + * @memberof google.cloud.aiplatform.v1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1.IStreamingPredictRequest} request StreamingPredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|serverStreamingPredict}. * @memberof google.cloud.aiplatform.v1.PredictionService @@ -123200,6 +123343,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|streamingRawPredict}. + * @memberof google.cloud.aiplatform.v1.PredictionService + * @typedef StreamingRawPredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1.StreamingRawPredictResponse} [response] StreamingRawPredictResponse + */ + + /** + * Calls StreamingRawPredict. + * @function streamingRawPredict + * @memberof google.cloud.aiplatform.v1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictRequest} request StreamingRawPredictRequest message or plain object + * @param {google.cloud.aiplatform.v1.PredictionService.StreamingRawPredictCallback} callback Node-style callback called with the error, if any, and StreamingRawPredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.streamingRawPredict = function streamingRawPredict(request, callback) { + return this.rpcCall(streamingRawPredict, $root.google.cloud.aiplatform.v1.StreamingRawPredictRequest, $root.google.cloud.aiplatform.v1.StreamingRawPredictResponse, request, callback); + }, "name", { value: "StreamingRawPredict" }); + + /** + * Calls StreamingRawPredict. + * @function streamingRawPredict + * @memberof google.cloud.aiplatform.v1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictRequest} request StreamingRawPredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.aiplatform.v1.PredictionService|explain}. * @memberof google.cloud.aiplatform.v1.PredictionService @@ -124091,6 +124267,1007 @@ return RawPredictRequest; })(); + v1.DirectPredictRequest = (function() { + + /** + * Properties of a DirectPredictRequest. + * @memberof google.cloud.aiplatform.v1 + * @interface IDirectPredictRequest + * @property {string|null} [endpoint] DirectPredictRequest endpoint + * @property {Array.|null} [inputs] DirectPredictRequest inputs + * @property {google.cloud.aiplatform.v1.ITensor|null} [parameters] DirectPredictRequest parameters + */ + + /** + * Constructs a new DirectPredictRequest. + * @memberof google.cloud.aiplatform.v1 + * @classdesc Represents a DirectPredictRequest. + * @implements IDirectPredictRequest + * @constructor + * @param {google.cloud.aiplatform.v1.IDirectPredictRequest=} [properties] Properties to set + */ + function DirectPredictRequest(properties) { + this.inputs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DirectPredictRequest endpoint. + * @member {string} endpoint + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @instance + */ + DirectPredictRequest.prototype.endpoint = ""; + + /** + * DirectPredictRequest inputs. + * @member {Array.} inputs + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @instance + */ + DirectPredictRequest.prototype.inputs = $util.emptyArray; + + /** + * DirectPredictRequest parameters. + * @member {google.cloud.aiplatform.v1.ITensor|null|undefined} parameters + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @instance + */ + DirectPredictRequest.prototype.parameters = null; + + /** + * Creates a new DirectPredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IDirectPredictRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1.DirectPredictRequest} DirectPredictRequest instance + */ + DirectPredictRequest.create = function create(properties) { + return new DirectPredictRequest(properties); + }; + + /** + * Encodes the specified DirectPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1.DirectPredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IDirectPredictRequest} message DirectPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectPredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.endpoint); + if (message.inputs != null && message.inputs.length) + for (var i = 0; i < message.inputs.length; ++i) + $root.google.cloud.aiplatform.v1.Tensor.encode(message.inputs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.cloud.aiplatform.v1.Tensor.encode(message.parameters, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DirectPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DirectPredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IDirectPredictRequest} message DirectPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectPredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DirectPredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1.DirectPredictRequest} DirectPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectPredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1.DirectPredictRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.endpoint = reader.string(); + break; + } + case 2: { + if (!(message.inputs && message.inputs.length)) + message.inputs = []; + message.inputs.push($root.google.cloud.aiplatform.v1.Tensor.decode(reader, reader.uint32())); + break; + } + case 3: { + message.parameters = $root.google.cloud.aiplatform.v1.Tensor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DirectPredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1.DirectPredictRequest} DirectPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectPredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DirectPredictRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DirectPredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (!$util.isString(message.endpoint)) + return "endpoint: string expected"; + if (message.inputs != null && message.hasOwnProperty("inputs")) { + if (!Array.isArray(message.inputs)) + return "inputs: array expected"; + for (var i = 0; i < message.inputs.length; ++i) { + var error = $root.google.cloud.aiplatform.v1.Tensor.verify(message.inputs[i]); + if (error) + return "inputs." + error; + } + } + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.cloud.aiplatform.v1.Tensor.verify(message.parameters); + if (error) + return "parameters." + error; + } + return null; + }; + + /** + * Creates a DirectPredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1.DirectPredictRequest} DirectPredictRequest + */ + DirectPredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1.DirectPredictRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1.DirectPredictRequest(); + if (object.endpoint != null) + message.endpoint = String(object.endpoint); + if (object.inputs) { + if (!Array.isArray(object.inputs)) + throw TypeError(".google.cloud.aiplatform.v1.DirectPredictRequest.inputs: array expected"); + message.inputs = []; + for (var i = 0; i < object.inputs.length; ++i) { + if (typeof object.inputs[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1.DirectPredictRequest.inputs: object expected"); + message.inputs[i] = $root.google.cloud.aiplatform.v1.Tensor.fromObject(object.inputs[i]); + } + } + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.aiplatform.v1.DirectPredictRequest.parameters: object expected"); + message.parameters = $root.google.cloud.aiplatform.v1.Tensor.fromObject(object.parameters); + } + return message; + }; + + /** + * Creates a plain object from a DirectPredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.DirectPredictRequest} message DirectPredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectPredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputs = []; + if (options.defaults) { + object.endpoint = ""; + object.parameters = null; + } + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + object.endpoint = message.endpoint; + if (message.inputs && message.inputs.length) { + object.inputs = []; + for (var j = 0; j < message.inputs.length; ++j) + object.inputs[j] = $root.google.cloud.aiplatform.v1.Tensor.toObject(message.inputs[j], options); + } + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.cloud.aiplatform.v1.Tensor.toObject(message.parameters, options); + return object; + }; + + /** + * Converts this DirectPredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @instance + * @returns {Object.} JSON object + */ + DirectPredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectPredictRequest + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1.DirectPredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectPredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1.DirectPredictRequest"; + }; + + return DirectPredictRequest; + })(); + + v1.DirectPredictResponse = (function() { + + /** + * Properties of a DirectPredictResponse. + * @memberof google.cloud.aiplatform.v1 + * @interface IDirectPredictResponse + * @property {Array.|null} [outputs] DirectPredictResponse outputs + * @property {google.cloud.aiplatform.v1.ITensor|null} [parameters] DirectPredictResponse parameters + */ + + /** + * Constructs a new DirectPredictResponse. + * @memberof google.cloud.aiplatform.v1 + * @classdesc Represents a DirectPredictResponse. + * @implements IDirectPredictResponse + * @constructor + * @param {google.cloud.aiplatform.v1.IDirectPredictResponse=} [properties] Properties to set + */ + function DirectPredictResponse(properties) { + this.outputs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DirectPredictResponse outputs. + * @member {Array.} outputs + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @instance + */ + DirectPredictResponse.prototype.outputs = $util.emptyArray; + + /** + * DirectPredictResponse parameters. + * @member {google.cloud.aiplatform.v1.ITensor|null|undefined} parameters + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @instance + */ + DirectPredictResponse.prototype.parameters = null; + + /** + * Creates a new DirectPredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IDirectPredictResponse=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1.DirectPredictResponse} DirectPredictResponse instance + */ + DirectPredictResponse.create = function create(properties) { + return new DirectPredictResponse(properties); + }; + + /** + * Encodes the specified DirectPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1.DirectPredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IDirectPredictResponse} message DirectPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectPredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.outputs != null && message.outputs.length) + for (var i = 0; i < message.outputs.length; ++i) + $root.google.cloud.aiplatform.v1.Tensor.encode(message.outputs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.cloud.aiplatform.v1.Tensor.encode(message.parameters, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DirectPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DirectPredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IDirectPredictResponse} message DirectPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectPredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DirectPredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1.DirectPredictResponse} DirectPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectPredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1.DirectPredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.outputs && message.outputs.length)) + message.outputs = []; + message.outputs.push($root.google.cloud.aiplatform.v1.Tensor.decode(reader, reader.uint32())); + break; + } + case 2: { + message.parameters = $root.google.cloud.aiplatform.v1.Tensor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DirectPredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1.DirectPredictResponse} DirectPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectPredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DirectPredictResponse message. + * @function verify + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DirectPredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.outputs != null && message.hasOwnProperty("outputs")) { + if (!Array.isArray(message.outputs)) + return "outputs: array expected"; + for (var i = 0; i < message.outputs.length; ++i) { + var error = $root.google.cloud.aiplatform.v1.Tensor.verify(message.outputs[i]); + if (error) + return "outputs." + error; + } + } + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.cloud.aiplatform.v1.Tensor.verify(message.parameters); + if (error) + return "parameters." + error; + } + return null; + }; + + /** + * Creates a DirectPredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1.DirectPredictResponse} DirectPredictResponse + */ + DirectPredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1.DirectPredictResponse) + return object; + var message = new $root.google.cloud.aiplatform.v1.DirectPredictResponse(); + if (object.outputs) { + if (!Array.isArray(object.outputs)) + throw TypeError(".google.cloud.aiplatform.v1.DirectPredictResponse.outputs: array expected"); + message.outputs = []; + for (var i = 0; i < object.outputs.length; ++i) { + if (typeof object.outputs[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1.DirectPredictResponse.outputs: object expected"); + message.outputs[i] = $root.google.cloud.aiplatform.v1.Tensor.fromObject(object.outputs[i]); + } + } + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.aiplatform.v1.DirectPredictResponse.parameters: object expected"); + message.parameters = $root.google.cloud.aiplatform.v1.Tensor.fromObject(object.parameters); + } + return message; + }; + + /** + * Creates a plain object from a DirectPredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.DirectPredictResponse} message DirectPredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectPredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.outputs = []; + if (options.defaults) + object.parameters = null; + if (message.outputs && message.outputs.length) { + object.outputs = []; + for (var j = 0; j < message.outputs.length; ++j) + object.outputs[j] = $root.google.cloud.aiplatform.v1.Tensor.toObject(message.outputs[j], options); + } + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.cloud.aiplatform.v1.Tensor.toObject(message.parameters, options); + return object; + }; + + /** + * Converts this DirectPredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @instance + * @returns {Object.} JSON object + */ + DirectPredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectPredictResponse + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1.DirectPredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectPredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1.DirectPredictResponse"; + }; + + return DirectPredictResponse; + })(); + + v1.DirectRawPredictRequest = (function() { + + /** + * Properties of a DirectRawPredictRequest. + * @memberof google.cloud.aiplatform.v1 + * @interface IDirectRawPredictRequest + * @property {string|null} [endpoint] DirectRawPredictRequest endpoint + * @property {string|null} [methodName] DirectRawPredictRequest methodName + * @property {Uint8Array|null} [input] DirectRawPredictRequest input + */ + + /** + * Constructs a new DirectRawPredictRequest. + * @memberof google.cloud.aiplatform.v1 + * @classdesc Represents a DirectRawPredictRequest. + * @implements IDirectRawPredictRequest + * @constructor + * @param {google.cloud.aiplatform.v1.IDirectRawPredictRequest=} [properties] Properties to set + */ + function DirectRawPredictRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DirectRawPredictRequest endpoint. + * @member {string} endpoint + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @instance + */ + DirectRawPredictRequest.prototype.endpoint = ""; + + /** + * DirectRawPredictRequest methodName. + * @member {string} methodName + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @instance + */ + DirectRawPredictRequest.prototype.methodName = ""; + + /** + * DirectRawPredictRequest input. + * @member {Uint8Array} input + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @instance + */ + DirectRawPredictRequest.prototype.input = $util.newBuffer([]); + + /** + * Creates a new DirectRawPredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IDirectRawPredictRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1.DirectRawPredictRequest} DirectRawPredictRequest instance + */ + DirectRawPredictRequest.create = function create(properties) { + return new DirectRawPredictRequest(properties); + }; + + /** + * Encodes the specified DirectRawPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1.DirectRawPredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IDirectRawPredictRequest} message DirectRawPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectRawPredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.endpoint); + if (message.methodName != null && Object.hasOwnProperty.call(message, "methodName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.methodName); + if (message.input != null && Object.hasOwnProperty.call(message, "input")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.input); + return writer; + }; + + /** + * Encodes the specified DirectRawPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DirectRawPredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IDirectRawPredictRequest} message DirectRawPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectRawPredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DirectRawPredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1.DirectRawPredictRequest} DirectRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectRawPredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1.DirectRawPredictRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.endpoint = reader.string(); + break; + } + case 2: { + message.methodName = reader.string(); + break; + } + case 3: { + message.input = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DirectRawPredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1.DirectRawPredictRequest} DirectRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectRawPredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DirectRawPredictRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DirectRawPredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (!$util.isString(message.endpoint)) + return "endpoint: string expected"; + if (message.methodName != null && message.hasOwnProperty("methodName")) + if (!$util.isString(message.methodName)) + return "methodName: string expected"; + if (message.input != null && message.hasOwnProperty("input")) + if (!(message.input && typeof message.input.length === "number" || $util.isString(message.input))) + return "input: buffer expected"; + return null; + }; + + /** + * Creates a DirectRawPredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1.DirectRawPredictRequest} DirectRawPredictRequest + */ + DirectRawPredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1.DirectRawPredictRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1.DirectRawPredictRequest(); + if (object.endpoint != null) + message.endpoint = String(object.endpoint); + if (object.methodName != null) + message.methodName = String(object.methodName); + if (object.input != null) + if (typeof object.input === "string") + $util.base64.decode(object.input, message.input = $util.newBuffer($util.base64.length(object.input)), 0); + else if (object.input.length >= 0) + message.input = object.input; + return message; + }; + + /** + * Creates a plain object from a DirectRawPredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.DirectRawPredictRequest} message DirectRawPredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectRawPredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.endpoint = ""; + object.methodName = ""; + if (options.bytes === String) + object.input = ""; + else { + object.input = []; + if (options.bytes !== Array) + object.input = $util.newBuffer(object.input); + } + } + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + object.endpoint = message.endpoint; + if (message.methodName != null && message.hasOwnProperty("methodName")) + object.methodName = message.methodName; + if (message.input != null && message.hasOwnProperty("input")) + object.input = options.bytes === String ? $util.base64.encode(message.input, 0, message.input.length) : options.bytes === Array ? Array.prototype.slice.call(message.input) : message.input; + return object; + }; + + /** + * Converts this DirectRawPredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @instance + * @returns {Object.} JSON object + */ + DirectRawPredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectRawPredictRequest + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1.DirectRawPredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectRawPredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1.DirectRawPredictRequest"; + }; + + return DirectRawPredictRequest; + })(); + + v1.DirectRawPredictResponse = (function() { + + /** + * Properties of a DirectRawPredictResponse. + * @memberof google.cloud.aiplatform.v1 + * @interface IDirectRawPredictResponse + * @property {Uint8Array|null} [output] DirectRawPredictResponse output + */ + + /** + * Constructs a new DirectRawPredictResponse. + * @memberof google.cloud.aiplatform.v1 + * @classdesc Represents a DirectRawPredictResponse. + * @implements IDirectRawPredictResponse + * @constructor + * @param {google.cloud.aiplatform.v1.IDirectRawPredictResponse=} [properties] Properties to set + */ + function DirectRawPredictResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DirectRawPredictResponse output. + * @member {Uint8Array} output + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @instance + */ + DirectRawPredictResponse.prototype.output = $util.newBuffer([]); + + /** + * Creates a new DirectRawPredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IDirectRawPredictResponse=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1.DirectRawPredictResponse} DirectRawPredictResponse instance + */ + DirectRawPredictResponse.create = function create(properties) { + return new DirectRawPredictResponse(properties); + }; + + /** + * Encodes the specified DirectRawPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1.DirectRawPredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IDirectRawPredictResponse} message DirectRawPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectRawPredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.output != null && Object.hasOwnProperty.call(message, "output")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.output); + return writer; + }; + + /** + * Encodes the specified DirectRawPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DirectRawPredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IDirectRawPredictResponse} message DirectRawPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectRawPredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DirectRawPredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1.DirectRawPredictResponse} DirectRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectRawPredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1.DirectRawPredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.output = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DirectRawPredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1.DirectRawPredictResponse} DirectRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectRawPredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DirectRawPredictResponse message. + * @function verify + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DirectRawPredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.output != null && message.hasOwnProperty("output")) + if (!(message.output && typeof message.output.length === "number" || $util.isString(message.output))) + return "output: buffer expected"; + return null; + }; + + /** + * Creates a DirectRawPredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1.DirectRawPredictResponse} DirectRawPredictResponse + */ + DirectRawPredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1.DirectRawPredictResponse) + return object; + var message = new $root.google.cloud.aiplatform.v1.DirectRawPredictResponse(); + if (object.output != null) + if (typeof object.output === "string") + $util.base64.decode(object.output, message.output = $util.newBuffer($util.base64.length(object.output)), 0); + else if (object.output.length >= 0) + message.output = object.output; + return message; + }; + + /** + * Creates a plain object from a DirectRawPredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.DirectRawPredictResponse} message DirectRawPredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectRawPredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.output = ""; + else { + object.output = []; + if (options.bytes !== Array) + object.output = $util.newBuffer(object.output); + } + if (message.output != null && message.hasOwnProperty("output")) + object.output = options.bytes === String ? $util.base64.encode(message.output, 0, message.output.length) : options.bytes === Array ? Array.prototype.slice.call(message.output) : message.output; + return object; + }; + + /** + * Converts this DirectRawPredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @instance + * @returns {Object.} JSON object + */ + DirectRawPredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectRawPredictResponse + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1.DirectRawPredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectRawPredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1.DirectRawPredictResponse"; + }; + + return DirectRawPredictResponse; + })(); + v1.StreamingPredictRequest = (function() { /** @@ -124621,6 +125798,477 @@ return StreamingPredictResponse; })(); + v1.StreamingRawPredictRequest = (function() { + + /** + * Properties of a StreamingRawPredictRequest. + * @memberof google.cloud.aiplatform.v1 + * @interface IStreamingRawPredictRequest + * @property {string|null} [endpoint] StreamingRawPredictRequest endpoint + * @property {string|null} [methodName] StreamingRawPredictRequest methodName + * @property {Uint8Array|null} [input] StreamingRawPredictRequest input + */ + + /** + * Constructs a new StreamingRawPredictRequest. + * @memberof google.cloud.aiplatform.v1 + * @classdesc Represents a StreamingRawPredictRequest. + * @implements IStreamingRawPredictRequest + * @constructor + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictRequest=} [properties] Properties to set + */ + function StreamingRawPredictRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingRawPredictRequest endpoint. + * @member {string} endpoint + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @instance + */ + StreamingRawPredictRequest.prototype.endpoint = ""; + + /** + * StreamingRawPredictRequest methodName. + * @member {string} methodName + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @instance + */ + StreamingRawPredictRequest.prototype.methodName = ""; + + /** + * StreamingRawPredictRequest input. + * @member {Uint8Array} input + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @instance + */ + StreamingRawPredictRequest.prototype.input = $util.newBuffer([]); + + /** + * Creates a new StreamingRawPredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1.StreamingRawPredictRequest} StreamingRawPredictRequest instance + */ + StreamingRawPredictRequest.create = function create(properties) { + return new StreamingRawPredictRequest(properties); + }; + + /** + * Encodes the specified StreamingRawPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1.StreamingRawPredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictRequest} message StreamingRawPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRawPredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.endpoint); + if (message.methodName != null && Object.hasOwnProperty.call(message, "methodName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.methodName); + if (message.input != null && Object.hasOwnProperty.call(message, "input")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.input); + return writer; + }; + + /** + * Encodes the specified StreamingRawPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.StreamingRawPredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictRequest} message StreamingRawPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRawPredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingRawPredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1.StreamingRawPredictRequest} StreamingRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRawPredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1.StreamingRawPredictRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.endpoint = reader.string(); + break; + } + case 2: { + message.methodName = reader.string(); + break; + } + case 3: { + message.input = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingRawPredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1.StreamingRawPredictRequest} StreamingRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRawPredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingRawPredictRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingRawPredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (!$util.isString(message.endpoint)) + return "endpoint: string expected"; + if (message.methodName != null && message.hasOwnProperty("methodName")) + if (!$util.isString(message.methodName)) + return "methodName: string expected"; + if (message.input != null && message.hasOwnProperty("input")) + if (!(message.input && typeof message.input.length === "number" || $util.isString(message.input))) + return "input: buffer expected"; + return null; + }; + + /** + * Creates a StreamingRawPredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1.StreamingRawPredictRequest} StreamingRawPredictRequest + */ + StreamingRawPredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1.StreamingRawPredictRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1.StreamingRawPredictRequest(); + if (object.endpoint != null) + message.endpoint = String(object.endpoint); + if (object.methodName != null) + message.methodName = String(object.methodName); + if (object.input != null) + if (typeof object.input === "string") + $util.base64.decode(object.input, message.input = $util.newBuffer($util.base64.length(object.input)), 0); + else if (object.input.length >= 0) + message.input = object.input; + return message; + }; + + /** + * Creates a plain object from a StreamingRawPredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1.StreamingRawPredictRequest} message StreamingRawPredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingRawPredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.endpoint = ""; + object.methodName = ""; + if (options.bytes === String) + object.input = ""; + else { + object.input = []; + if (options.bytes !== Array) + object.input = $util.newBuffer(object.input); + } + } + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + object.endpoint = message.endpoint; + if (message.methodName != null && message.hasOwnProperty("methodName")) + object.methodName = message.methodName; + if (message.input != null && message.hasOwnProperty("input")) + object.input = options.bytes === String ? $util.base64.encode(message.input, 0, message.input.length) : options.bytes === Array ? Array.prototype.slice.call(message.input) : message.input; + return object; + }; + + /** + * Converts this StreamingRawPredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @instance + * @returns {Object.} JSON object + */ + StreamingRawPredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingRawPredictRequest + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingRawPredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1.StreamingRawPredictRequest"; + }; + + return StreamingRawPredictRequest; + })(); + + v1.StreamingRawPredictResponse = (function() { + + /** + * Properties of a StreamingRawPredictResponse. + * @memberof google.cloud.aiplatform.v1 + * @interface IStreamingRawPredictResponse + * @property {Uint8Array|null} [output] StreamingRawPredictResponse output + */ + + /** + * Constructs a new StreamingRawPredictResponse. + * @memberof google.cloud.aiplatform.v1 + * @classdesc Represents a StreamingRawPredictResponse. + * @implements IStreamingRawPredictResponse + * @constructor + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictResponse=} [properties] Properties to set + */ + function StreamingRawPredictResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingRawPredictResponse output. + * @member {Uint8Array} output + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @instance + */ + StreamingRawPredictResponse.prototype.output = $util.newBuffer([]); + + /** + * Creates a new StreamingRawPredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictResponse=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1.StreamingRawPredictResponse} StreamingRawPredictResponse instance + */ + StreamingRawPredictResponse.create = function create(properties) { + return new StreamingRawPredictResponse(properties); + }; + + /** + * Encodes the specified StreamingRawPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1.StreamingRawPredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictResponse} message StreamingRawPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRawPredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.output != null && Object.hasOwnProperty.call(message, "output")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.output); + return writer; + }; + + /** + * Encodes the specified StreamingRawPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.StreamingRawPredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.IStreamingRawPredictResponse} message StreamingRawPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRawPredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingRawPredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1.StreamingRawPredictResponse} StreamingRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRawPredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1.StreamingRawPredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.output = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingRawPredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1.StreamingRawPredictResponse} StreamingRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRawPredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingRawPredictResponse message. + * @function verify + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingRawPredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.output != null && message.hasOwnProperty("output")) + if (!(message.output && typeof message.output.length === "number" || $util.isString(message.output))) + return "output: buffer expected"; + return null; + }; + + /** + * Creates a StreamingRawPredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1.StreamingRawPredictResponse} StreamingRawPredictResponse + */ + StreamingRawPredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1.StreamingRawPredictResponse) + return object; + var message = new $root.google.cloud.aiplatform.v1.StreamingRawPredictResponse(); + if (object.output != null) + if (typeof object.output === "string") + $util.base64.decode(object.output, message.output = $util.newBuffer($util.base64.length(object.output)), 0); + else if (object.output.length >= 0) + message.output = object.output; + return message; + }; + + /** + * Creates a plain object from a StreamingRawPredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1.StreamingRawPredictResponse} message StreamingRawPredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingRawPredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.output = ""; + else { + object.output = []; + if (options.bytes !== Array) + object.output = $util.newBuffer(object.output); + } + if (message.output != null && message.hasOwnProperty("output")) + object.output = options.bytes === String ? $util.base64.encode(message.output, 0, message.output.length) : options.bytes === Array ? Array.prototype.slice.call(message.output) : message.output; + return object; + }; + + /** + * Converts this StreamingRawPredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @instance + * @returns {Object.} JSON object + */ + StreamingRawPredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingRawPredictResponse + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1.StreamingRawPredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingRawPredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1.StreamingRawPredictResponse"; + }; + + return StreamingRawPredictResponse; + })(); + v1.ExplainRequest = (function() { /** @@ -238173,6 +239821,7 @@ * @property {Array.|null} [ports] ModelContainerSpec ports * @property {string|null} [predictRoute] ModelContainerSpec predictRoute * @property {string|null} [healthRoute] ModelContainerSpec healthRoute + * @property {Array.|null} [grpcPorts] ModelContainerSpec grpcPorts * @property {google.protobuf.IDuration|null} [deploymentTimeout] ModelContainerSpec deploymentTimeout * @property {number|Long|null} [sharedMemorySizeMb] ModelContainerSpec sharedMemorySizeMb * @property {google.cloud.aiplatform.v1beta1.IProbe|null} [startupProbe] ModelContainerSpec startupProbe @@ -238192,6 +239841,7 @@ this.args = []; this.env = []; this.ports = []; + this.grpcPorts = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -238254,6 +239904,14 @@ */ ModelContainerSpec.prototype.healthRoute = ""; + /** + * ModelContainerSpec grpcPorts. + * @member {Array.} grpcPorts + * @memberof google.cloud.aiplatform.v1beta1.ModelContainerSpec + * @instance + */ + ModelContainerSpec.prototype.grpcPorts = $util.emptyArray; + /** * ModelContainerSpec deploymentTimeout. * @member {google.protobuf.IDuration|null|undefined} deploymentTimeout @@ -238328,6 +239986,9 @@ writer.uint32(/* id 6, wireType 2 =*/50).string(message.predictRoute); if (message.healthRoute != null && Object.hasOwnProperty.call(message, "healthRoute")) writer.uint32(/* id 7, wireType 2 =*/58).string(message.healthRoute); + if (message.grpcPorts != null && message.grpcPorts.length) + for (var i = 0; i < message.grpcPorts.length; ++i) + $root.google.cloud.aiplatform.v1beta1.Port.encode(message.grpcPorts[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); if (message.deploymentTimeout != null && Object.hasOwnProperty.call(message, "deploymentTimeout")) $root.google.protobuf.Duration.encode(message.deploymentTimeout, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); if (message.sharedMemorySizeMb != null && Object.hasOwnProperty.call(message, "sharedMemorySizeMb")) @@ -238406,6 +240067,12 @@ message.healthRoute = reader.string(); break; } + case 9: { + if (!(message.grpcPorts && message.grpcPorts.length)) + message.grpcPorts = []; + message.grpcPorts.push($root.google.cloud.aiplatform.v1beta1.Port.decode(reader, reader.uint32())); + break; + } case 10: { message.deploymentTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); break; @@ -238498,6 +240165,15 @@ if (message.healthRoute != null && message.hasOwnProperty("healthRoute")) if (!$util.isString(message.healthRoute)) return "healthRoute: string expected"; + if (message.grpcPorts != null && message.hasOwnProperty("grpcPorts")) { + if (!Array.isArray(message.grpcPorts)) + return "grpcPorts: array expected"; + for (var i = 0; i < message.grpcPorts.length; ++i) { + var error = $root.google.cloud.aiplatform.v1beta1.Port.verify(message.grpcPorts[i]); + if (error) + return "grpcPorts." + error; + } + } if (message.deploymentTimeout != null && message.hasOwnProperty("deploymentTimeout")) { var error = $root.google.protobuf.Duration.verify(message.deploymentTimeout); if (error) @@ -238571,6 +240247,16 @@ message.predictRoute = String(object.predictRoute); if (object.healthRoute != null) message.healthRoute = String(object.healthRoute); + if (object.grpcPorts) { + if (!Array.isArray(object.grpcPorts)) + throw TypeError(".google.cloud.aiplatform.v1beta1.ModelContainerSpec.grpcPorts: array expected"); + message.grpcPorts = []; + for (var i = 0; i < object.grpcPorts.length; ++i) { + if (typeof object.grpcPorts[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.ModelContainerSpec.grpcPorts: object expected"); + message.grpcPorts[i] = $root.google.cloud.aiplatform.v1beta1.Port.fromObject(object.grpcPorts[i]); + } + } if (object.deploymentTimeout != null) { if (typeof object.deploymentTimeout !== "object") throw TypeError(".google.cloud.aiplatform.v1beta1.ModelContainerSpec.deploymentTimeout: object expected"); @@ -238616,6 +240302,7 @@ object.args = []; object.env = []; object.ports = []; + object.grpcPorts = []; } if (options.defaults) { object.imageUri = ""; @@ -238656,6 +240343,11 @@ object.predictRoute = message.predictRoute; if (message.healthRoute != null && message.hasOwnProperty("healthRoute")) object.healthRoute = message.healthRoute; + if (message.grpcPorts && message.grpcPorts.length) { + object.grpcPorts = []; + for (var j = 0; j < message.grpcPorts.length; ++j) + object.grpcPorts[j] = $root.google.cloud.aiplatform.v1beta1.Port.toObject(message.grpcPorts[j], options); + } if (message.deploymentTimeout != null && message.hasOwnProperty("deploymentTimeout")) object.deploymentTimeout = $root.google.protobuf.Duration.toObject(message.deploymentTimeout, options); if (message.sharedMemorySizeMb != null && message.hasOwnProperty("sharedMemorySizeMb")) @@ -394116,6 +395808,105 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|directPredict}. + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @typedef DirectPredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1beta1.DirectPredictResponse} [response] DirectPredictResponse + */ + + /** + * Calls DirectPredict. + * @function directPredict + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictRequest} request DirectPredictRequest message or plain object + * @param {google.cloud.aiplatform.v1beta1.PredictionService.DirectPredictCallback} callback Node-style callback called with the error, if any, and DirectPredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.directPredict = function directPredict(request, callback) { + return this.rpcCall(directPredict, $root.google.cloud.aiplatform.v1beta1.DirectPredictRequest, $root.google.cloud.aiplatform.v1beta1.DirectPredictResponse, request, callback); + }, "name", { value: "DirectPredict" }); + + /** + * Calls DirectPredict. + * @function directPredict + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictRequest} request DirectPredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|directRawPredict}. + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @typedef DirectRawPredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1beta1.DirectRawPredictResponse} [response] DirectRawPredictResponse + */ + + /** + * Calls DirectRawPredict. + * @function directRawPredict + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest} request DirectRawPredictRequest message or plain object + * @param {google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredictCallback} callback Node-style callback called with the error, if any, and DirectRawPredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.directRawPredict = function directRawPredict(request, callback) { + return this.rpcCall(directRawPredict, $root.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest, $root.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse, request, callback); + }, "name", { value: "DirectRawPredict" }); + + /** + * Calls DirectRawPredict. + * @function directRawPredict + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest} request DirectRawPredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|streamingPredict}. + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @typedef StreamingPredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1beta1.StreamingPredictResponse} [response] StreamingPredictResponse + */ + + /** + * Calls StreamingPredict. + * @function streamingPredict + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IStreamingPredictRequest} request StreamingPredictRequest message or plain object + * @param {google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredictCallback} callback Node-style callback called with the error, if any, and StreamingPredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.streamingPredict = function streamingPredict(request, callback) { + return this.rpcCall(streamingPredict, $root.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, $root.google.cloud.aiplatform.v1beta1.StreamingPredictResponse, request, callback); + }, "name", { value: "StreamingPredict" }); + + /** + * Calls StreamingPredict. + * @function streamingPredict + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IStreamingPredictRequest} request StreamingPredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|serverStreamingPredict}. * @memberof google.cloud.aiplatform.v1beta1.PredictionService @@ -394149,6 +395940,39 @@ * @variation 2 */ + /** + * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|streamingRawPredict}. + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @typedef StreamingRawPredictCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse} [response] StreamingRawPredictResponse + */ + + /** + * Calls StreamingRawPredict. + * @function streamingRawPredict + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest} request StreamingRawPredictRequest message or plain object + * @param {google.cloud.aiplatform.v1beta1.PredictionService.StreamingRawPredictCallback} callback Node-style callback called with the error, if any, and StreamingRawPredictResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(PredictionService.prototype.streamingRawPredict = function streamingRawPredict(request, callback) { + return this.rpcCall(streamingRawPredict, $root.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest, $root.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse, request, callback); + }, "name", { value: "StreamingRawPredict" }); + + /** + * Calls StreamingRawPredict. + * @function streamingRawPredict + * @memberof google.cloud.aiplatform.v1beta1.PredictionService + * @instance + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest} request StreamingRawPredictRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + /** * Callback as used by {@link google.cloud.aiplatform.v1beta1.PredictionService|explain}. * @memberof google.cloud.aiplatform.v1beta1.PredictionService @@ -395073,6 +396897,1007 @@ return RawPredictRequest; })(); + v1beta1.DirectPredictRequest = (function() { + + /** + * Properties of a DirectPredictRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IDirectPredictRequest + * @property {string|null} [endpoint] DirectPredictRequest endpoint + * @property {Array.|null} [inputs] DirectPredictRequest inputs + * @property {google.cloud.aiplatform.v1beta1.ITensor|null} [parameters] DirectPredictRequest parameters + */ + + /** + * Constructs a new DirectPredictRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents a DirectPredictRequest. + * @implements IDirectPredictRequest + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictRequest=} [properties] Properties to set + */ + function DirectPredictRequest(properties) { + this.inputs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DirectPredictRequest endpoint. + * @member {string} endpoint + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @instance + */ + DirectPredictRequest.prototype.endpoint = ""; + + /** + * DirectPredictRequest inputs. + * @member {Array.} inputs + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @instance + */ + DirectPredictRequest.prototype.inputs = $util.emptyArray; + + /** + * DirectPredictRequest parameters. + * @member {google.cloud.aiplatform.v1beta1.ITensor|null|undefined} parameters + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @instance + */ + DirectPredictRequest.prototype.parameters = null; + + /** + * Creates a new DirectPredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.DirectPredictRequest} DirectPredictRequest instance + */ + DirectPredictRequest.create = function create(properties) { + return new DirectPredictRequest(properties); + }; + + /** + * Encodes the specified DirectPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectPredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictRequest} message DirectPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectPredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.endpoint); + if (message.inputs != null && message.inputs.length) + for (var i = 0; i < message.inputs.length; ++i) + $root.google.cloud.aiplatform.v1beta1.Tensor.encode(message.inputs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.cloud.aiplatform.v1beta1.Tensor.encode(message.parameters, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DirectPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectPredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictRequest} message DirectPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectPredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DirectPredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1beta1.DirectPredictRequest} DirectPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectPredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1beta1.DirectPredictRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.endpoint = reader.string(); + break; + } + case 2: { + if (!(message.inputs && message.inputs.length)) + message.inputs = []; + message.inputs.push($root.google.cloud.aiplatform.v1beta1.Tensor.decode(reader, reader.uint32())); + break; + } + case 3: { + message.parameters = $root.google.cloud.aiplatform.v1beta1.Tensor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DirectPredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.DirectPredictRequest} DirectPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectPredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DirectPredictRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DirectPredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (!$util.isString(message.endpoint)) + return "endpoint: string expected"; + if (message.inputs != null && message.hasOwnProperty("inputs")) { + if (!Array.isArray(message.inputs)) + return "inputs: array expected"; + for (var i = 0; i < message.inputs.length; ++i) { + var error = $root.google.cloud.aiplatform.v1beta1.Tensor.verify(message.inputs[i]); + if (error) + return "inputs." + error; + } + } + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.cloud.aiplatform.v1beta1.Tensor.verify(message.parameters); + if (error) + return "parameters." + error; + } + return null; + }; + + /** + * Creates a DirectPredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.DirectPredictRequest} DirectPredictRequest + */ + DirectPredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.DirectPredictRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.DirectPredictRequest(); + if (object.endpoint != null) + message.endpoint = String(object.endpoint); + if (object.inputs) { + if (!Array.isArray(object.inputs)) + throw TypeError(".google.cloud.aiplatform.v1beta1.DirectPredictRequest.inputs: array expected"); + message.inputs = []; + for (var i = 0; i < object.inputs.length; ++i) { + if (typeof object.inputs[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.DirectPredictRequest.inputs: object expected"); + message.inputs[i] = $root.google.cloud.aiplatform.v1beta1.Tensor.fromObject(object.inputs[i]); + } + } + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.DirectPredictRequest.parameters: object expected"); + message.parameters = $root.google.cloud.aiplatform.v1beta1.Tensor.fromObject(object.parameters); + } + return message; + }; + + /** + * Creates a plain object from a DirectPredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.DirectPredictRequest} message DirectPredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectPredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.inputs = []; + if (options.defaults) { + object.endpoint = ""; + object.parameters = null; + } + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + object.endpoint = message.endpoint; + if (message.inputs && message.inputs.length) { + object.inputs = []; + for (var j = 0; j < message.inputs.length; ++j) + object.inputs[j] = $root.google.cloud.aiplatform.v1beta1.Tensor.toObject(message.inputs[j], options); + } + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.cloud.aiplatform.v1beta1.Tensor.toObject(message.parameters, options); + return object; + }; + + /** + * Converts this DirectPredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @instance + * @returns {Object.} JSON object + */ + DirectPredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectPredictRequest + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectPredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1beta1.DirectPredictRequest"; + }; + + return DirectPredictRequest; + })(); + + v1beta1.DirectPredictResponse = (function() { + + /** + * Properties of a DirectPredictResponse. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IDirectPredictResponse + * @property {Array.|null} [outputs] DirectPredictResponse outputs + * @property {google.cloud.aiplatform.v1beta1.ITensor|null} [parameters] DirectPredictResponse parameters + */ + + /** + * Constructs a new DirectPredictResponse. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents a DirectPredictResponse. + * @implements IDirectPredictResponse + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictResponse=} [properties] Properties to set + */ + function DirectPredictResponse(properties) { + this.outputs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DirectPredictResponse outputs. + * @member {Array.} outputs + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @instance + */ + DirectPredictResponse.prototype.outputs = $util.emptyArray; + + /** + * DirectPredictResponse parameters. + * @member {google.cloud.aiplatform.v1beta1.ITensor|null|undefined} parameters + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @instance + */ + DirectPredictResponse.prototype.parameters = null; + + /** + * Creates a new DirectPredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictResponse=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.DirectPredictResponse} DirectPredictResponse instance + */ + DirectPredictResponse.create = function create(properties) { + return new DirectPredictResponse(properties); + }; + + /** + * Encodes the specified DirectPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectPredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictResponse} message DirectPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectPredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.outputs != null && message.outputs.length) + for (var i = 0; i < message.outputs.length; ++i) + $root.google.cloud.aiplatform.v1beta1.Tensor.encode(message.outputs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parameters != null && Object.hasOwnProperty.call(message, "parameters")) + $root.google.cloud.aiplatform.v1beta1.Tensor.encode(message.parameters, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DirectPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectPredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectPredictResponse} message DirectPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectPredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DirectPredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1beta1.DirectPredictResponse} DirectPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectPredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1beta1.DirectPredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (!(message.outputs && message.outputs.length)) + message.outputs = []; + message.outputs.push($root.google.cloud.aiplatform.v1beta1.Tensor.decode(reader, reader.uint32())); + break; + } + case 2: { + message.parameters = $root.google.cloud.aiplatform.v1beta1.Tensor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DirectPredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.DirectPredictResponse} DirectPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectPredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DirectPredictResponse message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DirectPredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.outputs != null && message.hasOwnProperty("outputs")) { + if (!Array.isArray(message.outputs)) + return "outputs: array expected"; + for (var i = 0; i < message.outputs.length; ++i) { + var error = $root.google.cloud.aiplatform.v1beta1.Tensor.verify(message.outputs[i]); + if (error) + return "outputs." + error; + } + } + if (message.parameters != null && message.hasOwnProperty("parameters")) { + var error = $root.google.cloud.aiplatform.v1beta1.Tensor.verify(message.parameters); + if (error) + return "parameters." + error; + } + return null; + }; + + /** + * Creates a DirectPredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.DirectPredictResponse} DirectPredictResponse + */ + DirectPredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.DirectPredictResponse) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.DirectPredictResponse(); + if (object.outputs) { + if (!Array.isArray(object.outputs)) + throw TypeError(".google.cloud.aiplatform.v1beta1.DirectPredictResponse.outputs: array expected"); + message.outputs = []; + for (var i = 0; i < object.outputs.length; ++i) { + if (typeof object.outputs[i] !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.DirectPredictResponse.outputs: object expected"); + message.outputs[i] = $root.google.cloud.aiplatform.v1beta1.Tensor.fromObject(object.outputs[i]); + } + } + if (object.parameters != null) { + if (typeof object.parameters !== "object") + throw TypeError(".google.cloud.aiplatform.v1beta1.DirectPredictResponse.parameters: object expected"); + message.parameters = $root.google.cloud.aiplatform.v1beta1.Tensor.fromObject(object.parameters); + } + return message; + }; + + /** + * Creates a plain object from a DirectPredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.DirectPredictResponse} message DirectPredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectPredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.outputs = []; + if (options.defaults) + object.parameters = null; + if (message.outputs && message.outputs.length) { + object.outputs = []; + for (var j = 0; j < message.outputs.length; ++j) + object.outputs[j] = $root.google.cloud.aiplatform.v1beta1.Tensor.toObject(message.outputs[j], options); + } + if (message.parameters != null && message.hasOwnProperty("parameters")) + object.parameters = $root.google.cloud.aiplatform.v1beta1.Tensor.toObject(message.parameters, options); + return object; + }; + + /** + * Converts this DirectPredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @instance + * @returns {Object.} JSON object + */ + DirectPredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectPredictResponse + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1beta1.DirectPredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectPredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1beta1.DirectPredictResponse"; + }; + + return DirectPredictResponse; + })(); + + v1beta1.DirectRawPredictRequest = (function() { + + /** + * Properties of a DirectRawPredictRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IDirectRawPredictRequest + * @property {string|null} [endpoint] DirectRawPredictRequest endpoint + * @property {string|null} [methodName] DirectRawPredictRequest methodName + * @property {Uint8Array|null} [input] DirectRawPredictRequest input + */ + + /** + * Constructs a new DirectRawPredictRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents a DirectRawPredictRequest. + * @implements IDirectRawPredictRequest + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest=} [properties] Properties to set + */ + function DirectRawPredictRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DirectRawPredictRequest endpoint. + * @member {string} endpoint + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @instance + */ + DirectRawPredictRequest.prototype.endpoint = ""; + + /** + * DirectRawPredictRequest methodName. + * @member {string} methodName + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @instance + */ + DirectRawPredictRequest.prototype.methodName = ""; + + /** + * DirectRawPredictRequest input. + * @member {Uint8Array} input + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @instance + */ + DirectRawPredictRequest.prototype.input = $util.newBuffer([]); + + /** + * Creates a new DirectRawPredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.DirectRawPredictRequest} DirectRawPredictRequest instance + */ + DirectRawPredictRequest.create = function create(properties) { + return new DirectRawPredictRequest(properties); + }; + + /** + * Encodes the specified DirectRawPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest} message DirectRawPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectRawPredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.endpoint); + if (message.methodName != null && Object.hasOwnProperty.call(message, "methodName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.methodName); + if (message.input != null && Object.hasOwnProperty.call(message, "input")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.input); + return writer; + }; + + /** + * Encodes the specified DirectRawPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest} message DirectRawPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectRawPredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DirectRawPredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1beta1.DirectRawPredictRequest} DirectRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectRawPredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.endpoint = reader.string(); + break; + } + case 2: { + message.methodName = reader.string(); + break; + } + case 3: { + message.input = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DirectRawPredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.DirectRawPredictRequest} DirectRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectRawPredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DirectRawPredictRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DirectRawPredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (!$util.isString(message.endpoint)) + return "endpoint: string expected"; + if (message.methodName != null && message.hasOwnProperty("methodName")) + if (!$util.isString(message.methodName)) + return "methodName: string expected"; + if (message.input != null && message.hasOwnProperty("input")) + if (!(message.input && typeof message.input.length === "number" || $util.isString(message.input))) + return "input: buffer expected"; + return null; + }; + + /** + * Creates a DirectRawPredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.DirectRawPredictRequest} DirectRawPredictRequest + */ + DirectRawPredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest(); + if (object.endpoint != null) + message.endpoint = String(object.endpoint); + if (object.methodName != null) + message.methodName = String(object.methodName); + if (object.input != null) + if (typeof object.input === "string") + $util.base64.decode(object.input, message.input = $util.newBuffer($util.base64.length(object.input)), 0); + else if (object.input.length >= 0) + message.input = object.input; + return message; + }; + + /** + * Creates a plain object from a DirectRawPredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.DirectRawPredictRequest} message DirectRawPredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectRawPredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.endpoint = ""; + object.methodName = ""; + if (options.bytes === String) + object.input = ""; + else { + object.input = []; + if (options.bytes !== Array) + object.input = $util.newBuffer(object.input); + } + } + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + object.endpoint = message.endpoint; + if (message.methodName != null && message.hasOwnProperty("methodName")) + object.methodName = message.methodName; + if (message.input != null && message.hasOwnProperty("input")) + object.input = options.bytes === String ? $util.base64.encode(message.input, 0, message.input.length) : options.bytes === Array ? Array.prototype.slice.call(message.input) : message.input; + return object; + }; + + /** + * Converts this DirectRawPredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @instance + * @returns {Object.} JSON object + */ + DirectRawPredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectRawPredictRequest + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectRawPredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1beta1.DirectRawPredictRequest"; + }; + + return DirectRawPredictRequest; + })(); + + v1beta1.DirectRawPredictResponse = (function() { + + /** + * Properties of a DirectRawPredictResponse. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IDirectRawPredictResponse + * @property {Uint8Array|null} [output] DirectRawPredictResponse output + */ + + /** + * Constructs a new DirectRawPredictResponse. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents a DirectRawPredictResponse. + * @implements IDirectRawPredictResponse + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse=} [properties] Properties to set + */ + function DirectRawPredictResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DirectRawPredictResponse output. + * @member {Uint8Array} output + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @instance + */ + DirectRawPredictResponse.prototype.output = $util.newBuffer([]); + + /** + * Creates a new DirectRawPredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.DirectRawPredictResponse} DirectRawPredictResponse instance + */ + DirectRawPredictResponse.create = function create(properties) { + return new DirectRawPredictResponse(properties); + }; + + /** + * Encodes the specified DirectRawPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse} message DirectRawPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectRawPredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.output != null && Object.hasOwnProperty.call(message, "output")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.output); + return writer; + }; + + /** + * Encodes the specified DirectRawPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse} message DirectRawPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DirectRawPredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DirectRawPredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1beta1.DirectRawPredictResponse} DirectRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectRawPredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.output = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DirectRawPredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.DirectRawPredictResponse} DirectRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DirectRawPredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DirectRawPredictResponse message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DirectRawPredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.output != null && message.hasOwnProperty("output")) + if (!(message.output && typeof message.output.length === "number" || $util.isString(message.output))) + return "output: buffer expected"; + return null; + }; + + /** + * Creates a DirectRawPredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.DirectRawPredictResponse} DirectRawPredictResponse + */ + DirectRawPredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse(); + if (object.output != null) + if (typeof object.output === "string") + $util.base64.decode(object.output, message.output = $util.newBuffer($util.base64.length(object.output)), 0); + else if (object.output.length >= 0) + message.output = object.output; + return message; + }; + + /** + * Creates a plain object from a DirectRawPredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.DirectRawPredictResponse} message DirectRawPredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DirectRawPredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.output = ""; + else { + object.output = []; + if (options.bytes !== Array) + object.output = $util.newBuffer(object.output); + } + if (message.output != null && message.hasOwnProperty("output")) + object.output = options.bytes === String ? $util.base64.encode(message.output, 0, message.output.length) : options.bytes === Array ? Array.prototype.slice.call(message.output) : message.output; + return object; + }; + + /** + * Converts this DirectRawPredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @instance + * @returns {Object.} JSON object + */ + DirectRawPredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DirectRawPredictResponse + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DirectRawPredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1beta1.DirectRawPredictResponse"; + }; + + return DirectRawPredictResponse; + })(); + v1beta1.StreamingPredictRequest = (function() { /** @@ -395603,6 +398428,477 @@ return StreamingPredictResponse; })(); + v1beta1.StreamingRawPredictRequest = (function() { + + /** + * Properties of a StreamingRawPredictRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IStreamingRawPredictRequest + * @property {string|null} [endpoint] StreamingRawPredictRequest endpoint + * @property {string|null} [methodName] StreamingRawPredictRequest methodName + * @property {Uint8Array|null} [input] StreamingRawPredictRequest input + */ + + /** + * Constructs a new StreamingRawPredictRequest. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents a StreamingRawPredictRequest. + * @implements IStreamingRawPredictRequest + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest=} [properties] Properties to set + */ + function StreamingRawPredictRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingRawPredictRequest endpoint. + * @member {string} endpoint + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @instance + */ + StreamingRawPredictRequest.prototype.endpoint = ""; + + /** + * StreamingRawPredictRequest methodName. + * @member {string} methodName + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @instance + */ + StreamingRawPredictRequest.prototype.methodName = ""; + + /** + * StreamingRawPredictRequest input. + * @member {Uint8Array} input + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @instance + */ + StreamingRawPredictRequest.prototype.input = $util.newBuffer([]); + + /** + * Creates a new StreamingRawPredictRequest instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest} StreamingRawPredictRequest instance + */ + StreamingRawPredictRequest.create = function create(properties) { + return new StreamingRawPredictRequest(properties); + }; + + /** + * Encodes the specified StreamingRawPredictRequest message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest} message StreamingRawPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRawPredictRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endpoint != null && Object.hasOwnProperty.call(message, "endpoint")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.endpoint); + if (message.methodName != null && Object.hasOwnProperty.call(message, "methodName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.methodName); + if (message.input != null && Object.hasOwnProperty.call(message, "input")) + writer.uint32(/* id 3, wireType 2 =*/26).bytes(message.input); + return writer; + }; + + /** + * Encodes the specified StreamingRawPredictRequest message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictRequest} message StreamingRawPredictRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRawPredictRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingRawPredictRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest} StreamingRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRawPredictRequest.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.endpoint = reader.string(); + break; + } + case 2: { + message.methodName = reader.string(); + break; + } + case 3: { + message.input = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingRawPredictRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest} StreamingRawPredictRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRawPredictRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingRawPredictRequest message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingRawPredictRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + if (!$util.isString(message.endpoint)) + return "endpoint: string expected"; + if (message.methodName != null && message.hasOwnProperty("methodName")) + if (!$util.isString(message.methodName)) + return "methodName: string expected"; + if (message.input != null && message.hasOwnProperty("input")) + if (!(message.input && typeof message.input.length === "number" || $util.isString(message.input))) + return "input: buffer expected"; + return null; + }; + + /** + * Creates a StreamingRawPredictRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest} StreamingRawPredictRequest + */ + StreamingRawPredictRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest(); + if (object.endpoint != null) + message.endpoint = String(object.endpoint); + if (object.methodName != null) + message.methodName = String(object.methodName); + if (object.input != null) + if (typeof object.input === "string") + $util.base64.decode(object.input, message.input = $util.newBuffer($util.base64.length(object.input)), 0); + else if (object.input.length >= 0) + message.input = object.input; + return message; + }; + + /** + * Creates a plain object from a StreamingRawPredictRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest} message StreamingRawPredictRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingRawPredictRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.endpoint = ""; + object.methodName = ""; + if (options.bytes === String) + object.input = ""; + else { + object.input = []; + if (options.bytes !== Array) + object.input = $util.newBuffer(object.input); + } + } + if (message.endpoint != null && message.hasOwnProperty("endpoint")) + object.endpoint = message.endpoint; + if (message.methodName != null && message.hasOwnProperty("methodName")) + object.methodName = message.methodName; + if (message.input != null && message.hasOwnProperty("input")) + object.input = options.bytes === String ? $util.base64.encode(message.input, 0, message.input.length) : options.bytes === Array ? Array.prototype.slice.call(message.input) : message.input; + return object; + }; + + /** + * Converts this StreamingRawPredictRequest to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @instance + * @returns {Object.} JSON object + */ + StreamingRawPredictRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingRawPredictRequest + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingRawPredictRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest"; + }; + + return StreamingRawPredictRequest; + })(); + + v1beta1.StreamingRawPredictResponse = (function() { + + /** + * Properties of a StreamingRawPredictResponse. + * @memberof google.cloud.aiplatform.v1beta1 + * @interface IStreamingRawPredictResponse + * @property {Uint8Array|null} [output] StreamingRawPredictResponse output + */ + + /** + * Constructs a new StreamingRawPredictResponse. + * @memberof google.cloud.aiplatform.v1beta1 + * @classdesc Represents a StreamingRawPredictResponse. + * @implements IStreamingRawPredictResponse + * @constructor + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictResponse=} [properties] Properties to set + */ + function StreamingRawPredictResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StreamingRawPredictResponse output. + * @member {Uint8Array} output + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @instance + */ + StreamingRawPredictResponse.prototype.output = $util.newBuffer([]); + + /** + * Creates a new StreamingRawPredictResponse instance using the specified properties. + * @function create + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictResponse=} [properties] Properties to set + * @returns {google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse} StreamingRawPredictResponse instance + */ + StreamingRawPredictResponse.create = function create(properties) { + return new StreamingRawPredictResponse(properties); + }; + + /** + * Encodes the specified StreamingRawPredictResponse message. Does not implicitly {@link google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictResponse} message StreamingRawPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRawPredictResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.output != null && Object.hasOwnProperty.call(message, "output")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.output); + return writer; + }; + + /** + * Encodes the specified StreamingRawPredictResponse message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.IStreamingRawPredictResponse} message StreamingRawPredictResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StreamingRawPredictResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StreamingRawPredictResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse} StreamingRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRawPredictResponse.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.output = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StreamingRawPredictResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse} StreamingRawPredictResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StreamingRawPredictResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StreamingRawPredictResponse message. + * @function verify + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StreamingRawPredictResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.output != null && message.hasOwnProperty("output")) + if (!(message.output && typeof message.output.length === "number" || $util.isString(message.output))) + return "output: buffer expected"; + return null; + }; + + /** + * Creates a StreamingRawPredictResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse} StreamingRawPredictResponse + */ + StreamingRawPredictResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) + return object; + var message = new $root.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse(); + if (object.output != null) + if (typeof object.output === "string") + $util.base64.decode(object.output, message.output = $util.newBuffer($util.base64.length(object.output)), 0); + else if (object.output.length >= 0) + message.output = object.output; + return message; + }; + + /** + * Creates a plain object from a StreamingRawPredictResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse} message StreamingRawPredictResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StreamingRawPredictResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.output = ""; + else { + object.output = []; + if (options.bytes !== Array) + object.output = $util.newBuffer(object.output); + } + if (message.output != null && message.hasOwnProperty("output")) + object.output = options.bytes === String ? $util.base64.encode(message.output, 0, message.output.length) : options.bytes === Array ? Array.prototype.slice.call(message.output) : message.output; + return object; + }; + + /** + * Converts this StreamingRawPredictResponse to JSON. + * @function toJSON + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @instance + * @returns {Object.} JSON object + */ + StreamingRawPredictResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StreamingRawPredictResponse + * @function getTypeUrl + * @memberof google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StreamingRawPredictResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse"; + }; + + return StreamingRawPredictResponse; + })(); + v1beta1.ExplainRequest = (function() { /** diff --git a/packages/google-cloud-aiplatform/protos/protos.json b/packages/google-cloud-aiplatform/protos/protos.json index 64860be6f97..b69ba2b23c8 100644 --- a/packages/google-cloud-aiplatform/protos/protos.json +++ b/packages/google-cloud-aiplatform/protos/protos.json @@ -1880,6 +1880,14 @@ "(google.api.field_behavior)": "IMMUTABLE" } }, + "grpcPorts": { + "rule": "repeated", + "type": "Port", + "id": 9, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, "deploymentTimeout": { "type": "google.protobuf.Duration", "id": 10, @@ -13382,6 +13390,44 @@ } ] }, + "DirectPredict": { + "requestType": "DirectPredictRequest", + "responseType": "DirectPredictResponse", + "options": { + "(google.api.http).post": "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directPredict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directPredict", + "body": "*" + } + } + ] + }, + "DirectRawPredict": { + "requestType": "DirectRawPredictRequest", + "responseType": "DirectRawPredictResponse", + "options": { + "(google.api.http).post": "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directRawPredict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directRawPredict", + "body": "*" + } + } + ] + }, + "StreamingPredict": { + "requestType": "StreamingPredictRequest", + "requestStream": true, + "responseType": "StreamingPredictResponse", + "responseStream": true + }, "ServerStreamingPredict": { "requestType": "StreamingPredictRequest", "responseType": "StreamingPredictResponse", @@ -13405,6 +13451,12 @@ } ] }, + "StreamingRawPredict": { + "requestType": "StreamingRawPredictRequest", + "requestStream": true, + "responseType": "StreamingRawPredictResponse", + "responseStream": true + }, "Explain": { "requestType": "ExplainRequest", "responseType": "ExplainResponse", @@ -13509,6 +13561,68 @@ } } }, + "DirectPredictRequest": { + "fields": { + "endpoint": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Endpoint" + } + }, + "inputs": { + "rule": "repeated", + "type": "Tensor", + "id": 2 + }, + "parameters": { + "type": "Tensor", + "id": 3 + } + } + }, + "DirectPredictResponse": { + "fields": { + "outputs": { + "rule": "repeated", + "type": "Tensor", + "id": 1 + }, + "parameters": { + "type": "Tensor", + "id": 2 + } + } + }, + "DirectRawPredictRequest": { + "fields": { + "endpoint": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Endpoint" + } + }, + "methodName": { + "type": "string", + "id": 2 + }, + "input": { + "type": "bytes", + "id": 3 + } + } + }, + "DirectRawPredictResponse": { + "fields": { + "output": { + "type": "bytes", + "id": 1 + } + } + }, "StreamingPredictRequest": { "fields": { "endpoint": { @@ -13543,6 +13657,34 @@ } } }, + "StreamingRawPredictRequest": { + "fields": { + "endpoint": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Endpoint" + } + }, + "methodName": { + "type": "string", + "id": 2 + }, + "input": { + "type": "bytes", + "id": 3 + } + } + }, + "StreamingRawPredictResponse": { + "fields": { + "output": { + "type": "bytes", + "id": 1 + } + } + }, "ExplainRequest": { "fields": { "endpoint": { @@ -25283,6 +25425,14 @@ "(google.api.field_behavior)": "IMMUTABLE" } }, + "grpcPorts": { + "rule": "repeated", + "type": "Port", + "id": 9, + "options": { + "(google.api.field_behavior)": "IMMUTABLE" + } + }, "deploymentTimeout": { "type": "google.protobuf.Duration", "id": 10, @@ -42706,6 +42856,44 @@ } ] }, + "DirectPredict": { + "requestType": "DirectPredictRequest", + "responseType": "DirectPredictResponse", + "options": { + "(google.api.http).post": "/v1beta1/{endpoint=projects/*/locations/*/endpoints/*}:directPredict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{endpoint=projects/*/locations/*/endpoints/*}:directPredict", + "body": "*" + } + } + ] + }, + "DirectRawPredict": { + "requestType": "DirectRawPredictRequest", + "responseType": "DirectRawPredictResponse", + "options": { + "(google.api.http).post": "/v1beta1/{endpoint=projects/*/locations/*/endpoints/*}:directRawPredict", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1beta1/{endpoint=projects/*/locations/*/endpoints/*}:directRawPredict", + "body": "*" + } + } + ] + }, + "StreamingPredict": { + "requestType": "StreamingPredictRequest", + "requestStream": true, + "responseType": "StreamingPredictResponse", + "responseStream": true + }, "ServerStreamingPredict": { "requestType": "StreamingPredictRequest", "responseType": "StreamingPredictResponse", @@ -42729,6 +42917,12 @@ } ] }, + "StreamingRawPredict": { + "requestType": "StreamingRawPredictRequest", + "requestStream": true, + "responseType": "StreamingRawPredictResponse", + "responseStream": true + }, "Explain": { "requestType": "ExplainRequest", "responseType": "ExplainResponse", @@ -42859,6 +43053,68 @@ } } }, + "DirectPredictRequest": { + "fields": { + "endpoint": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Endpoint" + } + }, + "inputs": { + "rule": "repeated", + "type": "Tensor", + "id": 2 + }, + "parameters": { + "type": "Tensor", + "id": 3 + } + } + }, + "DirectPredictResponse": { + "fields": { + "outputs": { + "rule": "repeated", + "type": "Tensor", + "id": 1 + }, + "parameters": { + "type": "Tensor", + "id": 2 + } + } + }, + "DirectRawPredictRequest": { + "fields": { + "endpoint": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Endpoint" + } + }, + "methodName": { + "type": "string", + "id": 2 + }, + "input": { + "type": "bytes", + "id": 3 + } + } + }, + "DirectRawPredictResponse": { + "fields": { + "output": { + "type": "bytes", + "id": 1 + } + } + }, "StreamingPredictRequest": { "fields": { "endpoint": { @@ -42893,6 +43149,34 @@ } } }, + "StreamingRawPredictRequest": { + "fields": { + "endpoint": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "aiplatform.googleapis.com/Endpoint" + } + }, + "methodName": { + "type": "string", + "id": 2 + }, + "input": { + "type": "bytes", + "id": 3 + } + } + }, + "StreamingRawPredictResponse": { + "fields": { + "output": { + "type": "bytes", + "id": 1 + } + } + }, "ExplainRequest": { "fields": { "endpoint": { diff --git a/packages/google-cloud-aiplatform/samples/README.md b/packages/google-cloud-aiplatform/samples/README.md index 3fd33202ff5..b0bdcaf5436 100644 --- a/packages/google-cloud-aiplatform/samples/README.md +++ b/packages/google-cloud-aiplatform/samples/README.md @@ -203,10 +203,14 @@ * [Pipeline_service.get_training_pipeline](#pipeline_service.get_training_pipeline) * [Pipeline_service.list_pipeline_jobs](#pipeline_service.list_pipeline_jobs) * [Pipeline_service.list_training_pipelines](#pipeline_service.list_training_pipelines) + * [Prediction_service.direct_predict](#prediction_service.direct_predict) + * [Prediction_service.direct_raw_predict](#prediction_service.direct_raw_predict) * [Prediction_service.explain](#prediction_service.explain) * [Prediction_service.predict](#prediction_service.predict) * [Prediction_service.raw_predict](#prediction_service.raw_predict) * [Prediction_service.server_streaming_predict](#prediction_service.server_streaming_predict) + * [Prediction_service.streaming_predict](#prediction_service.streaming_predict) + * [Prediction_service.streaming_raw_predict](#prediction_service.streaming_raw_predict) * [Schedule_service.create_schedule](#schedule_service.create_schedule) * [Schedule_service.delete_schedule](#schedule_service.delete_schedule) * [Schedule_service.get_schedule](#schedule_service.get_schedule) @@ -468,10 +472,14 @@ * [Pipeline_service.list_pipeline_jobs](#pipeline_service.list_pipeline_jobs) * [Pipeline_service.list_training_pipelines](#pipeline_service.list_training_pipelines) * [Prediction_service.count_tokens](#prediction_service.count_tokens) + * [Prediction_service.direct_predict](#prediction_service.direct_predict) + * [Prediction_service.direct_raw_predict](#prediction_service.direct_raw_predict) * [Prediction_service.explain](#prediction_service.explain) * [Prediction_service.predict](#prediction_service.predict) * [Prediction_service.raw_predict](#prediction_service.raw_predict) * [Prediction_service.server_streaming_predict](#prediction_service.server_streaming_predict) + * [Prediction_service.streaming_predict](#prediction_service.streaming_predict) + * [Prediction_service.streaming_raw_predict](#prediction_service.streaming_raw_predict) * [Schedule_service.create_schedule](#schedule_service.create_schedule) * [Schedule_service.delete_schedule](#schedule_service.delete_schedule) * [Schedule_service.get_schedule](#schedule_service.get_schedule) @@ -3793,6 +3801,40 @@ __Usage:__ +### Prediction_service.direct_predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js` + + +----- + + + + +### Prediction_service.direct_raw_predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js` + + +----- + + + + ### Prediction_service.explain View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.explain.js). @@ -3861,6 +3903,40 @@ __Usage:__ +### Prediction_service.streaming_predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js` + + +----- + + + + +### Prediction_service.streaming_raw_predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js` + + +----- + + + + ### Schedule_service.create_schedule View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1/schedule_service.create_schedule.js). @@ -8298,6 +8374,40 @@ __Usage:__ +### Prediction_service.direct_predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js` + + +----- + + + + +### Prediction_service.direct_raw_predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js` + + +----- + + + + ### Prediction_service.explain View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.explain.js). @@ -8366,6 +8476,40 @@ __Usage:__ +### Prediction_service.streaming_predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js` + + +----- + + + + +### Prediction_service.streaming_raw_predict + +View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js,samples/README.md) + +__Usage:__ + + +`node packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js` + + +----- + + + + ### Schedule_service.create_schedule View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-aiplatform/samples/generated/v1beta1/schedule_service.create_schedule.js). diff --git a/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js b/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js new file mode 100644 index 00000000000..f500b5316c7 --- /dev/null +++ b/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_predict.js @@ -0,0 +1,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(endpoint) { + // [START aiplatform_v1_generated_PredictionService_DirectPredict_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const endpoint = 'abc123' + /** + * The prediction input. + */ + // const inputs = [1,2,3,4] + /** + * The parameters that govern the prediction. + */ + // const parameters = {} + + // Imports the Aiplatform library + const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1; + + // Instantiates a client + const aiplatformClient = new PredictionServiceClient(); + + async function callDirectPredict() { + // Construct request + const request = { + endpoint, + }; + + // Run request + const response = await aiplatformClient.directPredict(request); + console.log(response); + } + + callDirectPredict(); + // [END aiplatform_v1_generated_PredictionService_DirectPredict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js b/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js new file mode 100644 index 00000000000..4a60ba2ea29 --- /dev/null +++ b/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.direct_raw_predict.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(endpoint) { + // [START aiplatform_v1_generated_PredictionService_DirectRawPredict_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const endpoint = 'abc123' + /** + * Fully qualified name of the API method being invoked to perform + * predictions. + * Format: + * `/namespace.Service/Method/` + * Example: + * `/tensorflow.serving.PredictionService/Predict` + */ + // const methodName = 'abc123' + /** + * The prediction input. + */ + // const input = Buffer.from('string') + + // Imports the Aiplatform library + const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1; + + // Instantiates a client + const aiplatformClient = new PredictionServiceClient(); + + async function callDirectRawPredict() { + // Construct request + const request = { + endpoint, + }; + + // Run request + const response = await aiplatformClient.directRawPredict(request); + console.log(response); + } + + callDirectRawPredict(); + // [END aiplatform_v1_generated_PredictionService_DirectRawPredict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js b/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js new file mode 100644 index 00000000000..7a7a128500c --- /dev/null +++ b/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_predict.js @@ -0,0 +1,75 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(endpoint) { + // [START aiplatform_v1_generated_PredictionService_StreamingPredict_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const endpoint = 'abc123' + /** + * The prediction input. + */ + // const inputs = [1,2,3,4] + /** + * The parameters that govern the prediction. + */ + // const parameters = {} + + // Imports the Aiplatform library + const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1; + + // Instantiates a client + const aiplatformClient = new PredictionServiceClient(); + + async function callStreamingPredict() { + // Construct request + const request = { + endpoint, + }; + + // Run request + const stream = await aiplatformClient.streamingPredict(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingPredict(); + // [END aiplatform_v1_generated_PredictionService_StreamingPredict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js b/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js new file mode 100644 index 00000000000..54a260b7db9 --- /dev/null +++ b/packages/google-cloud-aiplatform/samples/generated/v1/prediction_service.streaming_raw_predict.js @@ -0,0 +1,80 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(endpoint) { + // [START aiplatform_v1_generated_PredictionService_StreamingRawPredict_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const endpoint = 'abc123' + /** + * Fully qualified name of the API method being invoked to perform + * predictions. + * Format: + * `/namespace.Service/Method/` + * Example: + * `/tensorflow.serving.PredictionService/Predict` + */ + // const methodName = 'abc123' + /** + * The prediction input. + */ + // const input = Buffer.from('string') + + // Imports the Aiplatform library + const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1; + + // Instantiates a client + const aiplatformClient = new PredictionServiceClient(); + + async function callStreamingRawPredict() { + // Construct request + const request = { + endpoint, + }; + + // Run request + const stream = await aiplatformClient.streamingRawPredict(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingRawPredict(); + // [END aiplatform_v1_generated_PredictionService_StreamingRawPredict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/samples/generated/v1/snippet_metadata_google.cloud.aiplatform.v1.json b/packages/google-cloud-aiplatform/samples/generated/v1/snippet_metadata_google.cloud.aiplatform.v1.json index 4143ea950ea..4d9c9968c70 100644 --- a/packages/google-cloud-aiplatform/samples/generated/v1/snippet_metadata_google.cloud.aiplatform.v1.json +++ b/packages/google-cloud-aiplatform/samples/generated/v1/snippet_metadata_google.cloud.aiplatform.v1.json @@ -9039,6 +9039,150 @@ } } }, + { + "regionTag": "aiplatform_v1_generated_PredictionService_DirectPredict_async", + "title": "DatasetService directPredict Sample", + "origin": "API_DEFINITION", + "description": " Perform an unary online prediction request for Vertex first-party products and frameworks.", + "canonical": true, + "file": "prediction_service.direct_predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DirectPredict", + "fullName": "google.cloud.aiplatform.v1.PredictionService.DirectPredict", + "async": true, + "parameters": [ + { + "name": "endpoint", + "type": "TYPE_STRING" + }, + { + "name": "inputs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parameters", + "type": ".google.cloud.aiplatform.v1.Tensor" + } + ], + "resultType": ".google.cloud.aiplatform.v1.DirectPredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.aiplatform.v1.PredictionServiceClient" + }, + "method": { + "shortName": "DirectPredict", + "fullName": "google.cloud.aiplatform.v1.PredictionService.DirectPredict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.aiplatform.v1.PredictionService" + } + } + } + }, + { + "regionTag": "aiplatform_v1_generated_PredictionService_DirectRawPredict_async", + "title": "DatasetService directRawPredict Sample", + "origin": "API_DEFINITION", + "description": " Perform an online prediction request through gRPC.", + "canonical": true, + "file": "prediction_service.direct_raw_predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DirectRawPredict", + "fullName": "google.cloud.aiplatform.v1.PredictionService.DirectRawPredict", + "async": true, + "parameters": [ + { + "name": "endpoint", + "type": "TYPE_STRING" + }, + { + "name": "method_name", + "type": "TYPE_STRING" + }, + { + "name": "input", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.aiplatform.v1.DirectRawPredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.aiplatform.v1.PredictionServiceClient" + }, + "method": { + "shortName": "DirectRawPredict", + "fullName": "google.cloud.aiplatform.v1.PredictionService.DirectRawPredict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.aiplatform.v1.PredictionService" + } + } + } + }, + { + "regionTag": "aiplatform_v1_generated_PredictionService_StreamingPredict_async", + "title": "DatasetService streamingPredict Sample", + "origin": "API_DEFINITION", + "description": " Perform a streaming online prediction request for Vertex first-party products and frameworks.", + "canonical": true, + "file": "prediction_service.streaming_predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingPredict", + "fullName": "google.cloud.aiplatform.v1.PredictionService.StreamingPredict", + "async": true, + "parameters": [ + { + "name": "endpoint", + "type": "TYPE_STRING" + }, + { + "name": "inputs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parameters", + "type": ".google.cloud.aiplatform.v1.Tensor" + } + ], + "resultType": ".google.cloud.aiplatform.v1.StreamingPredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.aiplatform.v1.PredictionServiceClient" + }, + "method": { + "shortName": "StreamingPredict", + "fullName": "google.cloud.aiplatform.v1.PredictionService.StreamingPredict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.aiplatform.v1.PredictionService" + } + } + } + }, { "regionTag": "aiplatform_v1_generated_PredictionService_ServerStreamingPredict_async", "title": "DatasetService serverStreamingPredict Sample", @@ -9087,6 +9231,54 @@ } } }, + { + "regionTag": "aiplatform_v1_generated_PredictionService_StreamingRawPredict_async", + "title": "DatasetService streamingRawPredict Sample", + "origin": "API_DEFINITION", + "description": " Perform a streaming online prediction request through gRPC.", + "canonical": true, + "file": "prediction_service.streaming_raw_predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingRawPredict", + "fullName": "google.cloud.aiplatform.v1.PredictionService.StreamingRawPredict", + "async": true, + "parameters": [ + { + "name": "endpoint", + "type": "TYPE_STRING" + }, + { + "name": "method_name", + "type": "TYPE_STRING" + }, + { + "name": "input", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.aiplatform.v1.StreamingRawPredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.aiplatform.v1.PredictionServiceClient" + }, + "method": { + "shortName": "StreamingRawPredict", + "fullName": "google.cloud.aiplatform.v1.PredictionService.StreamingRawPredict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.aiplatform.v1.PredictionService" + } + } + } + }, { "regionTag": "aiplatform_v1_generated_PredictionService_Explain_async", "title": "DatasetService explain Sample", diff --git a/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js b/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js new file mode 100644 index 00000000000..65bd1cd66c5 --- /dev/null +++ b/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_predict.js @@ -0,0 +1,71 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(endpoint) { + // [START aiplatform_v1beta1_generated_PredictionService_DirectPredict_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const endpoint = 'abc123' + /** + * The prediction input. + */ + // const inputs = [1,2,3,4] + /** + * The parameters that govern the prediction. + */ + // const parameters = {} + + // Imports the Aiplatform library + const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1beta1; + + // Instantiates a client + const aiplatformClient = new PredictionServiceClient(); + + async function callDirectPredict() { + // Construct request + const request = { + endpoint, + }; + + // Run request + const response = await aiplatformClient.directPredict(request); + console.log(response); + } + + callDirectPredict(); + // [END aiplatform_v1beta1_generated_PredictionService_DirectPredict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js b/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js new file mode 100644 index 00000000000..ab36fb59f42 --- /dev/null +++ b/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.direct_raw_predict.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(endpoint) { + // [START aiplatform_v1beta1_generated_PredictionService_DirectRawPredict_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const endpoint = 'abc123' + /** + * Fully qualified name of the API method being invoked to perform + * predictions. + * Format: + * `/namespace.Service/Method/` + * Example: + * `/tensorflow.serving.PredictionService/Predict` + */ + // const methodName = 'abc123' + /** + * The prediction input. + */ + // const input = Buffer.from('string') + + // Imports the Aiplatform library + const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1beta1; + + // Instantiates a client + const aiplatformClient = new PredictionServiceClient(); + + async function callDirectRawPredict() { + // Construct request + const request = { + endpoint, + }; + + // Run request + const response = await aiplatformClient.directRawPredict(request); + console.log(response); + } + + callDirectRawPredict(); + // [END aiplatform_v1beta1_generated_PredictionService_DirectRawPredict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js b/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js new file mode 100644 index 00000000000..ecd9d293245 --- /dev/null +++ b/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_predict.js @@ -0,0 +1,75 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(endpoint) { + // [START aiplatform_v1beta1_generated_PredictionService_StreamingPredict_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const endpoint = 'abc123' + /** + * The prediction input. + */ + // const inputs = [1,2,3,4] + /** + * The parameters that govern the prediction. + */ + // const parameters = {} + + // Imports the Aiplatform library + const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1beta1; + + // Instantiates a client + const aiplatformClient = new PredictionServiceClient(); + + async function callStreamingPredict() { + // Construct request + const request = { + endpoint, + }; + + // Run request + const stream = await aiplatformClient.streamingPredict(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingPredict(); + // [END aiplatform_v1beta1_generated_PredictionService_StreamingPredict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js b/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js new file mode 100644 index 00000000000..746f0085896 --- /dev/null +++ b/packages/google-cloud-aiplatform/samples/generated/v1beta1/prediction_service.streaming_raw_predict.js @@ -0,0 +1,80 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(endpoint) { + // [START aiplatform_v1beta1_generated_PredictionService_StreamingRawPredict_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + */ + // const endpoint = 'abc123' + /** + * Fully qualified name of the API method being invoked to perform + * predictions. + * Format: + * `/namespace.Service/Method/` + * Example: + * `/tensorflow.serving.PredictionService/Predict` + */ + // const methodName = 'abc123' + /** + * The prediction input. + */ + // const input = Buffer.from('string') + + // Imports the Aiplatform library + const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1beta1; + + // Instantiates a client + const aiplatformClient = new PredictionServiceClient(); + + async function callStreamingRawPredict() { + // Construct request + const request = { + endpoint, + }; + + // Run request + const stream = await aiplatformClient.streamingRawPredict(); + stream.on('data', (response) => { console.log(response) }); + stream.on('error', (err) => { throw(err) }); + stream.on('end', () => { /* API call completed */ }); + stream.write(request); + stream.end(); + } + + callStreamingRawPredict(); + // [END aiplatform_v1beta1_generated_PredictionService_StreamingRawPredict_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-aiplatform/samples/generated/v1beta1/snippet_metadata_google.cloud.aiplatform.v1beta1.json b/packages/google-cloud-aiplatform/samples/generated/v1beta1/snippet_metadata_google.cloud.aiplatform.v1beta1.json index b593eb00ac5..f6df8490c67 100644 --- a/packages/google-cloud-aiplatform/samples/generated/v1beta1/snippet_metadata_google.cloud.aiplatform.v1beta1.json +++ b/packages/google-cloud-aiplatform/samples/generated/v1beta1/snippet_metadata_google.cloud.aiplatform.v1beta1.json @@ -9595,6 +9595,150 @@ } } }, + { + "regionTag": "aiplatform_v1beta1_generated_PredictionService_DirectPredict_async", + "title": "DatasetService directPredict Sample", + "origin": "API_DEFINITION", + "description": " Perform an unary online prediction request for Vertex first-party products and frameworks.", + "canonical": true, + "file": "prediction_service.direct_predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DirectPredict", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService.DirectPredict", + "async": true, + "parameters": [ + { + "name": "endpoint", + "type": "TYPE_STRING" + }, + { + "name": "inputs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parameters", + "type": ".google.cloud.aiplatform.v1beta1.Tensor" + } + ], + "resultType": ".google.cloud.aiplatform.v1beta1.DirectPredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionServiceClient" + }, + "method": { + "shortName": "DirectPredict", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService.DirectPredict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService" + } + } + } + }, + { + "regionTag": "aiplatform_v1beta1_generated_PredictionService_DirectRawPredict_async", + "title": "DatasetService directRawPredict Sample", + "origin": "API_DEFINITION", + "description": " Perform an online prediction request through gRPC.", + "canonical": true, + "file": "prediction_service.direct_raw_predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DirectRawPredict", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredict", + "async": true, + "parameters": [ + { + "name": "endpoint", + "type": "TYPE_STRING" + }, + { + "name": "method_name", + "type": "TYPE_STRING" + }, + { + "name": "input", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.aiplatform.v1beta1.DirectRawPredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionServiceClient" + }, + "method": { + "shortName": "DirectRawPredict", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService" + } + } + } + }, + { + "regionTag": "aiplatform_v1beta1_generated_PredictionService_StreamingPredict_async", + "title": "DatasetService streamingPredict Sample", + "origin": "API_DEFINITION", + "description": " Perform a streaming online prediction request for Vertex first-party products and frameworks.", + "canonical": true, + "file": "prediction_service.streaming_predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingPredict", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict", + "async": true, + "parameters": [ + { + "name": "endpoint", + "type": "TYPE_STRING" + }, + { + "name": "inputs", + "type": "TYPE_MESSAGE[]" + }, + { + "name": "parameters", + "type": ".google.cloud.aiplatform.v1beta1.Tensor" + } + ], + "resultType": ".google.cloud.aiplatform.v1beta1.StreamingPredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionServiceClient" + }, + "method": { + "shortName": "StreamingPredict", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService.StreamingPredict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService" + } + } + } + }, { "regionTag": "aiplatform_v1beta1_generated_PredictionService_ServerStreamingPredict_async", "title": "DatasetService serverStreamingPredict Sample", @@ -9643,6 +9787,54 @@ } } }, + { + "regionTag": "aiplatform_v1beta1_generated_PredictionService_StreamingRawPredict_async", + "title": "DatasetService streamingRawPredict Sample", + "origin": "API_DEFINITION", + "description": " Perform a streaming online prediction request through gRPC.", + "canonical": true, + "file": "prediction_service.streaming_raw_predict.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StreamingRawPredict", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService.StreamingRawPredict", + "async": true, + "parameters": [ + { + "name": "endpoint", + "type": "TYPE_STRING" + }, + { + "name": "method_name", + "type": "TYPE_STRING" + }, + { + "name": "input", + "type": "TYPE_BYTES" + } + ], + "resultType": ".google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse", + "client": { + "shortName": "PredictionServiceClient", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionServiceClient" + }, + "method": { + "shortName": "StreamingRawPredict", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService.StreamingRawPredict", + "service": { + "shortName": "PredictionService", + "fullName": "google.cloud.aiplatform.v1beta1.PredictionService" + } + } + } + }, { "regionTag": "aiplatform_v1beta1_generated_PredictionService_Explain_async", "title": "DatasetService explain Sample", diff --git a/packages/google-cloud-aiplatform/src/v1/gapic_metadata.json b/packages/google-cloud-aiplatform/src/v1/gapic_metadata.json index af835599090..12de4f510fa 100644 --- a/packages/google-cloud-aiplatform/src/v1/gapic_metadata.json +++ b/packages/google-cloud-aiplatform/src/v1/gapic_metadata.json @@ -2315,15 +2315,35 @@ "rawPredict" ] }, + "DirectPredict": { + "methods": [ + "directPredict" + ] + }, + "DirectRawPredict": { + "methods": [ + "directRawPredict" + ] + }, "Explain": { "methods": [ "explain" ] }, + "StreamingPredict": { + "methods": [ + "streamingPredict" + ] + }, "ServerStreamingPredict": { "methods": [ "serverStreamingPredict" ] + }, + "StreamingRawPredict": { + "methods": [ + "streamingRawPredict" + ] } } }, @@ -2340,6 +2360,16 @@ "rawPredict" ] }, + "DirectPredict": { + "methods": [ + "directPredict" + ] + }, + "DirectRawPredict": { + "methods": [ + "directRawPredict" + ] + }, "Explain": { "methods": [ "explain" diff --git a/packages/google-cloud-aiplatform/src/v1/prediction_service_client.ts b/packages/google-cloud-aiplatform/src/v1/prediction_service_client.ts index b700799028a..9c2dad7873e 100644 --- a/packages/google-cloud-aiplatform/src/v1/prediction_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1/prediction_service_client.ts @@ -325,10 +325,18 @@ export class PredictionServiceClient { // Some of the methods on this service provide streaming responses. // Provide descriptors for these. this.descriptors.stream = { + streamingPredict: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback + ), serverStreamingPredict: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback ), + streamingRawPredict: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback + ), }; // Put together the default options sent with requests. @@ -383,7 +391,11 @@ export class PredictionServiceClient { const predictionServiceStubMethods = [ 'predict', 'rawPredict', + 'directPredict', + 'directRawPredict', + 'streamingPredict', 'serverStreamingPredict', + 'streamingRawPredict', 'explain', ]; for (const methodName of predictionServiceStubMethods) { @@ -692,6 +704,205 @@ export class PredictionServiceClient { this.initialize(); return this.innerApiCalls.rawPredict(request, options, callback); } + /** + * Perform an unary online prediction request for Vertex first-party products + * and frameworks. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.endpoint + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + * @param {number[]} request.inputs + * The prediction input. + * @param {google.cloud.aiplatform.v1.Tensor} request.parameters + * The parameters that govern the prediction. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.aiplatform.v1.DirectPredictResponse|DirectPredictResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/prediction_service.direct_predict.js + * region_tag:aiplatform_v1_generated_PredictionService_DirectPredict_async + */ + directPredict( + request?: protos.google.cloud.aiplatform.v1.IDirectPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.aiplatform.v1.IDirectPredictResponse, + protos.google.cloud.aiplatform.v1.IDirectPredictRequest | undefined, + {} | undefined, + ] + >; + directPredict( + request: protos.google.cloud.aiplatform.v1.IDirectPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.aiplatform.v1.IDirectPredictResponse, + | protos.google.cloud.aiplatform.v1.IDirectPredictRequest + | null + | undefined, + {} | null | undefined + > + ): void; + directPredict( + request: protos.google.cloud.aiplatform.v1.IDirectPredictRequest, + callback: Callback< + protos.google.cloud.aiplatform.v1.IDirectPredictResponse, + | protos.google.cloud.aiplatform.v1.IDirectPredictRequest + | null + | undefined, + {} | null | undefined + > + ): void; + directPredict( + request?: protos.google.cloud.aiplatform.v1.IDirectPredictRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.aiplatform.v1.IDirectPredictResponse, + | protos.google.cloud.aiplatform.v1.IDirectPredictRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.aiplatform.v1.IDirectPredictResponse, + | protos.google.cloud.aiplatform.v1.IDirectPredictRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.aiplatform.v1.IDirectPredictResponse, + protos.google.cloud.aiplatform.v1.IDirectPredictRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + endpoint: request.endpoint ?? '', + }); + this.initialize(); + return this.innerApiCalls.directPredict(request, options, callback); + } + /** + * Perform an online prediction request through gRPC. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.endpoint + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + * @param {string} request.methodName + * Fully qualified name of the API method being invoked to perform + * predictions. + * + * Format: + * `/namespace.Service/Method/` + * Example: + * `/tensorflow.serving.PredictionService/Predict` + * @param {Buffer} request.input + * The prediction input. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.aiplatform.v1.DirectRawPredictResponse|DirectRawPredictResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/prediction_service.direct_raw_predict.js + * region_tag:aiplatform_v1_generated_PredictionService_DirectRawPredict_async + */ + directRawPredict( + request?: protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.aiplatform.v1.IDirectRawPredictResponse, + protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest | undefined, + {} | undefined, + ] + >; + directRawPredict( + request: protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.aiplatform.v1.IDirectRawPredictResponse, + | protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest + | null + | undefined, + {} | null | undefined + > + ): void; + directRawPredict( + request: protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest, + callback: Callback< + protos.google.cloud.aiplatform.v1.IDirectRawPredictResponse, + | protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest + | null + | undefined, + {} | null | undefined + > + ): void; + directRawPredict( + request?: protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.aiplatform.v1.IDirectRawPredictResponse, + | protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.aiplatform.v1.IDirectRawPredictResponse, + | protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.aiplatform.v1.IDirectRawPredictResponse, + protos.google.cloud.aiplatform.v1.IDirectRawPredictRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + endpoint: request.endpoint ?? '', + }); + this.initialize(); + return this.innerApiCalls.directRawPredict(request, options, callback); + } /** * Perform an online explanation. * @@ -816,6 +1027,26 @@ export class PredictionServiceClient { return this.innerApiCalls.explain(request, options, callback); } + /** + * Perform a streaming online prediction request for Vertex first-party + * products and frameworks. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.aiplatform.v1.StreamingPredictRequest|StreamingPredictRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.aiplatform.v1.StreamingPredictResponse|StreamingPredictResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/prediction_service.streaming_predict.js + * region_tag:aiplatform_v1_generated_PredictionService_StreamingPredict_async + */ + streamingPredict(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingPredict(null, options); + } + /** * Perform a server-side streaming online prediction request for Vertex * LLM streaming. @@ -855,6 +1086,25 @@ export class PredictionServiceClient { return this.innerApiCalls.serverStreamingPredict(request, options); } + /** + * Perform a streaming online prediction request through gRPC. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.aiplatform.v1.StreamingRawPredictRequest|StreamingRawPredictRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.aiplatform.v1.StreamingRawPredictResponse|StreamingRawPredictResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1/prediction_service.streaming_raw_predict.js + * region_tag:aiplatform_v1_generated_PredictionService_StreamingRawPredict_async + */ + streamingRawPredict(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingRawPredict(null, options); + } + /** * Gets the access control policy for a resource. Returns an empty policy * if the resource exists and does not have a policy set. diff --git a/packages/google-cloud-aiplatform/src/v1/prediction_service_client_config.json b/packages/google-cloud-aiplatform/src/v1/prediction_service_client_config.json index 94aad7f1d0d..6d5314133dc 100644 --- a/packages/google-cloud-aiplatform/src/v1/prediction_service_client_config.json +++ b/packages/google-cloud-aiplatform/src/v1/prediction_service_client_config.json @@ -28,10 +28,26 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "DirectPredict": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DirectRawPredict": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StreamingPredict": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ServerStreamingPredict": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "StreamingRawPredict": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "Explain": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" diff --git a/packages/google-cloud-aiplatform/src/v1beta1/gapic_metadata.json b/packages/google-cloud-aiplatform/src/v1beta1/gapic_metadata.json index 040430e13b7..b9860bb9a07 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/gapic_metadata.json +++ b/packages/google-cloud-aiplatform/src/v1beta1/gapic_metadata.json @@ -2479,6 +2479,16 @@ "rawPredict" ] }, + "DirectPredict": { + "methods": [ + "directPredict" + ] + }, + "DirectRawPredict": { + "methods": [ + "directRawPredict" + ] + }, "Explain": { "methods": [ "explain" @@ -2489,10 +2499,20 @@ "countTokens" ] }, + "StreamingPredict": { + "methods": [ + "streamingPredict" + ] + }, "ServerStreamingPredict": { "methods": [ "serverStreamingPredict" ] + }, + "StreamingRawPredict": { + "methods": [ + "streamingRawPredict" + ] } } }, @@ -2509,6 +2529,16 @@ "rawPredict" ] }, + "DirectPredict": { + "methods": [ + "directPredict" + ] + }, + "DirectRawPredict": { + "methods": [ + "directRawPredict" + ] + }, "Explain": { "methods": [ "explain" diff --git a/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts b/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts index 1ec9035bd4e..2bdb8274e45 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts +++ b/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client.ts @@ -331,10 +331,18 @@ export class PredictionServiceClient { // Some of the methods on this service provide streaming responses. // Provide descriptors for these. this.descriptors.stream = { + streamingPredict: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback + ), serverStreamingPredict: new this._gaxModule.StreamDescriptor( this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback ), + streamingRawPredict: new this._gaxModule.StreamDescriptor( + this._gaxModule.StreamType.BIDI_STREAMING, + !!opts.fallback + ), }; // Put together the default options sent with requests. @@ -390,7 +398,11 @@ export class PredictionServiceClient { const predictionServiceStubMethods = [ 'predict', 'rawPredict', + 'directPredict', + 'directRawPredict', + 'streamingPredict', 'serverStreamingPredict', + 'streamingRawPredict', 'explain', 'countTokens', ]; @@ -709,6 +721,211 @@ export class PredictionServiceClient { this.initialize(); return this.innerApiCalls.rawPredict(request, options, callback); } + /** + * Perform an unary online prediction request for Vertex first-party products + * and frameworks. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.endpoint + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + * @param {number[]} request.inputs + * The prediction input. + * @param {google.cloud.aiplatform.v1beta1.Tensor} request.parameters + * The parameters that govern the prediction. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.aiplatform.v1beta1.DirectPredictResponse|DirectPredictResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/prediction_service.direct_predict.js + * region_tag:aiplatform_v1beta1_generated_PredictionService_DirectPredict_async + */ + directPredict( + request?: protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.aiplatform.v1beta1.IDirectPredictResponse, + protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest | undefined, + {} | undefined, + ] + >; + directPredict( + request: protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.aiplatform.v1beta1.IDirectPredictResponse, + | protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest + | null + | undefined, + {} | null | undefined + > + ): void; + directPredict( + request: protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest, + callback: Callback< + protos.google.cloud.aiplatform.v1beta1.IDirectPredictResponse, + | protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest + | null + | undefined, + {} | null | undefined + > + ): void; + directPredict( + request?: protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.aiplatform.v1beta1.IDirectPredictResponse, + | protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.aiplatform.v1beta1.IDirectPredictResponse, + | protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.aiplatform.v1beta1.IDirectPredictResponse, + protos.google.cloud.aiplatform.v1beta1.IDirectPredictRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + endpoint: request.endpoint ?? '', + }); + this.initialize(); + return this.innerApiCalls.directPredict(request, options, callback); + } + /** + * Perform an online prediction request through gRPC. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.endpoint + * Required. The name of the Endpoint requested to serve the prediction. + * Format: + * `projects/{project}/locations/{location}/endpoints/{endpoint}` + * @param {string} request.methodName + * Fully qualified name of the API method being invoked to perform + * predictions. + * + * Format: + * `/namespace.Service/Method/` + * Example: + * `/tensorflow.serving.PredictionService/Predict` + * @param {Buffer} request.input + * The prediction input. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse|DirectRawPredictResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/prediction_service.direct_raw_predict.js + * region_tag:aiplatform_v1beta1_generated_PredictionService_DirectRawPredict_async + */ + directRawPredict( + request?: protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest, + options?: CallOptions + ): Promise< + [ + protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse, + ( + | protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest + | undefined + ), + {} | undefined, + ] + >; + directRawPredict( + request: protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse, + | protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest + | null + | undefined, + {} | null | undefined + > + ): void; + directRawPredict( + request: protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest, + callback: Callback< + protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse, + | protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest + | null + | undefined, + {} | null | undefined + > + ): void; + directRawPredict( + request?: protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse, + | protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse, + | protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest + | null + | undefined, + {} | null | undefined + > + ): Promise< + [ + protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse, + ( + | protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + endpoint: request.endpoint ?? '', + }); + this.initialize(); + return this.innerApiCalls.directRawPredict(request, options, callback); + } /** * Perform an online explanation. * @@ -939,6 +1156,26 @@ export class PredictionServiceClient { return this.innerApiCalls.countTokens(request, options, callback); } + /** + * Perform a streaming online prediction request for Vertex first-party + * products and frameworks. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.aiplatform.v1beta1.StreamingPredictRequest|StreamingPredictRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.aiplatform.v1beta1.StreamingPredictResponse|StreamingPredictResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/prediction_service.streaming_predict.js + * region_tag:aiplatform_v1beta1_generated_PredictionService_StreamingPredict_async + */ + streamingPredict(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingPredict(null, options); + } + /** * Perform a server-side streaming online prediction request for Vertex * LLM streaming. @@ -978,6 +1215,25 @@ export class PredictionServiceClient { return this.innerApiCalls.serverStreamingPredict(request, options); } + /** + * Perform a streaming online prediction request through gRPC. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest|StreamingRawPredictRequest} for write() method, and + * will emit objects representing {@link protos.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse|StreamingRawPredictResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta1/prediction_service.streaming_raw_predict.js + * region_tag:aiplatform_v1beta1_generated_PredictionService_StreamingRawPredict_async + */ + streamingRawPredict(options?: CallOptions): gax.CancellableStream { + this.initialize(); + return this.innerApiCalls.streamingRawPredict(null, options); + } + /** * Gets the access control policy for a resource. Returns an empty policy * if the resource exists and does not have a policy set. diff --git a/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client_config.json b/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client_config.json index 29e19cbf23c..69eab56211b 100644 --- a/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client_config.json +++ b/packages/google-cloud-aiplatform/src/v1beta1/prediction_service_client_config.json @@ -29,10 +29,26 @@ "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "DirectPredict": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DirectRawPredict": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StreamingPredict": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "ServerStreamingPredict": { "retry_codes_name": "non_idempotent", "retry_params_name": "default" }, + "StreamingRawPredict": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, "Explain": { "timeout_millis": 5000, "retry_codes_name": "non_idempotent", diff --git a/packages/google-cloud-aiplatform/test/gapic_job_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_job_service_v1.ts index bc8983e56fc..bde1d33f82c 100644 --- a/packages/google-cloud-aiplatform/test/gapic_job_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_job_service_v1.ts @@ -2418,9 +2418,8 @@ describe('v1.JobServiceClient', () => { ); client.innerApiCalls.createModelDeploymentMonitoringJob = stubSimpleCall(expectedResponse); - const [response] = await client.createModelDeploymentMonitoringJob( - request - ); + const [response] = + await client.createModelDeploymentMonitoringJob(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.createModelDeploymentMonitoringJob as SinonStub @@ -2694,9 +2693,8 @@ describe('v1.JobServiceClient', () => { ); client.innerApiCalls.pauseModelDeploymentMonitoringJob = stubSimpleCall(expectedResponse); - const [response] = await client.pauseModelDeploymentMonitoringJob( - request - ); + const [response] = + await client.pauseModelDeploymentMonitoringJob(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.pauseModelDeploymentMonitoringJob as SinonStub @@ -2833,9 +2831,8 @@ describe('v1.JobServiceClient', () => { ); client.innerApiCalls.resumeModelDeploymentMonitoringJob = stubSimpleCall(expectedResponse); - const [response] = await client.resumeModelDeploymentMonitoringJob( - request - ); + const [response] = + await client.resumeModelDeploymentMonitoringJob(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.resumeModelDeploymentMonitoringJob as SinonStub @@ -3950,9 +3947,8 @@ describe('v1.JobServiceClient', () => { ); client.innerApiCalls.updateModelDeploymentMonitoringJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateModelDeploymentMonitoringJob( - request - ); + const [operation] = + await client.updateModelDeploymentMonitoringJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( @@ -4072,9 +4068,8 @@ describe('v1.JobServiceClient', () => { const expectedError = new Error('expected'); client.innerApiCalls.updateModelDeploymentMonitoringJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateModelDeploymentMonitoringJob( - request - ); + const [operation] = + await client.updateModelDeploymentMonitoringJob(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( client.innerApiCalls.updateModelDeploymentMonitoringJob as SinonStub @@ -4150,9 +4145,8 @@ describe('v1.JobServiceClient', () => { ); client.innerApiCalls.deleteModelDeploymentMonitoringJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteModelDeploymentMonitoringJob( - request - ); + const [operation] = + await client.deleteModelDeploymentMonitoringJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( @@ -4269,9 +4263,8 @@ describe('v1.JobServiceClient', () => { const expectedError = new Error('expected'); client.innerApiCalls.deleteModelDeploymentMonitoringJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteModelDeploymentMonitoringJob( - request - ); + const [operation] = + await client.deleteModelDeploymentMonitoringJob(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( client.innerApiCalls.deleteModelDeploymentMonitoringJob as SinonStub @@ -6738,9 +6731,8 @@ describe('v1.JobServiceClient', () => { ]; client.innerApiCalls.listModelDeploymentMonitoringJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listModelDeploymentMonitoringJobs( - request - ); + const [response] = + await client.listModelDeploymentMonitoringJobs(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.listModelDeploymentMonitoringJobs as SinonStub diff --git a/packages/google-cloud-aiplatform/test/gapic_job_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_job_service_v1beta1.ts index 7496f5f262c..08b61233fda 100644 --- a/packages/google-cloud-aiplatform/test/gapic_job_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_job_service_v1beta1.ts @@ -2418,9 +2418,8 @@ describe('v1beta1.JobServiceClient', () => { ); client.innerApiCalls.createModelDeploymentMonitoringJob = stubSimpleCall(expectedResponse); - const [response] = await client.createModelDeploymentMonitoringJob( - request - ); + const [response] = + await client.createModelDeploymentMonitoringJob(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.createModelDeploymentMonitoringJob as SinonStub @@ -2694,9 +2693,8 @@ describe('v1beta1.JobServiceClient', () => { ); client.innerApiCalls.pauseModelDeploymentMonitoringJob = stubSimpleCall(expectedResponse); - const [response] = await client.pauseModelDeploymentMonitoringJob( - request - ); + const [response] = + await client.pauseModelDeploymentMonitoringJob(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.pauseModelDeploymentMonitoringJob as SinonStub @@ -2833,9 +2831,8 @@ describe('v1beta1.JobServiceClient', () => { ); client.innerApiCalls.resumeModelDeploymentMonitoringJob = stubSimpleCall(expectedResponse); - const [response] = await client.resumeModelDeploymentMonitoringJob( - request - ); + const [response] = + await client.resumeModelDeploymentMonitoringJob(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.resumeModelDeploymentMonitoringJob as SinonStub @@ -3950,9 +3947,8 @@ describe('v1beta1.JobServiceClient', () => { ); client.innerApiCalls.updateModelDeploymentMonitoringJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateModelDeploymentMonitoringJob( - request - ); + const [operation] = + await client.updateModelDeploymentMonitoringJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( @@ -4072,9 +4068,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedError = new Error('expected'); client.innerApiCalls.updateModelDeploymentMonitoringJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateModelDeploymentMonitoringJob( - request - ); + const [operation] = + await client.updateModelDeploymentMonitoringJob(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( client.innerApiCalls.updateModelDeploymentMonitoringJob as SinonStub @@ -4150,9 +4145,8 @@ describe('v1beta1.JobServiceClient', () => { ); client.innerApiCalls.deleteModelDeploymentMonitoringJob = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteModelDeploymentMonitoringJob( - request - ); + const [operation] = + await client.deleteModelDeploymentMonitoringJob(request); const [response] = await operation.promise(); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( @@ -4269,9 +4263,8 @@ describe('v1beta1.JobServiceClient', () => { const expectedError = new Error('expected'); client.innerApiCalls.deleteModelDeploymentMonitoringJob = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteModelDeploymentMonitoringJob( - request - ); + const [operation] = + await client.deleteModelDeploymentMonitoringJob(request); await assert.rejects(operation.promise(), expectedError); const actualRequest = ( client.innerApiCalls.deleteModelDeploymentMonitoringJob as SinonStub @@ -6778,9 +6771,8 @@ describe('v1beta1.JobServiceClient', () => { ]; client.innerApiCalls.listModelDeploymentMonitoringJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listModelDeploymentMonitoringJobs( - request - ); + const [response] = + await client.listModelDeploymentMonitoringJobs(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.listModelDeploymentMonitoringJobs as SinonStub diff --git a/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1.ts index 3cdc0809b9d..66adcd738d2 100644 --- a/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1.ts @@ -87,6 +87,20 @@ function stubServerStreamingCall( return sinon.stub().returns(mockStream); } +function stubBidiStreamingCall( + response?: ResponseType, + error?: Error +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + function stubAsyncIterationCall( responses?: ResponseType[], error?: Error @@ -464,6 +478,266 @@ describe('v1.PredictionServiceClient', () => { }); }); + describe('directPredict', () => { + it('invokes directPredict without error', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1.DirectPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectPredictResponse() + ); + client.innerApiCalls.directPredict = stubSimpleCall(expectedResponse); + const [response] = await client.directPredict(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directPredict without error using callback', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1.DirectPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectPredictResponse() + ); + client.innerApiCalls.directPredict = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.directPredict( + request, + ( + err?: Error | null, + result?: protos.google.cloud.aiplatform.v1.IDirectPredictResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directPredict with error', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1.DirectPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.directPredict = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.directPredict(request), expectedError); + const actualRequest = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directPredict with closed client', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1.DirectPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.directPredict(request), expectedError); + }); + }); + + describe('directRawPredict', () => { + it('invokes directRawPredict without error', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectRawPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1.DirectRawPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectRawPredictResponse() + ); + client.innerApiCalls.directRawPredict = stubSimpleCall(expectedResponse); + const [response] = await client.directRawPredict(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directRawPredict without error using callback', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectRawPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1.DirectRawPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectRawPredictResponse() + ); + client.innerApiCalls.directRawPredict = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.directRawPredict( + request, + ( + err?: Error | null, + result?: protos.google.cloud.aiplatform.v1.IDirectRawPredictResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directRawPredict with error', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectRawPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1.DirectRawPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.directRawPredict = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.directRawPredict(request), expectedError); + const actualRequest = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directRawPredict with closed client', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.DirectRawPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1.DirectRawPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.directRawPredict(request), expectedError); + }); + }); + describe('explain', () => { it('invokes explain without error', async () => { const client = new predictionserviceModule.v1.PredictionServiceClient({ @@ -718,6 +992,186 @@ describe('v1.PredictionServiceClient', () => { await assert.rejects(promise, expectedError); }); }); + + describe('streamingPredict', () => { + it('invokes streamingPredict without error', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.StreamingPredictRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.StreamingPredictResponse() + ); + client.innerApiCalls.streamingPredict = + stubBidiStreamingCall(expectedResponse); + const stream = client.streamingPredict(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.aiplatform.v1.StreamingPredictResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingPredict as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + + it('invokes streamingPredict with error', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.StreamingPredictRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingPredict = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingPredict(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.aiplatform.v1.StreamingPredictResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingPredict as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + }); + + describe('streamingRawPredict', () => { + it('invokes streamingRawPredict without error', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.StreamingRawPredictRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.StreamingRawPredictResponse() + ); + client.innerApiCalls.streamingRawPredict = + stubBidiStreamingCall(expectedResponse); + const stream = client.streamingRawPredict(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.aiplatform.v1.StreamingRawPredictResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingRawPredict as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + + it('invokes streamingRawPredict with error', async () => { + const client = new predictionserviceModule.v1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1.StreamingRawPredictRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingRawPredict = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingRawPredict(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.aiplatform.v1.StreamingRawPredictResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingRawPredict as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + }); describe('getIamPolicy', () => { it('invokes getIamPolicy without error', async () => { const client = new predictionserviceModule.v1.PredictionServiceClient({ diff --git a/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1beta1.ts index ee8171e8194..377ebefe423 100644 --- a/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_prediction_service_v1beta1.ts @@ -87,6 +87,20 @@ function stubServerStreamingCall( return sinon.stub().returns(mockStream); } +function stubBidiStreamingCall( + response?: ResponseType, + error?: Error +) { + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + return sinon.stub().returns(mockStream); +} + function stubAsyncIterationCall( responses?: ResponseType[], error?: Error @@ -479,6 +493,274 @@ describe('v1beta1.PredictionServiceClient', () => { }); }); + describe('directPredict', () => { + it('invokes directPredict without error', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1beta1.DirectPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectPredictResponse() + ); + client.innerApiCalls.directPredict = stubSimpleCall(expectedResponse); + const [response] = await client.directPredict(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directPredict without error using callback', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1beta1.DirectPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectPredictResponse() + ); + client.innerApiCalls.directPredict = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.directPredict( + request, + ( + err?: Error | null, + result?: protos.google.cloud.aiplatform.v1beta1.IDirectPredictResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directPredict with error', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1beta1.DirectPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.directPredict = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.directPredict(request), expectedError); + const actualRequest = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directPredict with closed client', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1beta1.DirectPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.directPredict(request), expectedError); + }); + }); + + describe('directRawPredict', () => { + it('invokes directRawPredict without error', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse() + ); + client.innerApiCalls.directRawPredict = stubSimpleCall(expectedResponse); + const [response] = await client.directRawPredict(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directRawPredict without error using callback', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse() + ); + client.innerApiCalls.directRawPredict = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.directRawPredict( + request, + ( + err?: Error | null, + result?: protos.google.cloud.aiplatform.v1beta1.IDirectRawPredictResponse | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + } + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directRawPredict with error', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedHeaderRequestParams = `endpoint=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.directRawPredict = stubSimpleCall( + undefined, + expectedError + ); + await assert.rejects(client.directRawPredict(request), expectedError); + const actualRequest = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.directRawPredict as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes directRawPredict with closed client', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest() + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest', + ['endpoint'] + ); + request.endpoint = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.directRawPredict(request), expectedError); + }); + }); + describe('explain', () => { it('invokes explain without error', async () => { const client = @@ -874,6 +1156,190 @@ describe('v1beta1.PredictionServiceClient', () => { await assert.rejects(promise, expectedError); }); }); + + describe('streamingPredict', () => { + it('invokes streamingPredict without error', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.StreamingPredictRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.StreamingPredictResponse() + ); + client.innerApiCalls.streamingPredict = + stubBidiStreamingCall(expectedResponse); + const stream = client.streamingPredict(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.aiplatform.v1beta1.StreamingPredictResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingPredict as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + + it('invokes streamingPredict with error', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.StreamingPredictRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingPredict = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingPredict(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.aiplatform.v1beta1.StreamingPredictResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingPredict as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + }); + + describe('streamingRawPredict', () => { + it('invokes streamingRawPredict without error', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest() + ); + + const expectedResponse = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse() + ); + client.innerApiCalls.streamingRawPredict = + stubBidiStreamingCall(expectedResponse); + const stream = client.streamingRawPredict(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert( + (client.innerApiCalls.streamingRawPredict as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + + it('invokes streamingRawPredict with error', async () => { + const client = + new predictionserviceModule.v1beta1.PredictionServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest() + ); + const expectedError = new Error('expected'); + client.innerApiCalls.streamingRawPredict = stubBidiStreamingCall( + undefined, + expectedError + ); + const stream = client.streamingRawPredict(); + const promise = new Promise((resolve, reject) => { + stream.on( + 'data', + ( + response: protos.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + ) => { + resolve(response); + } + ); + stream.on('error', (err: Error) => { + reject(err); + }); + stream.write(request); + stream.end(); + }); + await assert.rejects(promise, expectedError); + assert( + (client.innerApiCalls.streamingRawPredict as SinonStub) + .getCall(0) + .calledWith(null) + ); + assert.deepStrictEqual( + ((stream as unknown as PassThrough)._transform as SinonStub).getCall(0) + .args[0], + request + ); + }); + }); describe('getIamPolicy', () => { it('invokes getIamPolicy without error', async () => { const client = diff --git a/packages/google-cloud-aiplatform/test/gapic_tensorboard_service_v1.ts b/packages/google-cloud-aiplatform/test/gapic_tensorboard_service_v1.ts index ae2b53fdd21..1fe3c87ca12 100644 --- a/packages/google-cloud-aiplatform/test/gapic_tensorboard_service_v1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_tensorboard_service_v1.ts @@ -2199,9 +2199,8 @@ describe('v1.TensorboardServiceClient', () => { ); client.innerApiCalls.batchReadTensorboardTimeSeriesData = stubSimpleCall(expectedResponse); - const [response] = await client.batchReadTensorboardTimeSeriesData( - request - ); + const [response] = + await client.batchReadTensorboardTimeSeriesData(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.batchReadTensorboardTimeSeriesData as SinonStub diff --git a/packages/google-cloud-aiplatform/test/gapic_tensorboard_service_v1beta1.ts b/packages/google-cloud-aiplatform/test/gapic_tensorboard_service_v1beta1.ts index bec0088c6c4..96fd824a547 100644 --- a/packages/google-cloud-aiplatform/test/gapic_tensorboard_service_v1beta1.ts +++ b/packages/google-cloud-aiplatform/test/gapic_tensorboard_service_v1beta1.ts @@ -2264,9 +2264,8 @@ describe('v1beta1.TensorboardServiceClient', () => { ); client.innerApiCalls.batchReadTensorboardTimeSeriesData = stubSimpleCall(expectedResponse); - const [response] = await client.batchReadTensorboardTimeSeriesData( - request - ); + const [response] = + await client.batchReadTensorboardTimeSeriesData(request); assert.deepStrictEqual(response, expectedResponse); const actualRequest = ( client.innerApiCalls.batchReadTensorboardTimeSeriesData as SinonStub