From eeb510862b36a32523b385deda0b7a5207d052b6 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 30 Nov 2023 11:18:35 -0500 Subject: [PATCH] feat: [aiplatform] add grpc_ports to UploadModel ModelContainerSpec (#10091) 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: 586417186 Source-Link: https://github.com/googleapis/googleapis/commit/362f61ee4a0178ca1e3fe2be4c34cd9d4acd2e12 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a81e5343ce6ca9ee4a545549dc32edc2350530aa Copy-Tag: eyJwIjoiamF2YS1haXBsYXRmb3JtLy5Pd2xCb3QueWFtbCIsImgiOiJhODFlNTM0M2NlNmNhOWVlNGE1NDU1NDlkYzMyZWRjMjM1MDUzMGFhIn0= * 🦉 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 --- .../v1beta1/PredictionServiceClient.java | 206 +++ .../v1beta1/PredictionServiceSettings.java | 48 + .../aiplatform/v1beta1/gapic_metadata.json | 12 + .../stub/GrpcPredictionServiceStub.java | 129 ++ .../v1beta1/stub/PredictionServiceStub.java | 26 + .../stub/PredictionServiceStubSettings.java | 97 ++ .../reflect-config.json | 108 ++ .../v1beta1/MockPredictionServiceImpl.java | 116 ++ .../v1beta1/PredictionServiceClientTest.java | 236 +++ .../v1beta1/PredictionServiceGrpc.java | 449 +++++- .../v1beta1/DirectPredictRequest.java | 1413 +++++++++++++++++ .../DirectPredictRequestOrBuilder.java | 145 ++ .../v1beta1/DirectPredictResponse.java | 1203 ++++++++++++++ .../DirectPredictResponseOrBuilder.java | 112 ++ .../v1beta1/DirectRawPredictRequest.java | 975 ++++++++++++ .../DirectRawPredictRequestOrBuilder.java | 108 ++ .../v1beta1/DirectRawPredictResponse.java | 545 +++++++ .../DirectRawPredictResponseOrBuilder.java | 38 + .../v1beta1/ModelContainerSpec.java | 780 ++++++++- .../v1beta1/ModelContainerSpecOrBuilder.java | 102 ++ .../cloud/aiplatform/v1beta1/ModelProto.java | 53 +- .../v1beta1/PredictionServiceProto.java | 284 +++- .../v1beta1/StreamingRawPredictRequest.java | 1003 ++++++++++++ .../StreamingRawPredictRequestOrBuilder.java | 108 ++ .../v1beta1/StreamingRawPredictResponse.java | 548 +++++++ .../StreamingRawPredictResponseOrBuilder.java | 38 + .../cloud/aiplatform/v1beta1/model.proto | 11 + .../v1beta1/prediction_service.proto | 134 ++ .../directpredict/AsyncDirectPredict.java | 57 + .../directpredict/SyncDirectPredict.java | 53 + .../AsyncDirectRawPredict.java | 56 + .../SyncDirectRawPredict.java | 52 + .../AsyncStreamingPredict.java | 59 + .../AsyncStreamingRawPredict.java | 58 + 34 files changed, 9215 insertions(+), 147 deletions(-) create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictRequest.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictRequestOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictResponse.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictResponseOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictRequest.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictRequestOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictResponse.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictResponseOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictRequest.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictRequestOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictResponse.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictResponseOrBuilder.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directpredict/AsyncDirectPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directpredict/SyncDirectPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directrawpredict/AsyncDirectRawPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directrawpredict/SyncDirectRawPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/streamingpredict/AsyncStreamingPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/streamingrawpredict/AsyncStreamingRawPredict.java diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClient.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClient.java index f4ff0acbc548..2b9a2c392508 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClient.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClient.java @@ -24,6 +24,7 @@ import com.google.api.gax.paging.AbstractFixedSizeCollection; import com.google.api.gax.paging.AbstractPage; import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; @@ -544,6 +545,175 @@ public final UnaryCallable rawPredictCallable() { return stub.rawPredictCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Perform an unary online prediction request for Vertex first-party products and frameworks. + * + *

Sample code: + * + *

{@code
+   * // 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.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   DirectPredictRequest request =
+   *       DirectPredictRequest.newBuilder()
+   *           .setEndpoint(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .addAllInputs(new ArrayList())
+   *           .setParameters(Tensor.newBuilder().build())
+   *           .build();
+   *   DirectPredictResponse response = predictionServiceClient.directPredict(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DirectPredictResponse directPredict(DirectPredictRequest request) { + return directPredictCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Perform an unary online prediction request for Vertex first-party products and frameworks. + * + *

Sample code: + * + *

{@code
+   * // 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.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   DirectPredictRequest request =
+   *       DirectPredictRequest.newBuilder()
+   *           .setEndpoint(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .addAllInputs(new ArrayList())
+   *           .setParameters(Tensor.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       predictionServiceClient.directPredictCallable().futureCall(request);
+   *   // Do something.
+   *   DirectPredictResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable directPredictCallable() { + return stub.directPredictCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Perform an online prediction request through gRPC. + * + *

Sample code: + * + *

{@code
+   * // 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.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   DirectRawPredictRequest request =
+   *       DirectRawPredictRequest.newBuilder()
+   *           .setEndpoint(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .setMethodName("methodName-723163380")
+   *           .setInput(ByteString.EMPTY)
+   *           .build();
+   *   DirectRawPredictResponse response = predictionServiceClient.directRawPredict(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final DirectRawPredictResponse directRawPredict(DirectRawPredictRequest request) { + return directRawPredictCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Perform an online prediction request through gRPC. + * + *

Sample code: + * + *

{@code
+   * // 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.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   DirectRawPredictRequest request =
+   *       DirectRawPredictRequest.newBuilder()
+   *           .setEndpoint(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .setMethodName("methodName-723163380")
+   *           .setInput(ByteString.EMPTY)
+   *           .build();
+   *   ApiFuture future =
+   *       predictionServiceClient.directRawPredictCallable().futureCall(request);
+   *   // Do something.
+   *   DirectRawPredictResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + directRawPredictCallable() { + return stub.directRawPredictCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Perform a streaming online prediction request for Vertex first-party products and frameworks. + * + *

Sample code: + * + *

{@code
+   * // 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.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   BidiStream bidiStream =
+   *       predictionServiceClient.streamingPredictCallable().call();
+   *   StreamingPredictRequest request =
+   *       StreamingPredictRequest.newBuilder()
+   *           .setEndpoint(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .addAllInputs(new ArrayList())
+   *           .setParameters(Tensor.newBuilder().build())
+   *           .build();
+   *   bidiStream.send(request);
+   *   for (StreamingPredictResponse response : bidiStream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
+ */ + public final BidiStreamingCallable + streamingPredictCallable() { + return stub.streamingPredictCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Perform a server-side streaming online prediction request for Vertex LLM streaming. @@ -579,6 +749,42 @@ public final UnaryCallable rawPredictCallable() { return stub.serverStreamingPredictCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Perform a streaming online prediction request through gRPC. + * + *

Sample code: + * + *

{@code
+   * // 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.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
+   *   BidiStream bidiStream =
+   *       predictionServiceClient.streamingRawPredictCallable().call();
+   *   StreamingRawPredictRequest request =
+   *       StreamingRawPredictRequest.newBuilder()
+   *           .setEndpoint(
+   *               EndpointName.ofProjectLocationEndpointName(
+   *                       "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
+   *                   .toString())
+   *           .setMethodName("methodName-723163380")
+   *           .setInput(ByteString.EMPTY)
+   *           .build();
+   *   bidiStream.send(request);
+   *   for (StreamingRawPredictResponse response : bidiStream) {
+   *     // Do something when a response is received.
+   *   }
+   * }
+   * }
+ */ + public final BidiStreamingCallable + streamingRawPredictCallable() { + return stub.streamingRawPredictCallable(); + } + // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Perform an online explanation. diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceSettings.java index f4b1f200ae23..b651ac955a4b 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceSettings.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceSettings.java @@ -29,6 +29,7 @@ import com.google.api.gax.rpc.ClientSettings; import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.cloud.aiplatform.v1beta1.stub.PredictionServiceStubSettings; @@ -96,12 +97,35 @@ public UnaryCallSettings rawPredictSettings() { return ((PredictionServiceStubSettings) getStubSettings()).rawPredictSettings(); } + /** Returns the object with the settings used for calls to directPredict. */ + public UnaryCallSettings directPredictSettings() { + return ((PredictionServiceStubSettings) getStubSettings()).directPredictSettings(); + } + + /** Returns the object with the settings used for calls to directRawPredict. */ + public UnaryCallSettings + directRawPredictSettings() { + return ((PredictionServiceStubSettings) getStubSettings()).directRawPredictSettings(); + } + + /** Returns the object with the settings used for calls to streamingPredict. */ + public StreamingCallSettings + streamingPredictSettings() { + return ((PredictionServiceStubSettings) getStubSettings()).streamingPredictSettings(); + } + /** Returns the object with the settings used for calls to serverStreamingPredict. */ public ServerStreamingCallSettings serverStreamingPredictSettings() { return ((PredictionServiceStubSettings) getStubSettings()).serverStreamingPredictSettings(); } + /** Returns the object with the settings used for calls to streamingRawPredict. */ + public StreamingCallSettings + streamingRawPredictSettings() { + return ((PredictionServiceStubSettings) getStubSettings()).streamingRawPredictSettings(); + } + /** Returns the object with the settings used for calls to explain. */ public UnaryCallSettings explainSettings() { return ((PredictionServiceStubSettings) getStubSettings()).explainSettings(); @@ -246,12 +270,36 @@ public UnaryCallSettings.Builder rawPredictSettings return getStubSettingsBuilder().rawPredictSettings(); } + /** Returns the builder for the settings used for calls to directPredict. */ + public UnaryCallSettings.Builder + directPredictSettings() { + return getStubSettingsBuilder().directPredictSettings(); + } + + /** Returns the builder for the settings used for calls to directRawPredict. */ + public UnaryCallSettings.Builder + directRawPredictSettings() { + return getStubSettingsBuilder().directRawPredictSettings(); + } + + /** Returns the builder for the settings used for calls to streamingPredict. */ + public StreamingCallSettings.Builder + streamingPredictSettings() { + return getStubSettingsBuilder().streamingPredictSettings(); + } + /** Returns the builder for the settings used for calls to serverStreamingPredict. */ public ServerStreamingCallSettings.Builder serverStreamingPredictSettings() { return getStubSettingsBuilder().serverStreamingPredictSettings(); } + /** Returns the builder for the settings used for calls to streamingRawPredict. */ + public StreamingCallSettings.Builder + streamingRawPredictSettings() { + return getStubSettingsBuilder().streamingRawPredictSettings(); + } + /** Returns the builder for the settings used for calls to explain. */ public UnaryCallSettings.Builder explainSettings() { return getStubSettingsBuilder().explainSettings(); diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/gapic_metadata.json b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/gapic_metadata.json index 3c97b88b819f..5b30ed6166ea 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/gapic_metadata.json +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/gapic_metadata.json @@ -1078,6 +1078,12 @@ "CountTokens": { "methods": ["countTokens", "countTokens", "countTokens", "countTokensCallable"] }, + "DirectPredict": { + "methods": ["directPredict", "directPredictCallable"] + }, + "DirectRawPredict": { + "methods": ["directRawPredict", "directRawPredictCallable"] + }, "Explain": { "methods": ["explain", "explain", "explain", "explainCallable"] }, @@ -1102,6 +1108,12 @@ "SetIamPolicy": { "methods": ["setIamPolicy", "setIamPolicyCallable"] }, + "StreamingPredict": { + "methods": ["streamingPredictCallable"] + }, + "StreamingRawPredict": { + "methods": ["streamingRawPredictCallable"] + }, "TestIamPermissions": { "methods": ["testIamPermissions", "testIamPermissionsCallable"] } diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/GrpcPredictionServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/GrpcPredictionServiceStub.java index 3643d05aeb31..9ae55b3a642c 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/GrpcPredictionServiceStub.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/GrpcPredictionServiceStub.java @@ -24,12 +24,17 @@ import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.RequestParamsBuilder; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1beta1.CountTokensRequest; import com.google.cloud.aiplatform.v1beta1.CountTokensResponse; +import com.google.cloud.aiplatform.v1beta1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; import com.google.cloud.aiplatform.v1beta1.ExplainRequest; import com.google.cloud.aiplatform.v1beta1.ExplainResponse; import com.google.cloud.aiplatform.v1beta1.PredictRequest; @@ -37,6 +42,8 @@ import com.google.cloud.aiplatform.v1beta1.RawPredictRequest; import com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest; import com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -78,6 +85,41 @@ public class GrpcPredictionServiceStub extends PredictionServiceStub { .setResponseMarshaller(ProtoUtils.marshaller(HttpBody.getDefaultInstance())) .build(); + private static final MethodDescriptor + directPredictMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.aiplatform.v1beta1.PredictionService/DirectPredict") + .setRequestMarshaller( + ProtoUtils.marshaller(DirectPredictRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(DirectPredictResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + directRawPredictMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.aiplatform.v1beta1.PredictionService/DirectRawPredict") + .setRequestMarshaller( + ProtoUtils.marshaller(DirectRawPredictRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(DirectRawPredictResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + streamingPredictMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName( + "google.cloud.aiplatform.v1beta1.PredictionService/StreamingPredict") + .setRequestMarshaller( + ProtoUtils.marshaller(StreamingPredictRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(StreamingPredictResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor serverStreamingPredictMethodDescriptor = MethodDescriptor.newBuilder() @@ -90,6 +132,18 @@ public class GrpcPredictionServiceStub extends PredictionServiceStub { ProtoUtils.marshaller(StreamingPredictResponse.getDefaultInstance())) .build(); + private static final MethodDescriptor + streamingRawPredictMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName( + "google.cloud.aiplatform.v1beta1.PredictionService/StreamingRawPredict") + .setRequestMarshaller( + ProtoUtils.marshaller(StreamingRawPredictRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(StreamingRawPredictResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor explainMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -156,8 +210,15 @@ public class GrpcPredictionServiceStub extends PredictionServiceStub { private final UnaryCallable predictCallable; private final UnaryCallable rawPredictCallable; + private final UnaryCallable directPredictCallable; + private final UnaryCallable + directRawPredictCallable; + private final BidiStreamingCallable + streamingPredictCallable; private final ServerStreamingCallable serverStreamingPredictCallable; + private final BidiStreamingCallable + streamingRawPredictCallable; private final UnaryCallable explainCallable; private final UnaryCallable countTokensCallable; private final UnaryCallable listLocationsCallable; @@ -233,6 +294,32 @@ protected GrpcPredictionServiceStub( return builder.build(); }) .build(); + GrpcCallSettings directPredictTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(directPredictMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("endpoint", String.valueOf(request.getEndpoint())); + return builder.build(); + }) + .build(); + GrpcCallSettings + directRawPredictTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(directRawPredictMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add("endpoint", String.valueOf(request.getEndpoint())); + return builder.build(); + }) + .build(); + GrpcCallSettings + streamingPredictTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(streamingPredictMethodDescriptor) + .build(); GrpcCallSettings serverStreamingPredictTransportSettings = GrpcCallSettings.newBuilder() @@ -244,6 +331,11 @@ protected GrpcPredictionServiceStub( return builder.build(); }) .build(); + GrpcCallSettings + streamingRawPredictTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(streamingRawPredictMethodDescriptor) + .build(); GrpcCallSettings explainTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(explainMethodDescriptor) @@ -322,11 +414,25 @@ protected GrpcPredictionServiceStub( this.rawPredictCallable = callableFactory.createUnaryCallable( rawPredictTransportSettings, settings.rawPredictSettings(), clientContext); + this.directPredictCallable = + callableFactory.createUnaryCallable( + directPredictTransportSettings, settings.directPredictSettings(), clientContext); + this.directRawPredictCallable = + callableFactory.createUnaryCallable( + directRawPredictTransportSettings, settings.directRawPredictSettings(), clientContext); + this.streamingPredictCallable = + callableFactory.createBidiStreamingCallable( + streamingPredictTransportSettings, settings.streamingPredictSettings(), clientContext); this.serverStreamingPredictCallable = callableFactory.createServerStreamingCallable( serverStreamingPredictTransportSettings, settings.serverStreamingPredictSettings(), clientContext); + this.streamingRawPredictCallable = + callableFactory.createBidiStreamingCallable( + streamingRawPredictTransportSettings, + settings.streamingRawPredictSettings(), + clientContext); this.explainCallable = callableFactory.createUnaryCallable( explainTransportSettings, settings.explainSettings(), clientContext); @@ -372,12 +478,35 @@ public UnaryCallable rawPredictCallable() { return rawPredictCallable; } + @Override + public UnaryCallable directPredictCallable() { + return directPredictCallable; + } + + @Override + public UnaryCallable + directRawPredictCallable() { + return directRawPredictCallable; + } + + @Override + public BidiStreamingCallable + streamingPredictCallable() { + return streamingPredictCallable; + } + @Override public ServerStreamingCallable serverStreamingPredictCallable() { return serverStreamingPredictCallable; } + @Override + public BidiStreamingCallable + streamingRawPredictCallable() { + return streamingRawPredictCallable; + } + @Override public UnaryCallable explainCallable() { return explainCallable; diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStub.java index 750e8b01f852..2e4ace09827d 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStub.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStub.java @@ -21,10 +21,15 @@ import com.google.api.HttpBody; import com.google.api.core.BetaApi; import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1beta1.CountTokensRequest; import com.google.cloud.aiplatform.v1beta1.CountTokensResponse; +import com.google.cloud.aiplatform.v1beta1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; import com.google.cloud.aiplatform.v1beta1.ExplainRequest; import com.google.cloud.aiplatform.v1beta1.ExplainResponse; import com.google.cloud.aiplatform.v1beta1.PredictRequest; @@ -32,6 +37,8 @@ import com.google.cloud.aiplatform.v1beta1.RawPredictRequest; import com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest; import com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -61,11 +68,30 @@ public UnaryCallable rawPredictCallable() { throw new UnsupportedOperationException("Not implemented: rawPredictCallable()"); } + public UnaryCallable directPredictCallable() { + throw new UnsupportedOperationException("Not implemented: directPredictCallable()"); + } + + public UnaryCallable + directRawPredictCallable() { + throw new UnsupportedOperationException("Not implemented: directRawPredictCallable()"); + } + + public BidiStreamingCallable + streamingPredictCallable() { + throw new UnsupportedOperationException("Not implemented: streamingPredictCallable()"); + } + public ServerStreamingCallable serverStreamingPredictCallable() { throw new UnsupportedOperationException("Not implemented: serverStreamingPredictCallable()"); } + public BidiStreamingCallable + streamingRawPredictCallable() { + throw new UnsupportedOperationException("Not implemented: streamingRawPredictCallable()"); + } + public UnaryCallable explainCallable() { throw new UnsupportedOperationException("Not implemented: explainCallable()"); } diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStubSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStubSettings.java index 4ffe5807d542..c2f53ff7b09c 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStubSettings.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/PredictionServiceStubSettings.java @@ -38,12 +38,17 @@ import com.google.api.gax.rpc.PagedListResponseFactory; import com.google.api.gax.rpc.ServerStreamingCallSettings; import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StreamingCallSettings; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1beta1.CountTokensRequest; import com.google.cloud.aiplatform.v1beta1.CountTokensResponse; +import com.google.cloud.aiplatform.v1beta1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; import com.google.cloud.aiplatform.v1beta1.ExplainRequest; import com.google.cloud.aiplatform.v1beta1.ExplainResponse; import com.google.cloud.aiplatform.v1beta1.PredictRequest; @@ -51,6 +56,8 @@ import com.google.cloud.aiplatform.v1beta1.RawPredictRequest; import com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest; import com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -116,8 +123,16 @@ public class PredictionServiceStubSettings extends StubSettings predictSettings; private final UnaryCallSettings rawPredictSettings; + private final UnaryCallSettings + directPredictSettings; + private final UnaryCallSettings + directRawPredictSettings; + private final StreamingCallSettings + streamingPredictSettings; private final ServerStreamingCallSettings serverStreamingPredictSettings; + private final StreamingCallSettings + streamingRawPredictSettings; private final UnaryCallSettings explainSettings; private final UnaryCallSettings countTokensSettings; private final PagedCallSettings< @@ -192,12 +207,35 @@ public UnaryCallSettings rawPredictSettings() { return rawPredictSettings; } + /** Returns the object with the settings used for calls to directPredict. */ + public UnaryCallSettings directPredictSettings() { + return directPredictSettings; + } + + /** Returns the object with the settings used for calls to directRawPredict. */ + public UnaryCallSettings + directRawPredictSettings() { + return directRawPredictSettings; + } + + /** Returns the object with the settings used for calls to streamingPredict. */ + public StreamingCallSettings + streamingPredictSettings() { + return streamingPredictSettings; + } + /** Returns the object with the settings used for calls to serverStreamingPredict. */ public ServerStreamingCallSettings serverStreamingPredictSettings() { return serverStreamingPredictSettings; } + /** Returns the object with the settings used for calls to streamingRawPredict. */ + public StreamingCallSettings + streamingRawPredictSettings() { + return streamingRawPredictSettings; + } + /** Returns the object with the settings used for calls to explain. */ public UnaryCallSettings explainSettings() { return explainSettings; @@ -312,7 +350,11 @@ protected PredictionServiceStubSettings(Builder settingsBuilder) throws IOExcept predictSettings = settingsBuilder.predictSettings().build(); rawPredictSettings = settingsBuilder.rawPredictSettings().build(); + directPredictSettings = settingsBuilder.directPredictSettings().build(); + directRawPredictSettings = settingsBuilder.directRawPredictSettings().build(); + streamingPredictSettings = settingsBuilder.streamingPredictSettings().build(); serverStreamingPredictSettings = settingsBuilder.serverStreamingPredictSettings().build(); + streamingRawPredictSettings = settingsBuilder.streamingRawPredictSettings().build(); explainSettings = settingsBuilder.explainSettings().build(); countTokensSettings = settingsBuilder.countTokensSettings().build(); listLocationsSettings = settingsBuilder.listLocationsSettings().build(); @@ -327,9 +369,18 @@ public static class Builder extends StubSettings.Builder> unaryMethodSettingsBuilders; private final UnaryCallSettings.Builder predictSettings; private final UnaryCallSettings.Builder rawPredictSettings; + private final UnaryCallSettings.Builder + directPredictSettings; + private final UnaryCallSettings.Builder + directRawPredictSettings; + private final StreamingCallSettings.Builder + streamingPredictSettings; private final ServerStreamingCallSettings.Builder< StreamingPredictRequest, StreamingPredictResponse> serverStreamingPredictSettings; + private final StreamingCallSettings.Builder< + StreamingRawPredictRequest, StreamingRawPredictResponse> + streamingRawPredictSettings; private final UnaryCallSettings.Builder explainSettings; private final UnaryCallSettings.Builder countTokensSettings; @@ -380,7 +431,11 @@ protected Builder(ClientContext clientContext) { predictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); rawPredictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + directPredictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + directRawPredictSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + streamingPredictSettings = StreamingCallSettings.newBuilder(); serverStreamingPredictSettings = ServerStreamingCallSettings.newBuilder(); + streamingRawPredictSettings = StreamingCallSettings.newBuilder(); explainSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); countTokensSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); @@ -393,6 +448,8 @@ protected Builder(ClientContext clientContext) { ImmutableList.>of( predictSettings, rawPredictSettings, + directPredictSettings, + directRawPredictSettings, explainSettings, countTokensSettings, listLocationsSettings, @@ -408,7 +465,11 @@ protected Builder(PredictionServiceStubSettings settings) { predictSettings = settings.predictSettings.toBuilder(); rawPredictSettings = settings.rawPredictSettings.toBuilder(); + directPredictSettings = settings.directPredictSettings.toBuilder(); + directRawPredictSettings = settings.directRawPredictSettings.toBuilder(); + streamingPredictSettings = settings.streamingPredictSettings.toBuilder(); serverStreamingPredictSettings = settings.serverStreamingPredictSettings.toBuilder(); + streamingRawPredictSettings = settings.streamingRawPredictSettings.toBuilder(); explainSettings = settings.explainSettings.toBuilder(); countTokensSettings = settings.countTokensSettings.toBuilder(); listLocationsSettings = settings.listLocationsSettings.toBuilder(); @@ -421,6 +482,8 @@ protected Builder(PredictionServiceStubSettings settings) { ImmutableList.>of( predictSettings, rawPredictSettings, + directPredictSettings, + directRawPredictSettings, explainSettings, countTokensSettings, listLocationsSettings, @@ -454,6 +517,16 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder + .directPredictSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .directRawPredictSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + builder .serverStreamingPredictSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) @@ -522,12 +595,36 @@ public UnaryCallSettings.Builder rawPredictSettings return rawPredictSettings; } + /** Returns the builder for the settings used for calls to directPredict. */ + public UnaryCallSettings.Builder + directPredictSettings() { + return directPredictSettings; + } + + /** Returns the builder for the settings used for calls to directRawPredict. */ + public UnaryCallSettings.Builder + directRawPredictSettings() { + return directRawPredictSettings; + } + + /** Returns the builder for the settings used for calls to streamingPredict. */ + public StreamingCallSettings.Builder + streamingPredictSettings() { + return streamingPredictSettings; + } + /** Returns the builder for the settings used for calls to serverStreamingPredict. */ public ServerStreamingCallSettings.Builder serverStreamingPredictSettings() { return serverStreamingPredictSettings; } + /** Returns the builder for the settings used for calls to streamingRawPredict. */ + public StreamingCallSettings.Builder + streamingRawPredictSettings() { + return streamingRawPredictSettings; + } + /** Returns the builder for the settings used for calls to explain. */ public UnaryCallSettings.Builder explainSettings() { return explainSettings; diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1beta1/reflect-config.json b/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1beta1/reflect-config.json index ad922dbcf1ec..a6e3e9fe72f7 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1beta1/reflect-config.json +++ b/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1beta1/reflect-config.json @@ -3851,6 +3851,78 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1beta1.DirectPredictRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.DirectPredictRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.DirectPredictResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.DirectPredictResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1beta1.DiskSpec", "queryAllDeclaredConstructors": true, @@ -12230,6 +12302,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1beta1.StreamingReadFeatureValuesRequest", "queryAllDeclaredConstructors": true, diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/MockPredictionServiceImpl.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/MockPredictionServiceImpl.java index ca790501632f..68a634352ed5 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/MockPredictionServiceImpl.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/MockPredictionServiceImpl.java @@ -99,6 +99,85 @@ public void rawPredict(RawPredictRequest request, StreamObserver respo } } + @Override + public void directPredict( + DirectPredictRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof DirectPredictResponse) { + requests.add(request); + responseObserver.onNext(((DirectPredictResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DirectPredict, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + DirectPredictResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void directRawPredict( + DirectRawPredictRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof DirectRawPredictResponse) { + requests.add(request); + responseObserver.onNext(((DirectRawPredictResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DirectRawPredict, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + DirectRawPredictResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public StreamObserver streamingPredict( + final StreamObserver responseObserver) { + StreamObserver requestObserver = + new StreamObserver() { + @Override + public void onNext(StreamingPredictRequest value) { + requests.add(value); + final Object response = responses.remove(); + if (response instanceof StreamingPredictResponse) { + responseObserver.onNext(((StreamingPredictResponse) response)); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method StreamingPredict, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + StreamingPredictResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void onError(Throwable t) { + responseObserver.onError(t); + } + + @Override + public void onCompleted() { + responseObserver.onCompleted(); + } + }; + return requestObserver; + } + @Override public void serverStreamingPredict( StreamingPredictRequest request, StreamObserver responseObserver) { @@ -120,6 +199,43 @@ public void serverStreamingPredict( } } + @Override + public StreamObserver streamingRawPredict( + final StreamObserver responseObserver) { + StreamObserver requestObserver = + new StreamObserver() { + @Override + public void onNext(StreamingRawPredictRequest value) { + requests.add(value); + final Object response = responses.remove(); + if (response instanceof StreamingRawPredictResponse) { + responseObserver.onNext(((StreamingRawPredictResponse) response)); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method StreamingRawPredict, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + StreamingRawPredictResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void onError(Throwable t) { + responseObserver.onError(t); + } + + @Override + public void onCompleted() { + responseObserver.onCompleted(); + } + }; + return requestObserver; + } + @Override public void explain(ExplainRequest request, StreamObserver responseObserver) { Object response = responses.poll(); diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClientTest.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClientTest.java index 19194aeacb91..1c1ba35e741b 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClientTest.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceClientTest.java @@ -26,6 +26,8 @@ import com.google.api.gax.grpc.testing.MockServiceHelper; import com.google.api.gax.grpc.testing.MockStreamObserver; import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiStreamObserver; +import com.google.api.gax.rpc.BidiStreamingCallable; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.ServerStreamingCallable; import com.google.api.gax.rpc.StatusCode; @@ -294,6 +296,179 @@ public void rawPredictExceptionTest2() throws Exception { } } + @Test + public void directPredictTest() throws Exception { + DirectPredictResponse expectedResponse = + DirectPredictResponse.newBuilder() + .addAllOutputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + mockPredictionService.addResponse(expectedResponse); + + DirectPredictRequest request = + DirectPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + + DirectPredictResponse actualResponse = client.directPredict(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPredictionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DirectPredictRequest actualRequest = ((DirectPredictRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getEndpoint(), actualRequest.getEndpoint()); + Assert.assertEquals(request.getInputsList(), actualRequest.getInputsList()); + Assert.assertEquals(request.getParameters(), actualRequest.getParameters()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void directPredictExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPredictionService.addException(exception); + + try { + DirectPredictRequest request = + DirectPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + client.directPredict(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void directRawPredictTest() throws Exception { + DirectRawPredictResponse expectedResponse = + DirectRawPredictResponse.newBuilder().setOutput(ByteString.EMPTY).build(); + mockPredictionService.addResponse(expectedResponse); + + DirectRawPredictRequest request = + DirectRawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setMethodName("methodName-723163380") + .setInput(ByteString.EMPTY) + .build(); + + DirectRawPredictResponse actualResponse = client.directRawPredict(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockPredictionService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DirectRawPredictRequest actualRequest = ((DirectRawPredictRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getEndpoint(), actualRequest.getEndpoint()); + Assert.assertEquals(request.getMethodName(), actualRequest.getMethodName()); + Assert.assertEquals(request.getInput(), actualRequest.getInput()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void directRawPredictExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPredictionService.addException(exception); + + try { + DirectRawPredictRequest request = + DirectRawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setMethodName("methodName-723163380") + .setInput(ByteString.EMPTY) + .build(); + client.directRawPredict(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void streamingPredictTest() throws Exception { + StreamingPredictResponse expectedResponse = + StreamingPredictResponse.newBuilder() + .addAllOutputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + mockPredictionService.addResponse(expectedResponse); + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.streamingPredictCallable(); + ApiStreamObserver requestObserver = + callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + requestObserver.onCompleted(); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void streamingPredictExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPredictionService.addException(exception); + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.streamingPredictCallable(); + ApiStreamObserver requestObserver = + callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + @Test public void serverStreamingPredictTest() throws Exception { StreamingPredictResponse expectedResponse = @@ -351,6 +526,67 @@ public void serverStreamingPredictExceptionTest() throws Exception { } } + @Test + public void streamingRawPredictTest() throws Exception { + StreamingRawPredictResponse expectedResponse = + StreamingRawPredictResponse.newBuilder().setOutput(ByteString.EMPTY).build(); + mockPredictionService.addResponse(expectedResponse); + StreamingRawPredictRequest request = + StreamingRawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setMethodName("methodName-723163380") + .setInput(ByteString.EMPTY) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.streamingRawPredictCallable(); + ApiStreamObserver requestObserver = + callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + requestObserver.onCompleted(); + + List actualResponses = responseObserver.future().get(); + Assert.assertEquals(1, actualResponses.size()); + Assert.assertEquals(expectedResponse, actualResponses.get(0)); + } + + @Test + public void streamingRawPredictExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockPredictionService.addException(exception); + StreamingRawPredictRequest request = + StreamingRawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setMethodName("methodName-723163380") + .setInput(ByteString.EMPTY) + .build(); + + MockStreamObserver responseObserver = new MockStreamObserver<>(); + + BidiStreamingCallable callable = + client.streamingRawPredictCallable(); + ApiStreamObserver requestObserver = + callable.bidiStreamingCall(responseObserver); + + requestObserver.onNext(request); + + try { + List actualResponses = responseObserver.future().get(); + Assert.fail("No exception thrown"); + } catch (ExecutionException e) { + Assert.assertTrue(e.getCause() instanceof InvalidArgumentException); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + @Test public void explainTest() throws Exception { ExplainResponse expectedResponse = diff --git a/java-aiplatform/grpc-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceGrpc.java b/java-aiplatform/grpc-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceGrpc.java index 05977a34bdc0..c180ed0d30d1 100644 --- a/java-aiplatform/grpc-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceGrpc.java +++ b/java-aiplatform/grpc-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceGrpc.java @@ -125,6 +125,147 @@ private PredictionServiceGrpc() {} return getRawPredictMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest, + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse> + getDirectPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DirectPredict", + requestType = com.google.cloud.aiplatform.v1beta1.DirectPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1beta1.DirectPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest, + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse> + getDirectPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest, + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse> + getDirectPredictMethod; + if ((getDirectPredictMethod = PredictionServiceGrpc.getDirectPredictMethod) == null) { + synchronized (PredictionServiceGrpc.class) { + if ((getDirectPredictMethod = PredictionServiceGrpc.getDirectPredictMethod) == null) { + PredictionServiceGrpc.getDirectPredictMethod = + getDirectPredictMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DirectPredict")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("DirectPredict")) + .build(); + } + } + } + return getDirectPredictMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest, + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse> + getDirectRawPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DirectRawPredict", + requestType = com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest, + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse> + getDirectRawPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest, + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse> + getDirectRawPredictMethod; + if ((getDirectRawPredictMethod = PredictionServiceGrpc.getDirectRawPredictMethod) == null) { + synchronized (PredictionServiceGrpc.class) { + if ((getDirectRawPredictMethod = PredictionServiceGrpc.getDirectRawPredictMethod) == null) { + PredictionServiceGrpc.getDirectRawPredictMethod = + getDirectRawPredictMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DirectRawPredict")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("DirectRawPredict")) + .build(); + } + } + } + return getDirectRawPredictMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> + getStreamingPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "StreamingPredict", + requestType = com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> + getStreamingPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> + getStreamingPredictMethod; + if ((getStreamingPredictMethod = PredictionServiceGrpc.getStreamingPredictMethod) == null) { + synchronized (PredictionServiceGrpc.class) { + if ((getStreamingPredictMethod = PredictionServiceGrpc.getStreamingPredictMethod) == null) { + PredictionServiceGrpc.getStreamingPredictMethod = + getStreamingPredictMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "StreamingPredict")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("StreamingPredict")) + .build(); + } + } + } + return getStreamingPredictMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> @@ -176,6 +317,56 @@ private PredictionServiceGrpc() {} return getServerStreamingPredictMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse> + getStreamingRawPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "StreamingRawPredict", + requestType = com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse> + getStreamingRawPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse> + getStreamingRawPredictMethod; + if ((getStreamingRawPredictMethod = PredictionServiceGrpc.getStreamingRawPredictMethod) + == null) { + synchronized (PredictionServiceGrpc.class) { + if ((getStreamingRawPredictMethod = PredictionServiceGrpc.getStreamingRawPredictMethod) + == null) { + PredictionServiceGrpc.getStreamingRawPredictMethod = + getStreamingRawPredictMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "StreamingRawPredict")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("StreamingRawPredict")) + .build(); + } + } + } + return getStreamingRawPredictMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.cloud.aiplatform.v1beta1.ExplainRequest, com.google.cloud.aiplatform.v1beta1.ExplainResponse> @@ -353,6 +544,54 @@ default void rawPredict( io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRawPredictMethod(), responseObserver); } + /** + * + * + *
+     * Perform an unary online prediction request for Vertex first-party products
+     * and frameworks.
+     * 
+ */ + default void directPredict( + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDirectPredictMethod(), responseObserver); + } + + /** + * + * + *
+     * Perform an online prediction request through gRPC.
+     * 
+ */ + default void directRawPredict( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDirectRawPredictMethod(), responseObserver); + } + + /** + * + * + *
+     * Perform a streaming online prediction request for Vertex first-party
+     * products and frameworks.
+     * 
+ */ + default io.grpc.stub.StreamObserver + streamingPredict( + io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> + responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall( + getStreamingPredictMethod(), responseObserver); + } + /** * * @@ -369,6 +608,23 @@ default void serverStreamingPredict( getServerStreamingPredictMethod(), responseObserver); } + /** + * + * + *
+     * Perform a streaming online prediction request through gRPC.
+     * 
+ */ + default io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest> + streamingRawPredict( + io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse> + responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall( + getStreamingRawPredictMethod(), responseObserver); + } + /** * * @@ -479,6 +735,58 @@ public void rawPredict( getChannel().newCall(getRawPredictMethod(), getCallOptions()), request, responseObserver); } + /** + * + * + *
+     * Perform an unary online prediction request for Vertex first-party products
+     * and frameworks.
+     * 
+ */ + public void directPredict( + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDirectPredictMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Perform an online prediction request through gRPC.
+     * 
+ */ + public void directRawPredict( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDirectRawPredictMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Perform a streaming online prediction request for Vertex first-party
+     * products and frameworks.
+     * 
+ */ + public io.grpc.stub.StreamObserver + streamingPredict( + io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse> + responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getStreamingPredictMethod(), getCallOptions()), responseObserver); + } + /** * * @@ -497,6 +805,23 @@ public void serverStreamingPredict( responseObserver); } + /** + * + * + *
+     * Perform a streaming online prediction request through gRPC.
+     * 
+ */ + public io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest> + streamingRawPredict( + io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse> + responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getStreamingRawPredictMethod(), getCallOptions()), responseObserver); + } + /** * * @@ -592,6 +917,33 @@ public com.google.api.HttpBody rawPredict( getChannel(), getRawPredictMethod(), getCallOptions(), request); } + /** + * + * + *
+     * Perform an unary online prediction request for Vertex first-party products
+     * and frameworks.
+     * 
+ */ + public com.google.cloud.aiplatform.v1beta1.DirectPredictResponse directPredict( + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDirectPredictMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Perform an online prediction request through gRPC.
+     * 
+ */ + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse directRawPredict( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDirectRawPredictMethod(), getCallOptions(), request); + } + /** * * @@ -696,6 +1048,35 @@ public com.google.common.util.concurrent.ListenableFuture + * Perform an unary online prediction request for Vertex first-party products + * and frameworks. + * + */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse> + directPredict(com.google.cloud.aiplatform.v1beta1.DirectPredictRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDirectPredictMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Perform an online prediction request through gRPC.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse> + directRawPredict(com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDirectRawPredictMethod(), getCallOptions()), request); + } + /** * * @@ -736,9 +1117,13 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -768,6 +1153,20 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (com.google.cloud.aiplatform.v1beta1.RawPredictRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_DIRECT_PREDICT: + serviceImpl.directPredict( + (com.google.cloud.aiplatform.v1beta1.DirectPredictRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse>) + responseObserver); + break; + case METHODID_DIRECT_RAW_PREDICT: + serviceImpl.directRawPredict( + (com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse>) + responseObserver); + break; case METHODID_SERVER_STREAMING_PREDICT: serviceImpl.serverStreamingPredict( (com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest) request, @@ -797,6 +1196,18 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv public io.grpc.stub.StreamObserver invoke( io.grpc.stub.StreamObserver responseObserver) { switch (methodId) { + case METHODID_STREAMING_PREDICT: + return (io.grpc.stub.StreamObserver) + serviceImpl.streamingPredict( + (io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse>) + responseObserver); + case METHODID_STREAMING_RAW_PREDICT: + return (io.grpc.stub.StreamObserver) + serviceImpl.streamingRawPredict( + (io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse>) + responseObserver); default: throw new AssertionError(); } @@ -818,6 +1229,27 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser new MethodHandlers< com.google.cloud.aiplatform.v1beta1.RawPredictRequest, com.google.api.HttpBody>( service, METHODID_RAW_PREDICT))) + .addMethod( + getDirectPredictMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest, + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse>( + service, METHODID_DIRECT_PREDICT))) + .addMethod( + getDirectRawPredictMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest, + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse>( + service, METHODID_DIRECT_RAW_PREDICT))) + .addMethod( + getStreamingPredictMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse>( + service, METHODID_STREAMING_PREDICT))) .addMethod( getServerStreamingPredictMethod(), io.grpc.stub.ServerCalls.asyncServerStreamingCall( @@ -825,6 +1257,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest, com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse>( service, METHODID_SERVER_STREAMING_PREDICT))) + .addMethod( + getStreamingRawPredictMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest, + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse>( + service, METHODID_STREAMING_RAW_PREDICT))) .addMethod( getExplainMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -892,7 +1331,11 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .setSchemaDescriptor(new PredictionServiceFileDescriptorSupplier()) .addMethod(getPredictMethod()) .addMethod(getRawPredictMethod()) + .addMethod(getDirectPredictMethod()) + .addMethod(getDirectRawPredictMethod()) + .addMethod(getStreamingPredictMethod()) .addMethod(getServerStreamingPredictMethod()) + .addMethod(getStreamingRawPredictMethod()) .addMethod(getExplainMethod()) .addMethod(getCountTokensMethod()) .build(); diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictRequest.java new file mode 100644 index 000000000000..8b4fb53a7067 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictRequest.java @@ -0,0 +1,1413 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Request message for
+ * [PredictionService.DirectPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.DirectPredictRequest} + */ +public final class DirectPredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.DirectPredictRequest) + DirectPredictRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DirectPredictRequest.newBuilder() to construct. + private DirectPredictRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DirectPredictRequest() { + endpoint_ = ""; + inputs_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DirectPredictRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest.class, + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest.Builder.class); + } + + public static final int ENDPOINT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object endpoint_ = ""; + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The endpoint. + */ + @java.lang.Override + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } + } + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUTS_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private java.util.List inputs_; + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public java.util.List getInputsList() { + return inputs_; + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public java.util.List + getInputsOrBuilderList() { + return inputs_; + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public int getInputsCount() { + return inputs_.size(); + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getInputs(int index) { + return inputs_.get(index); + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getInputsOrBuilder(int index) { + return inputs_.get(index); + } + + public static final int PARAMETERS_FIELD_NUMBER = 3; + private com.google.cloud.aiplatform.v1beta1.Tensor parameters_; + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + @java.lang.Override + public boolean hasParameters() { + return parameters_ != null; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return The parameters. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getParameters() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); + } + for (int i = 0; i < inputs_.size(); i++) { + output.writeMessage(2, inputs_.get(i)); + } + if (parameters_ != null) { + output.writeMessage(3, getParameters()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); + } + for (int i = 0; i < inputs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, inputs_.get(i)); + } + if (parameters_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getParameters()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.DirectPredictRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest other = + (com.google.cloud.aiplatform.v1beta1.DirectPredictRequest) obj; + + if (!getEndpoint().equals(other.getEndpoint())) return false; + if (!getInputsList().equals(other.getInputsList())) return false; + if (hasParameters() != other.hasParameters()) return false; + if (hasParameters()) { + if (!getParameters().equals(other.getParameters())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; + hash = (53 * hash) + getEndpoint().hashCode(); + if (getInputsCount() > 0) { + hash = (37 * hash) + INPUTS_FIELD_NUMBER; + hash = (53 * hash) + getInputsList().hashCode(); + } + if (hasParameters()) { + hash = (37 * hash) + PARAMETERS_FIELD_NUMBER; + hash = (53 * hash) + getParameters().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [PredictionService.DirectPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.DirectPredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.DirectPredictRequest) + com.google.cloud.aiplatform.v1beta1.DirectPredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest.class, + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.DirectPredictRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + endpoint_ = ""; + if (inputsBuilder_ == null) { + inputs_ = java.util.Collections.emptyList(); + } else { + inputs_ = null; + inputsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectPredictRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.DirectPredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectPredictRequest build() { + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectPredictRequest buildPartial() { + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest result = + new com.google.cloud.aiplatform.v1beta1.DirectPredictRequest(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1beta1.DirectPredictRequest result) { + if (inputsBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + inputs_ = java.util.Collections.unmodifiableList(inputs_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.inputs_ = inputs_; + } else { + result.inputs_ = inputsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.aiplatform.v1beta1.DirectPredictRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.endpoint_ = endpoint_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.parameters_ = parametersBuilder_ == null ? parameters_ : parametersBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.DirectPredictRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.DirectPredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.DirectPredictRequest other) { + if (other == com.google.cloud.aiplatform.v1beta1.DirectPredictRequest.getDefaultInstance()) + return this; + if (!other.getEndpoint().isEmpty()) { + endpoint_ = other.endpoint_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (inputsBuilder_ == null) { + if (!other.inputs_.isEmpty()) { + if (inputs_.isEmpty()) { + inputs_ = other.inputs_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureInputsIsMutable(); + inputs_.addAll(other.inputs_); + } + onChanged(); + } + } else { + if (!other.inputs_.isEmpty()) { + if (inputsBuilder_.isEmpty()) { + inputsBuilder_.dispose(); + inputsBuilder_ = null; + inputs_ = other.inputs_; + bitField0_ = (bitField0_ & ~0x00000002); + inputsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getInputsFieldBuilder() + : null; + } else { + inputsBuilder_.addAllMessages(other.inputs_); + } + } + } + if (other.hasParameters()) { + mergeParameters(other.getParameters()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + endpoint_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + com.google.cloud.aiplatform.v1beta1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1beta1.Tensor.parser(), extensionRegistry); + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(m); + } else { + inputsBuilder_.addMessage(m); + } + break; + } // case 18 + case 26: + { + input.readMessage(getParametersFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object endpoint_ = ""; + /** + * + * + *
+     * 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) = { ... } + * + * + * @return The endpoint. + */ + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @param value The endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpoint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearEndpoint() { + endpoint_ = getDefaultInstance().getEndpoint(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @param value The bytes for endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpointBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.util.List inputs_ = + java.util.Collections.emptyList(); + + private void ensureInputsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + inputs_ = new java.util.ArrayList(inputs_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + inputsBuilder_; + + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public java.util.List getInputsList() { + if (inputsBuilder_ == null) { + return java.util.Collections.unmodifiableList(inputs_); + } else { + return inputsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public int getInputsCount() { + if (inputsBuilder_ == null) { + return inputs_.size(); + } else { + return inputsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getInputs(int index) { + if (inputsBuilder_ == null) { + return inputs_.get(index); + } else { + return inputsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder setInputs(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.set(index, value); + onChanged(); + } else { + inputsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder setInputs( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.set(index, builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addInputs(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.add(value); + onChanged(); + } else { + inputsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addInputs(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (inputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureInputsIsMutable(); + inputs_.add(index, value); + onChanged(); + } else { + inputsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addInputs(com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addInputs( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.add(index, builderForValue.build()); + onChanged(); + } else { + inputsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder addAllInputs( + java.lang.Iterable values) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, inputs_); + onChanged(); + } else { + inputsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder clearInputs() { + if (inputsBuilder_ == null) { + inputs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + inputsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public Builder removeInputs(int index) { + if (inputsBuilder_ == null) { + ensureInputsIsMutable(); + inputs_.remove(index); + onChanged(); + } else { + inputsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getInputsBuilder(int index) { + return getInputsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getInputsOrBuilder(int index) { + if (inputsBuilder_ == null) { + return inputs_.get(index); + } else { + return inputsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public java.util.List + getInputsOrBuilderList() { + if (inputsBuilder_ != null) { + return inputsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(inputs_); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addInputsBuilder() { + return getInputsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addInputsBuilder(int index) { + return getInputsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + public java.util.List + getInputsBuilderList() { + return getInputsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getInputsFieldBuilder() { + if (inputsBuilder_ == null) { + inputsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + inputs_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + inputs_ = null; + } + return inputsBuilder_; + } + + private com.google.cloud.aiplatform.v1beta1.Tensor parameters_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + parametersBuilder_; + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + public boolean hasParameters() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return The parameters. + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (parametersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + parameters_ = value; + } else { + parametersBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public Builder setParameters( + com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (parametersBuilder_ == null) { + parameters_ = builderForValue.build(); + } else { + parametersBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public Builder mergeParameters(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && parameters_ != null + && parameters_ != com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()) { + getParametersBuilder().mergeFrom(value); + } else { + parameters_ = value; + } + } else { + parametersBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public Builder clearParameters() { + bitField0_ = (bitField0_ & ~0x00000004); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getParametersBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getParametersFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + getParameters(), getParentForChildren(), isClean()); + parameters_ = null; + } + return parametersBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.DirectPredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.DirectPredictRequest) + private static final com.google.cloud.aiplatform.v1beta1.DirectPredictRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.DirectPredictRequest(); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DirectPredictRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectPredictRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictRequestOrBuilder.java new file mode 100644 index 000000000000..49f69aa71793 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictRequestOrBuilder.java @@ -0,0 +1,145 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface DirectPredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.DirectPredictRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The endpoint. + */ + java.lang.String getEndpoint(); + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + com.google.protobuf.ByteString getEndpointBytes(); + + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + java.util.List getInputsList(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + com.google.cloud.aiplatform.v1beta1.Tensor getInputs(int index); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + int getInputsCount(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + java.util.List + getInputsOrBuilderList(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor inputs = 2; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getInputsOrBuilder(int index); + + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + * + * @return The parameters. + */ + com.google.cloud.aiplatform.v1beta1.Tensor getParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 3; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictResponse.java new file mode 100644 index 000000000000..ffaf9eab74c7 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictResponse.java @@ -0,0 +1,1203 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Response message for
+ * [PredictionService.DirectPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.DirectPredictResponse} + */ +public final class DirectPredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.DirectPredictResponse) + DirectPredictResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use DirectPredictResponse.newBuilder() to construct. + private DirectPredictResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DirectPredictResponse() { + outputs_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DirectPredictResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse.class, + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse.Builder.class); + } + + public static final int OUTPUTS_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List outputs_; + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public java.util.List getOutputsList() { + return outputs_; + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public java.util.List + getOutputsOrBuilderList() { + return outputs_; + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public int getOutputsCount() { + return outputs_.size(); + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getOutputs(int index) { + return outputs_.get(index); + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getOutputsOrBuilder(int index) { + return outputs_.get(index); + } + + public static final int PARAMETERS_FIELD_NUMBER = 2; + private com.google.cloud.aiplatform.v1beta1.Tensor parameters_; + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + @java.lang.Override + public boolean hasParameters() { + return parameters_ != null; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return The parameters. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Tensor getParameters() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < outputs_.size(); i++) { + output.writeMessage(1, outputs_.get(i)); + } + if (parameters_ != null) { + output.writeMessage(2, getParameters()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < outputs_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, outputs_.get(i)); + } + if (parameters_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getParameters()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.DirectPredictResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse other = + (com.google.cloud.aiplatform.v1beta1.DirectPredictResponse) obj; + + if (!getOutputsList().equals(other.getOutputsList())) return false; + if (hasParameters() != other.hasParameters()) return false; + if (hasParameters()) { + if (!getParameters().equals(other.getParameters())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getOutputsCount() > 0) { + hash = (37 * hash) + OUTPUTS_FIELD_NUMBER; + hash = (53 * hash) + getOutputsList().hashCode(); + } + if (hasParameters()) { + hash = (37 * hash) + PARAMETERS_FIELD_NUMBER; + hash = (53 * hash) + getParameters().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for
+   * [PredictionService.DirectPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.DirectPredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.DirectPredictResponse) + com.google.cloud.aiplatform.v1beta1.DirectPredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse.class, + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.DirectPredictResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (outputsBuilder_ == null) { + outputs_ = java.util.Collections.emptyList(); + } else { + outputs_ = null; + outputsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectPredictResponse getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.DirectPredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectPredictResponse build() { + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectPredictResponse buildPartial() { + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse result = + new com.google.cloud.aiplatform.v1beta1.DirectPredictResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1beta1.DirectPredictResponse result) { + if (outputsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + outputs_ = java.util.Collections.unmodifiableList(outputs_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.outputs_ = outputs_; + } else { + result.outputs_ = outputsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.aiplatform.v1beta1.DirectPredictResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.parameters_ = parametersBuilder_ == null ? parameters_ : parametersBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.DirectPredictResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.DirectPredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.DirectPredictResponse other) { + if (other == com.google.cloud.aiplatform.v1beta1.DirectPredictResponse.getDefaultInstance()) + return this; + if (outputsBuilder_ == null) { + if (!other.outputs_.isEmpty()) { + if (outputs_.isEmpty()) { + outputs_ = other.outputs_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureOutputsIsMutable(); + outputs_.addAll(other.outputs_); + } + onChanged(); + } + } else { + if (!other.outputs_.isEmpty()) { + if (outputsBuilder_.isEmpty()) { + outputsBuilder_.dispose(); + outputsBuilder_ = null; + outputs_ = other.outputs_; + bitField0_ = (bitField0_ & ~0x00000001); + outputsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getOutputsFieldBuilder() + : null; + } else { + outputsBuilder_.addAllMessages(other.outputs_); + } + } + } + if (other.hasParameters()) { + mergeParameters(other.getParameters()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.aiplatform.v1beta1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1beta1.Tensor.parser(), extensionRegistry); + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(m); + } else { + outputsBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + input.readMessage(getParametersFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List outputs_ = + java.util.Collections.emptyList(); + + private void ensureOutputsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + outputs_ = new java.util.ArrayList(outputs_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + outputsBuilder_; + + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public java.util.List getOutputsList() { + if (outputsBuilder_ == null) { + return java.util.Collections.unmodifiableList(outputs_); + } else { + return outputsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public int getOutputsCount() { + if (outputsBuilder_ == null) { + return outputs_.size(); + } else { + return outputsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getOutputs(int index) { + if (outputsBuilder_ == null) { + return outputs_.get(index); + } else { + return outputsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder setOutputs(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.set(index, value); + onChanged(); + } else { + outputsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder setOutputs( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.set(index, builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addOutputs(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.add(value); + onChanged(); + } else { + outputsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addOutputs(int index, com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (outputsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureOutputsIsMutable(); + outputs_.add(index, value); + onChanged(); + } else { + outputsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addOutputs(com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addOutputs( + int index, com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.add(index, builderForValue.build()); + onChanged(); + } else { + outputsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder addAllOutputs( + java.lang.Iterable values) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, outputs_); + onChanged(); + } else { + outputsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder clearOutputs() { + if (outputsBuilder_ == null) { + outputs_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + outputsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public Builder removeOutputs(int index) { + if (outputsBuilder_ == null) { + ensureOutputsIsMutable(); + outputs_.remove(index); + onChanged(); + } else { + outputsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getOutputsBuilder(int index) { + return getOutputsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getOutputsOrBuilder(int index) { + if (outputsBuilder_ == null) { + return outputs_.get(index); + } else { + return outputsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public java.util.List + getOutputsOrBuilderList() { + if (outputsBuilder_ != null) { + return outputsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(outputs_); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addOutputsBuilder() { + return getOutputsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder addOutputsBuilder(int index) { + return getOutputsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + public java.util.List + getOutputsBuilderList() { + return getOutputsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getOutputsFieldBuilder() { + if (outputsBuilder_ == null) { + outputsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + outputs_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + outputs_ = null; + } + return outputsBuilder_; + } + + private com.google.cloud.aiplatform.v1beta1.Tensor parameters_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + parametersBuilder_; + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + public boolean hasParameters() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return The parameters. + */ + public com.google.cloud.aiplatform.v1beta1.Tensor getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (parametersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + parameters_ = value; + } else { + parametersBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public Builder setParameters( + com.google.cloud.aiplatform.v1beta1.Tensor.Builder builderForValue) { + if (parametersBuilder_ == null) { + parameters_ = builderForValue.build(); + } else { + parametersBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public Builder mergeParameters(com.google.cloud.aiplatform.v1beta1.Tensor value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && parameters_ != null + && parameters_ != com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance()) { + getParametersBuilder().mergeFrom(value); + } else { + parameters_ = value; + } + } else { + parametersBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public Builder clearParameters() { + bitField0_ = (bitField0_ & ~0x00000002); + parameters_ = null; + if (parametersBuilder_ != null) { + parametersBuilder_.dispose(); + parametersBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public com.google.cloud.aiplatform.v1beta1.Tensor.Builder getParametersBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getParametersFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + public com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.cloud.aiplatform.v1beta1.Tensor.getDefaultInstance() + : parameters_; + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder> + getParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Tensor, + com.google.cloud.aiplatform.v1beta1.Tensor.Builder, + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder>( + getParameters(), getParentForChildren(), isClean()); + parameters_ = null; + } + return parametersBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.DirectPredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.DirectPredictResponse) + private static final com.google.cloud.aiplatform.v1beta1.DirectPredictResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.DirectPredictResponse(); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectPredictResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DirectPredictResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectPredictResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictResponseOrBuilder.java new file mode 100644 index 000000000000..86d5cebafdfa --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectPredictResponseOrBuilder.java @@ -0,0 +1,112 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface DirectPredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.DirectPredictResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + java.util.List getOutputsList(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + com.google.cloud.aiplatform.v1beta1.Tensor getOutputs(int index); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + int getOutputsCount(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + java.util.List + getOutputsOrBuilderList(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1beta1.Tensor outputs = 1; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getOutputsOrBuilder(int index); + + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + * + * @return The parameters. + */ + com.google.cloud.aiplatform.v1beta1.Tensor getParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1beta1.Tensor parameters = 2; + */ + com.google.cloud.aiplatform.v1beta1.TensorOrBuilder getParametersOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictRequest.java new file mode 100644 index 000000000000..cb40584b6082 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictRequest.java @@ -0,0 +1,975 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Request message for
+ * [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.DirectRawPredictRequest} + */ +public final class DirectRawPredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) + DirectRawPredictRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DirectRawPredictRequest.newBuilder() to construct. + private DirectRawPredictRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DirectRawPredictRequest() { + endpoint_ = ""; + methodName_ = ""; + input_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DirectRawPredictRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.class, + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.Builder.class); + } + + public static final int ENDPOINT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object endpoint_ = ""; + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The endpoint. + */ + @java.lang.Override + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } + } + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int METHOD_NAME_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object methodName_ = ""; + /** + * + * + *
+   * 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; + * + * @return The methodName. + */ + @java.lang.Override + public java.lang.String getMethodName() { + java.lang.Object ref = methodName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + methodName_ = s; + return s; + } + } + /** + * + * + *
+   * 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; + * + * @return The bytes for methodName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMethodNameBytes() { + java.lang.Object ref = methodName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + methodName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUT_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString input_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * bytes input = 3; + * + * @return The input. + */ + @java.lang.Override + public com.google.protobuf.ByteString getInput() { + return input_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(methodName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, methodName_); + } + if (!input_.isEmpty()) { + output.writeBytes(3, input_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(methodName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, methodName_); + } + if (!input_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, input_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest other = + (com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) obj; + + if (!getEndpoint().equals(other.getEndpoint())) return false; + if (!getMethodName().equals(other.getMethodName())) return false; + if (!getInput().equals(other.getInput())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; + hash = (53 * hash) + getEndpoint().hashCode(); + hash = (37 * hash) + METHOD_NAME_FIELD_NUMBER; + hash = (53 * hash) + getMethodName().hashCode(); + hash = (37 * hash) + INPUT_FIELD_NUMBER; + hash = (53 * hash) + getInput().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for
+   * [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.DirectRawPredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.class, + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + endpoint_ = ""; + methodName_ = ""; + input_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest build() { + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest buildPartial() { + com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest result = + new com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.endpoint_ = endpoint_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.methodName_ = methodName_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.input_ = input_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest other) { + if (other == com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest.getDefaultInstance()) + return this; + if (!other.getEndpoint().isEmpty()) { + endpoint_ = other.endpoint_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getMethodName().isEmpty()) { + methodName_ = other.methodName_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getInput() != com.google.protobuf.ByteString.EMPTY) { + setInput(other.getInput()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + endpoint_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + methodName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input_ = input.readBytes(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object endpoint_ = ""; + /** + * + * + *
+     * 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) = { ... } + * + * + * @return The endpoint. + */ + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @param value The endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpoint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearEndpoint() { + endpoint_ = getDefaultInstance().getEndpoint(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @param value The bytes for endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpointBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object methodName_ = ""; + /** + * + * + *
+     * 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; + * + * @return The methodName. + */ + public java.lang.String getMethodName() { + java.lang.Object ref = methodName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + methodName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * 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; + * + * @return The bytes for methodName. + */ + public com.google.protobuf.ByteString getMethodNameBytes() { + java.lang.Object ref = methodName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + methodName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * 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; + * + * @param value The methodName to set. + * @return This builder for chaining. + */ + public Builder setMethodName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + methodName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * 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; + * + * @return This builder for chaining. + */ + public Builder clearMethodName() { + methodName_ = getDefaultInstance().getMethodName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * 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; + * + * @param value The bytes for methodName to set. + * @return This builder for chaining. + */ + public Builder setMethodNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + methodName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString input_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * bytes input = 3; + * + * @return The input. + */ + @java.lang.Override + public com.google.protobuf.ByteString getInput() { + return input_; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * bytes input = 3; + * + * @param value The input to set. + * @return This builder for chaining. + */ + public Builder setInput(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + input_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * bytes input = 3; + * + * @return This builder for chaining. + */ + public Builder clearInput() { + bitField0_ = (bitField0_ & ~0x00000004); + input_ = getDefaultInstance().getInput(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) + private static final com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest(); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DirectRawPredictRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictRequestOrBuilder.java new file mode 100644 index 000000000000..82b89147fcf5 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictRequestOrBuilder.java @@ -0,0 +1,108 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface DirectRawPredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.DirectRawPredictRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The endpoint. + */ + java.lang.String getEndpoint(); + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + com.google.protobuf.ByteString getEndpointBytes(); + + /** + * + * + *
+   * 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; + * + * @return The methodName. + */ + java.lang.String getMethodName(); + /** + * + * + *
+   * 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; + * + * @return The bytes for methodName. + */ + com.google.protobuf.ByteString getMethodNameBytes(); + + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * bytes input = 3; + * + * @return The input. + */ + com.google.protobuf.ByteString getInput(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictResponse.java new file mode 100644 index 000000000000..290a7fef2b8e --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictResponse.java @@ -0,0 +1,545 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Response message for
+ * [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.DirectRawPredictResponse} + */ +public final class DirectRawPredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) + DirectRawPredictResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use DirectRawPredictResponse.newBuilder() to construct. + private DirectRawPredictResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DirectRawPredictResponse() { + output_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DirectRawPredictResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.class, + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.Builder.class); + } + + public static final int OUTPUT_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString output_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * bytes output = 1; + * + * @return The output. + */ + @java.lang.Override + public com.google.protobuf.ByteString getOutput() { + return output_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!output_.isEmpty()) { + output.writeBytes(1, output_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!output_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, output_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse other = + (com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) obj; + + if (!getOutput().equals(other.getOutput())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + OUTPUT_FIELD_NUMBER; + hash = (53 * hash) + getOutput().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for
+   * [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.DirectRawPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.DirectRawPredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.class, + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + output_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse build() { + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse buildPartial() { + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse result = + new com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.output_ = output_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse other) { + if (other + == com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse.getDefaultInstance()) + return this; + if (other.getOutput() != com.google.protobuf.ByteString.EMPTY) { + setOutput(other.getOutput()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + output_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.ByteString output_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * bytes output = 1; + * + * @return The output. + */ + @java.lang.Override + public com.google.protobuf.ByteString getOutput() { + return output_; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * bytes output = 1; + * + * @param value The output to set. + * @return This builder for chaining. + */ + public Builder setOutput(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + output_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * bytes output = 1; + * + * @return This builder for chaining. + */ + public Builder clearOutput() { + bitField0_ = (bitField0_ & ~0x00000001); + output_ = getDefaultInstance().getOutput(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) + private static final com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse(); + } + + public static com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DirectRawPredictResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictResponseOrBuilder.java new file mode 100644 index 000000000000..11de005805e3 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/DirectRawPredictResponseOrBuilder.java @@ -0,0 +1,38 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface DirectRawPredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.DirectRawPredictResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * bytes output = 1; + * + * @return The output. + */ + com.google.protobuf.ByteString getOutput(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelContainerSpec.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelContainerSpec.java index a839cf1dbe67..3031d14c6f50 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelContainerSpec.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelContainerSpec.java @@ -47,6 +47,7 @@ private ModelContainerSpec() { ports_ = java.util.Collections.emptyList(); predictRoute_ = ""; healthRoute_ = ""; + grpcPorts_ = java.util.Collections.emptyList(); } @java.lang.Override @@ -1206,6 +1207,127 @@ public com.google.protobuf.ByteString getHealthRouteBytes() { } } + public static final int GRPC_PORTS_FIELD_NUMBER = 9; + + @SuppressWarnings("serial") + private java.util.List grpcPorts_; + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + @java.lang.Override + public java.util.List getGrpcPortsList() { + return grpcPorts_; + } + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + @java.lang.Override + public java.util.List + getGrpcPortsOrBuilderList() { + return grpcPorts_; + } + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + @java.lang.Override + public int getGrpcPortsCount() { + return grpcPorts_.size(); + } + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.Port getGrpcPorts(int index) { + return grpcPorts_.get(index); + } + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.PortOrBuilder getGrpcPortsOrBuilder(int index) { + return grpcPorts_.get(index); + } + public static final int DEPLOYMENT_TIMEOUT_FIELD_NUMBER = 10; private com.google.protobuf.Duration deploymentTimeout_; /** @@ -1431,6 +1553,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(healthRoute_)) { com.google.protobuf.GeneratedMessageV3.writeString(output, 7, healthRoute_); } + for (int i = 0; i < grpcPorts_.size(); i++) { + output.writeMessage(9, grpcPorts_.get(i)); + } if (deploymentTimeout_ != null) { output.writeMessage(10, getDeploymentTimeout()); } @@ -1483,6 +1608,9 @@ public int getSerializedSize() { if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(healthRoute_)) { size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, healthRoute_); } + for (int i = 0; i < grpcPorts_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, grpcPorts_.get(i)); + } if (deploymentTimeout_ != null) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, getDeploymentTimeout()); } @@ -1518,6 +1646,7 @@ public boolean equals(final java.lang.Object obj) { if (!getPortsList().equals(other.getPortsList())) return false; if (!getPredictRoute().equals(other.getPredictRoute())) return false; if (!getHealthRoute().equals(other.getHealthRoute())) return false; + if (!getGrpcPortsList().equals(other.getGrpcPortsList())) return false; if (hasDeploymentTimeout() != other.hasDeploymentTimeout()) return false; if (hasDeploymentTimeout()) { if (!getDeploymentTimeout().equals(other.getDeploymentTimeout())) return false; @@ -1564,6 +1693,10 @@ public int hashCode() { hash = (53 * hash) + getPredictRoute().hashCode(); hash = (37 * hash) + HEALTH_ROUTE_FIELD_NUMBER; hash = (53 * hash) + getHealthRoute().hashCode(); + if (getGrpcPortsCount() > 0) { + hash = (37 * hash) + GRPC_PORTS_FIELD_NUMBER; + hash = (53 * hash) + getGrpcPortsList().hashCode(); + } if (hasDeploymentTimeout()) { hash = (37 * hash) + DEPLOYMENT_TIMEOUT_FIELD_NUMBER; hash = (53 * hash) + getDeploymentTimeout().hashCode(); @@ -1739,6 +1872,13 @@ public Builder clear() { bitField0_ = (bitField0_ & ~0x00000010); predictRoute_ = ""; healthRoute_ = ""; + if (grpcPortsBuilder_ == null) { + grpcPorts_ = java.util.Collections.emptyList(); + } else { + grpcPorts_ = null; + grpcPortsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000080); deploymentTimeout_ = null; if (deploymentTimeoutBuilder_ != null) { deploymentTimeoutBuilder_.dispose(); @@ -1810,6 +1950,15 @@ private void buildPartialRepeatedFields( } else { result.ports_ = portsBuilder_.build(); } + if (grpcPortsBuilder_ == null) { + if (((bitField0_ & 0x00000080) != 0)) { + grpcPorts_ = java.util.Collections.unmodifiableList(grpcPorts_); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.grpcPorts_ = grpcPorts_; + } else { + result.grpcPorts_ = grpcPortsBuilder_.build(); + } } private void buildPartial0(com.google.cloud.aiplatform.v1beta1.ModelContainerSpec result) { @@ -1831,20 +1980,20 @@ private void buildPartial0(com.google.cloud.aiplatform.v1beta1.ModelContainerSpe if (((from_bitField0_ & 0x00000040) != 0)) { result.healthRoute_ = healthRoute_; } - if (((from_bitField0_ & 0x00000080) != 0)) { + if (((from_bitField0_ & 0x00000100) != 0)) { result.deploymentTimeout_ = deploymentTimeoutBuilder_ == null ? deploymentTimeout_ : deploymentTimeoutBuilder_.build(); } - if (((from_bitField0_ & 0x00000100) != 0)) { + if (((from_bitField0_ & 0x00000200) != 0)) { result.sharedMemorySizeMb_ = sharedMemorySizeMb_; } - if (((from_bitField0_ & 0x00000200) != 0)) { + if (((from_bitField0_ & 0x00000400) != 0)) { result.startupProbe_ = startupProbeBuilder_ == null ? startupProbe_ : startupProbeBuilder_.build(); } - if (((from_bitField0_ & 0x00000400) != 0)) { + if (((from_bitField0_ & 0x00000800) != 0)) { result.healthProbe_ = healthProbeBuilder_ == null ? healthProbe_ : healthProbeBuilder_.build(); } @@ -1985,6 +2134,33 @@ public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.ModelContainerSpec bitField0_ |= 0x00000040; onChanged(); } + if (grpcPortsBuilder_ == null) { + if (!other.grpcPorts_.isEmpty()) { + if (grpcPorts_.isEmpty()) { + grpcPorts_ = other.grpcPorts_; + bitField0_ = (bitField0_ & ~0x00000080); + } else { + ensureGrpcPortsIsMutable(); + grpcPorts_.addAll(other.grpcPorts_); + } + onChanged(); + } + } else { + if (!other.grpcPorts_.isEmpty()) { + if (grpcPortsBuilder_.isEmpty()) { + grpcPortsBuilder_.dispose(); + grpcPortsBuilder_ = null; + grpcPorts_ = other.grpcPorts_; + bitField0_ = (bitField0_ & ~0x00000080); + grpcPortsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getGrpcPortsFieldBuilder() + : null; + } else { + grpcPortsBuilder_.addAllMessages(other.grpcPorts_); + } + } + } if (other.hasDeploymentTimeout()) { mergeDeploymentTimeout(other.getDeploymentTimeout()); } @@ -2081,29 +2257,42 @@ public Builder mergeFrom( bitField0_ |= 0x00000040; break; } // case 58 + case 74: + { + com.google.cloud.aiplatform.v1beta1.Port m = + input.readMessage( + com.google.cloud.aiplatform.v1beta1.Port.parser(), extensionRegistry); + if (grpcPortsBuilder_ == null) { + ensureGrpcPortsIsMutable(); + grpcPorts_.add(m); + } else { + grpcPortsBuilder_.addMessage(m); + } + break; + } // case 74 case 82: { input.readMessage( getDeploymentTimeoutFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; break; } // case 82 case 88: { sharedMemorySizeMb_ = input.readInt64(); - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; break; } // case 88 case 98: { input.readMessage(getStartupProbeFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; break; } // case 98 case 106: { input.readMessage(getHealthProbeFieldBuilder().getBuilder(), extensionRegistry); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; break; } // case 106 default: @@ -5487,6 +5676,535 @@ public Builder setHealthRouteBytes(com.google.protobuf.ByteString value) { return this; } + private java.util.List grpcPorts_ = + java.util.Collections.emptyList(); + + private void ensureGrpcPortsIsMutable() { + if (!((bitField0_ & 0x00000080) != 0)) { + grpcPorts_ = new java.util.ArrayList(grpcPorts_); + bitField0_ |= 0x00000080; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Port, + com.google.cloud.aiplatform.v1beta1.Port.Builder, + com.google.cloud.aiplatform.v1beta1.PortOrBuilder> + grpcPortsBuilder_; + + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public java.util.List getGrpcPortsList() { + if (grpcPortsBuilder_ == null) { + return java.util.Collections.unmodifiableList(grpcPorts_); + } else { + return grpcPortsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public int getGrpcPortsCount() { + if (grpcPortsBuilder_ == null) { + return grpcPorts_.size(); + } else { + return grpcPortsBuilder_.getCount(); + } + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1beta1.Port getGrpcPorts(int index) { + if (grpcPortsBuilder_ == null) { + return grpcPorts_.get(index); + } else { + return grpcPortsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder setGrpcPorts(int index, com.google.cloud.aiplatform.v1beta1.Port value) { + if (grpcPortsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGrpcPortsIsMutable(); + grpcPorts_.set(index, value); + onChanged(); + } else { + grpcPortsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder setGrpcPorts( + int index, com.google.cloud.aiplatform.v1beta1.Port.Builder builderForValue) { + if (grpcPortsBuilder_ == null) { + ensureGrpcPortsIsMutable(); + grpcPorts_.set(index, builderForValue.build()); + onChanged(); + } else { + grpcPortsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addGrpcPorts(com.google.cloud.aiplatform.v1beta1.Port value) { + if (grpcPortsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGrpcPortsIsMutable(); + grpcPorts_.add(value); + onChanged(); + } else { + grpcPortsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addGrpcPorts(int index, com.google.cloud.aiplatform.v1beta1.Port value) { + if (grpcPortsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureGrpcPortsIsMutable(); + grpcPorts_.add(index, value); + onChanged(); + } else { + grpcPortsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addGrpcPorts(com.google.cloud.aiplatform.v1beta1.Port.Builder builderForValue) { + if (grpcPortsBuilder_ == null) { + ensureGrpcPortsIsMutable(); + grpcPorts_.add(builderForValue.build()); + onChanged(); + } else { + grpcPortsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addGrpcPorts( + int index, com.google.cloud.aiplatform.v1beta1.Port.Builder builderForValue) { + if (grpcPortsBuilder_ == null) { + ensureGrpcPortsIsMutable(); + grpcPorts_.add(index, builderForValue.build()); + onChanged(); + } else { + grpcPortsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addAllGrpcPorts( + java.lang.Iterable values) { + if (grpcPortsBuilder_ == null) { + ensureGrpcPortsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, grpcPorts_); + onChanged(); + } else { + grpcPortsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder clearGrpcPorts() { + if (grpcPortsBuilder_ == null) { + grpcPorts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000080); + onChanged(); + } else { + grpcPortsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder removeGrpcPorts(int index) { + if (grpcPortsBuilder_ == null) { + ensureGrpcPortsIsMutable(); + grpcPorts_.remove(index); + onChanged(); + } else { + grpcPortsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1beta1.Port.Builder getGrpcPortsBuilder(int index) { + return getGrpcPortsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1beta1.PortOrBuilder getGrpcPortsOrBuilder(int index) { + if (grpcPortsBuilder_ == null) { + return grpcPorts_.get(index); + } else { + return grpcPortsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public java.util.List + getGrpcPortsOrBuilderList() { + if (grpcPortsBuilder_ != null) { + return grpcPortsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(grpcPorts_); + } + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1beta1.Port.Builder addGrpcPortsBuilder() { + return getGrpcPortsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1beta1.Port.getDefaultInstance()); + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1beta1.Port.Builder addGrpcPortsBuilder(int index) { + return getGrpcPortsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1beta1.Port.getDefaultInstance()); + } + /** + * + * + *
+     * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public java.util.List + getGrpcPortsBuilderList() { + return getGrpcPortsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Port, + com.google.cloud.aiplatform.v1beta1.Port.Builder, + com.google.cloud.aiplatform.v1beta1.PortOrBuilder> + getGrpcPortsFieldBuilder() { + if (grpcPortsBuilder_ == null) { + grpcPortsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1beta1.Port, + com.google.cloud.aiplatform.v1beta1.Port.Builder, + com.google.cloud.aiplatform.v1beta1.PortOrBuilder>( + grpcPorts_, ((bitField0_ & 0x00000080) != 0), getParentForChildren(), isClean()); + grpcPorts_ = null; + } + return grpcPortsBuilder_; + } + private com.google.protobuf.Duration deploymentTimeout_; private com.google.protobuf.SingleFieldBuilderV3< com.google.protobuf.Duration, @@ -5508,7 +6226,7 @@ public Builder setHealthRouteBytes(com.google.protobuf.ByteString value) { * @return Whether the deploymentTimeout field is set. */ public boolean hasDeploymentTimeout() { - return ((bitField0_ & 0x00000080) != 0); + return ((bitField0_ & 0x00000100) != 0); } /** * @@ -5554,7 +6272,7 @@ public Builder setDeploymentTimeout(com.google.protobuf.Duration value) { } else { deploymentTimeoutBuilder_.setMessage(value); } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return this; } @@ -5576,7 +6294,7 @@ public Builder setDeploymentTimeout(com.google.protobuf.Duration.Builder builder } else { deploymentTimeoutBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return this; } @@ -5594,7 +6312,7 @@ public Builder setDeploymentTimeout(com.google.protobuf.Duration.Builder builder */ public Builder mergeDeploymentTimeout(com.google.protobuf.Duration value) { if (deploymentTimeoutBuilder_ == null) { - if (((bitField0_ & 0x00000080) != 0) + if (((bitField0_ & 0x00000100) != 0) && deploymentTimeout_ != null && deploymentTimeout_ != com.google.protobuf.Duration.getDefaultInstance()) { getDeploymentTimeoutBuilder().mergeFrom(value); @@ -5604,7 +6322,7 @@ public Builder mergeDeploymentTimeout(com.google.protobuf.Duration value) { } else { deploymentTimeoutBuilder_.mergeFrom(value); } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return this; } @@ -5621,7 +6339,7 @@ public Builder mergeDeploymentTimeout(com.google.protobuf.Duration value) { * */ public Builder clearDeploymentTimeout() { - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000100); deploymentTimeout_ = null; if (deploymentTimeoutBuilder_ != null) { deploymentTimeoutBuilder_.dispose(); @@ -5643,7 +6361,7 @@ public Builder clearDeploymentTimeout() { * */ public com.google.protobuf.Duration.Builder getDeploymentTimeoutBuilder() { - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return getDeploymentTimeoutFieldBuilder().getBuilder(); } @@ -5730,7 +6448,7 @@ public long getSharedMemorySizeMb() { public Builder setSharedMemorySizeMb(long value) { sharedMemorySizeMb_ = value; - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; onChanged(); return this; } @@ -5747,7 +6465,7 @@ public Builder setSharedMemorySizeMb(long value) { * @return This builder for chaining. */ public Builder clearSharedMemorySizeMb() { - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000200); sharedMemorySizeMb_ = 0L; onChanged(); return this; @@ -5773,7 +6491,7 @@ public Builder clearSharedMemorySizeMb() { * @return Whether the startupProbe field is set. */ public boolean hasStartupProbe() { - return ((bitField0_ & 0x00000200) != 0); + return ((bitField0_ & 0x00000400) != 0); } /** * @@ -5817,7 +6535,7 @@ public Builder setStartupProbe(com.google.cloud.aiplatform.v1beta1.Probe value) } else { startupProbeBuilder_.setMessage(value); } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return this; } @@ -5839,7 +6557,7 @@ public Builder setStartupProbe( } else { startupProbeBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return this; } @@ -5856,7 +6574,7 @@ public Builder setStartupProbe( */ public Builder mergeStartupProbe(com.google.cloud.aiplatform.v1beta1.Probe value) { if (startupProbeBuilder_ == null) { - if (((bitField0_ & 0x00000200) != 0) + if (((bitField0_ & 0x00000400) != 0) && startupProbe_ != null && startupProbe_ != com.google.cloud.aiplatform.v1beta1.Probe.getDefaultInstance()) { getStartupProbeBuilder().mergeFrom(value); @@ -5866,7 +6584,7 @@ public Builder mergeStartupProbe(com.google.cloud.aiplatform.v1beta1.Probe value } else { startupProbeBuilder_.mergeFrom(value); } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return this; } @@ -5882,7 +6600,7 @@ public Builder mergeStartupProbe(com.google.cloud.aiplatform.v1beta1.Probe value * */ public Builder clearStartupProbe() { - bitField0_ = (bitField0_ & ~0x00000200); + bitField0_ = (bitField0_ & ~0x00000400); startupProbe_ = null; if (startupProbeBuilder_ != null) { startupProbeBuilder_.dispose(); @@ -5903,7 +6621,7 @@ public Builder clearStartupProbe() { * */ public com.google.cloud.aiplatform.v1beta1.Probe.Builder getStartupProbeBuilder() { - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return getStartupProbeFieldBuilder().getBuilder(); } @@ -5975,7 +6693,7 @@ public com.google.cloud.aiplatform.v1beta1.ProbeOrBuilder getStartupProbeOrBuild * @return Whether the healthProbe field is set. */ public boolean hasHealthProbe() { - return ((bitField0_ & 0x00000400) != 0); + return ((bitField0_ & 0x00000800) != 0); } /** * @@ -6019,7 +6737,7 @@ public Builder setHealthProbe(com.google.cloud.aiplatform.v1beta1.Probe value) { } else { healthProbeBuilder_.setMessage(value); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return this; } @@ -6041,7 +6759,7 @@ public Builder setHealthProbe( } else { healthProbeBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return this; } @@ -6058,7 +6776,7 @@ public Builder setHealthProbe( */ public Builder mergeHealthProbe(com.google.cloud.aiplatform.v1beta1.Probe value) { if (healthProbeBuilder_ == null) { - if (((bitField0_ & 0x00000400) != 0) + if (((bitField0_ & 0x00000800) != 0) && healthProbe_ != null && healthProbe_ != com.google.cloud.aiplatform.v1beta1.Probe.getDefaultInstance()) { getHealthProbeBuilder().mergeFrom(value); @@ -6068,7 +6786,7 @@ public Builder mergeHealthProbe(com.google.cloud.aiplatform.v1beta1.Probe value) } else { healthProbeBuilder_.mergeFrom(value); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return this; } @@ -6084,7 +6802,7 @@ public Builder mergeHealthProbe(com.google.cloud.aiplatform.v1beta1.Probe value) * */ public Builder clearHealthProbe() { - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000800); healthProbe_ = null; if (healthProbeBuilder_ != null) { healthProbeBuilder_.dispose(); @@ -6105,7 +6823,7 @@ public Builder clearHealthProbe() { * */ public com.google.cloud.aiplatform.v1beta1.Probe.Builder getHealthProbeBuilder() { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return getHealthProbeFieldBuilder().getBuilder(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelContainerSpecOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelContainerSpecOrBuilder.java index f0997cb0ee8e..a3ca3d1654d2 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelContainerSpecOrBuilder.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelContainerSpecOrBuilder.java @@ -1017,6 +1017,108 @@ public interface ModelContainerSpecOrBuilder */ com.google.protobuf.ByteString getHealthRouteBytes(); + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + java.util.List getGrpcPortsList(); + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + com.google.cloud.aiplatform.v1beta1.Port getGrpcPorts(int index); + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + int getGrpcPortsCount(); + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + java.util.List + getGrpcPortsOrBuilderList(); + /** + * + * + *
+   * 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 .google.cloud.aiplatform.v1beta1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + com.google.cloud.aiplatform.v1beta1.PortOrBuilder getGrpcPortsOrBuilder(int index); + /** * * diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelProto.java index d645022f09c7..42d1ea1d0aaa 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/ModelProto.java @@ -149,36 +149,38 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "~\n\017PredictSchemata\022!\n\023instance_schema_ur" + "i\030\001 \001(\tB\004\342A\001\005\022#\n\025parameters_schema_uri\030\002" + " \001(\tB\004\342A\001\005\022#\n\025prediction_schema_uri\030\003 \001(" - + "\tB\004\342A\001\005\"\365\003\n\022ModelContainerSpec\022\030\n\timage_" + + "\tB\004\342A\001\005\"\266\004\n\022ModelContainerSpec\022\030\n\timage_" + "uri\030\001 \001(\tB\005\342A\002\002\005\022\025\n\007command\030\002 \003(\tB\004\342A\001\005\022" + "\022\n\004args\030\003 \003(\tB\004\342A\001\005\022:\n\003env\030\004 \003(\0132\'.googl" + "e.cloud.aiplatform.v1beta1.EnvVarB\004\342A\001\005\022" + ":\n\005ports\030\005 \003(\0132%.google.cloud.aiplatform" + ".v1beta1.PortB\004\342A\001\005\022\033\n\rpredict_route\030\006 \001" - + "(\tB\004\342A\001\005\022\032\n\014health_route\030\007 \001(\tB\004\342A\001\005\022;\n\022" - + "deployment_timeout\030\n \001(\0132\031.google.protob" - + "uf.DurationB\004\342A\001\005\022#\n\025shared_memory_size_" - + "mb\030\013 \001(\003B\004\342A\001\005\022C\n\rstartup_probe\030\014 \001(\0132&." - + "google.cloud.aiplatform.v1beta1.ProbeB\004\342" - + "A\001\005\022B\n\014health_probe\030\r \001(\0132&.google.cloud" - + ".aiplatform.v1beta1.ProbeB\004\342A\001\005\"\036\n\004Port\022" - + "\026\n\016container_port\030\003 \001(\005\"\353\001\n\017ModelSourceI" - + "nfo\022U\n\013source_type\030\001 \001(\0162@.google.cloud." - + "aiplatform.v1beta1.ModelSourceInfo.Model" - + "SourceType\022\014\n\004copy\030\002 \001(\010\"s\n\017ModelSourceT" - + "ype\022!\n\035MODEL_SOURCE_TYPE_UNSPECIFIED\020\000\022\n" - + "\n\006AUTOML\020\001\022\n\n\006CUSTOM\020\002\022\010\n\004BQML\020\003\022\020\n\014MODE" - + "L_GARDEN\020\004\022\t\n\005GENIE\020\005\"\250\001\n\005Probe\022A\n\004exec\030" - + "\001 \001(\01321.google.cloud.aiplatform.v1beta1." - + "Probe.ExecActionH\000\022\026\n\016period_seconds\030\002 \001" - + "(\005\022\027\n\017timeout_seconds\030\003 \001(\005\032\035\n\nExecActio" - + "n\022\017\n\007command\030\001 \003(\tB\014\n\nprobe_typeB\341\001\n#com" - + ".google.cloud.aiplatform.v1beta1B\nModelP" - + "rotoP\001ZCcloud.google.com/go/aiplatform/a" - + "piv1beta1/aiplatformpb;aiplatformpb\252\002\037Go" - + "ogle.Cloud.AIPlatform.V1Beta1\312\002\037Google\\C" - + "loud\\AIPlatform\\V1beta1\352\002\"Google::Cloud:" - + ":AIPlatform::V1beta1b\006proto3" + + "(\tB\004\342A\001\005\022\032\n\014health_route\030\007 \001(\tB\004\342A\001\005\022?\n\n" + + "grpc_ports\030\t \003(\0132%.google.cloud.aiplatfo" + + "rm.v1beta1.PortB\004\342A\001\005\022;\n\022deployment_time" + + "out\030\n \001(\0132\031.google.protobuf.DurationB\004\342A" + + "\001\005\022#\n\025shared_memory_size_mb\030\013 \001(\003B\004\342A\001\005\022" + + "C\n\rstartup_probe\030\014 \001(\0132&.google.cloud.ai" + + "platform.v1beta1.ProbeB\004\342A\001\005\022B\n\014health_p" + + "robe\030\r \001(\0132&.google.cloud.aiplatform.v1b" + + "eta1.ProbeB\004\342A\001\005\"\036\n\004Port\022\026\n\016container_po" + + "rt\030\003 \001(\005\"\353\001\n\017ModelSourceInfo\022U\n\013source_t" + + "ype\030\001 \001(\0162@.google.cloud.aiplatform.v1be" + + "ta1.ModelSourceInfo.ModelSourceType\022\014\n\004c" + + "opy\030\002 \001(\010\"s\n\017ModelSourceType\022!\n\035MODEL_SO" + + "URCE_TYPE_UNSPECIFIED\020\000\022\n\n\006AUTOML\020\001\022\n\n\006C" + + "USTOM\020\002\022\010\n\004BQML\020\003\022\020\n\014MODEL_GARDEN\020\004\022\t\n\005G" + + "ENIE\020\005\"\250\001\n\005Probe\022A\n\004exec\030\001 \001(\01321.google." + + "cloud.aiplatform.v1beta1.Probe.ExecActio" + + "nH\000\022\026\n\016period_seconds\030\002 \001(\005\022\027\n\017timeout_s" + + "econds\030\003 \001(\005\032\035\n\nExecAction\022\017\n\007command\030\001 " + + "\003(\tB\014\n\nprobe_typeB\341\001\n#com.google.cloud.a" + + "iplatform.v1beta1B\nModelProtoP\001ZCcloud.g" + + "oogle.com/go/aiplatform/apiv1beta1/aipla" + + "tformpb;aiplatformpb\252\002\037Google.Cloud.AIPl" + + "atform.V1Beta1\312\002\037Google\\Cloud\\AIPlatform" + + "\\V1beta1\352\002\"Google::Cloud::AIPlatform::V1" + + "beta1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -282,6 +284,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Ports", "PredictRoute", "HealthRoute", + "GrpcPorts", "DeploymentTimeout", "SharedMemorySizeMb", "StartupProbe", diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceProto.java index 0b77cddd9ece..b59bfc69be0f 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/PredictionServiceProto.java @@ -39,6 +39,22 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_aiplatform_v1beta1_RawPredictRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1beta1_RawPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -47,6 +63,14 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -107,92 +131,128 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\021RawPredictRequest\022=\n\010endpoint\030\001 \001(\tB+\342A" + "\001\002\372A$\n\"aiplatform.googleapis.com/Endpoin" + "t\022\'\n\thttp_body\030\002 \001(\0132\024.google.api.HttpBo" - + "dy\"\316\001\n\027StreamingPredictRequest\022=\n\010endpoi" + + "dy\"\313\001\n\024DirectPredictRequest\022=\n\010endpoint\030" + + "\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapis.co" + + "m/Endpoint\0227\n\006inputs\030\002 \003(\0132\'.google.clou" + + "d.aiplatform.v1beta1.Tensor\022;\n\nparameter" + + "s\030\003 \001(\0132\'.google.cloud.aiplatform.v1beta" + + "1.Tensor\"\216\001\n\025DirectPredictResponse\0228\n\007ou" + + "tputs\030\001 \003(\0132\'.google.cloud.aiplatform.v1" + + "beta1.Tensor\022;\n\nparameters\030\002 \001(\0132\'.googl" + + "e.cloud.aiplatform.v1beta1.Tensor\"|\n\027Dir" + + "ectRawPredictRequest\022=\n\010endpoint\030\001 \001(\tB+" + + "\342A\001\002\372A$\n\"aiplatform.googleapis.com/Endpo" + + "int\022\023\n\013method_name\030\002 \001(\t\022\r\n\005input\030\003 \001(\014\"" + + "*\n\030DirectRawPredictResponse\022\016\n\006output\030\001 " + + "\001(\014\"\316\001\n\027StreamingPredictRequest\022=\n\010endpo" + + "int\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapi" + + "s.com/Endpoint\0227\n\006inputs\030\002 \003(\0132\'.google." + + "cloud.aiplatform.v1beta1.Tensor\022;\n\nparam" + + "eters\030\003 \001(\0132\'.google.cloud.aiplatform.v1" + + "beta1.Tensor\"\221\001\n\030StreamingPredictRespons" + + "e\0228\n\007outputs\030\001 \003(\0132\'.google.cloud.aiplat" + + "form.v1beta1.Tensor\022;\n\nparameters\030\002 \001(\0132" + + "\'.google.cloud.aiplatform.v1beta1.Tensor" + + "\"\177\n\032StreamingRawPredictRequest\022=\n\010endpoi" + "nt\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapis" - + ".com/Endpoint\0227\n\006inputs\030\002 \003(\0132\'.google.c" - + "loud.aiplatform.v1beta1.Tensor\022;\n\nparame" - + "ters\030\003 \001(\0132\'.google.cloud.aiplatform.v1b" - + "eta1.Tensor\"\221\001\n\030StreamingPredictResponse" - + "\0228\n\007outputs\030\001 \003(\0132\'.google.cloud.aiplatf" - + "orm.v1beta1.Tensor\022;\n\nparameters\030\002 \001(\0132\'" - + ".google.cloud.aiplatform.v1beta1.Tensor\"" - + "\266\004\n\016ExplainRequest\022=\n\010endpoint\030\001 \001(\tB+\342A" - + "\001\002\372A$\n\"aiplatform.googleapis.com/Endpoin" - + "t\022/\n\tinstances\030\002 \003(\0132\026.google.protobuf.V" - + "alueB\004\342A\001\002\022*\n\nparameters\030\004 \001(\0132\026.google." - + "protobuf.Value\022[\n\031explanation_spec_overr" - + "ide\030\005 \001(\01328.google.cloud.aiplatform.v1be" - + "ta1.ExplanationSpecOverride\022\212\001\n$concurre" - + "nt_explanation_spec_override\030\006 \003(\0132V.goo" - + "gle.cloud.aiplatform.v1beta1.ExplainRequ" - + "est.ConcurrentExplanationSpecOverrideEnt" - + "ryB\004\342A\001\001\022\031\n\021deployed_model_id\030\003 \001(\t\032\202\001\n&" - + "ConcurrentExplanationSpecOverrideEntry\022\013" - + "\n\003key\030\001 \001(\t\022G\n\005value\030\002 \001(\01328.google.clou" + + ".com/Endpoint\022\023\n\013method_name\030\002 \001(\t\022\r\n\005in" + + "put\030\003 \001(\014\"-\n\033StreamingRawPredictResponse" + + "\022\016\n\006output\030\001 \001(\014\"\266\004\n\016ExplainRequest\022=\n\010e" + + "ndpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googl" + + "eapis.com/Endpoint\022/\n\tinstances\030\002 \003(\0132\026." + + "google.protobuf.ValueB\004\342A\001\002\022*\n\nparameter" + + "s\030\004 \001(\0132\026.google.protobuf.Value\022[\n\031expla" + + "nation_spec_override\030\005 \001(\01328.google.clou" + "d.aiplatform.v1beta1.ExplanationSpecOver" - + "ride:\0028\001\"\361\003\n\017ExplainResponse\022B\n\014explanat" - + "ions\030\001 \003(\0132,.google.cloud.aiplatform.v1b" - + "eta1.Explanation\022m\n\027concurrent_explanati" - + "ons\030\004 \003(\0132L.google.cloud.aiplatform.v1be" + + "ride\022\212\001\n$concurrent_explanation_spec_ove" + + "rride\030\006 \003(\0132V.google.cloud.aiplatform.v1" + + "beta1.ExplainRequest.ConcurrentExplanati" + + "onSpecOverrideEntryB\004\342A\001\001\022\031\n\021deployed_mo" + + "del_id\030\003 \001(\t\032\202\001\n&ConcurrentExplanationSp" + + "ecOverrideEntry\022\013\n\003key\030\001 \001(\t\022G\n\005value\030\002 " + + "\001(\01328.google.cloud.aiplatform.v1beta1.Ex" + + "planationSpecOverride:\0028\001\"\361\003\n\017ExplainRes" + + "ponse\022B\n\014explanations\030\001 \003(\0132,.google.clo" + + "ud.aiplatform.v1beta1.Explanation\022m\n\027con" + + "current_explanations\030\004 \003(\0132L.google.clou" + + "d.aiplatform.v1beta1.ExplainResponse.Con" + + "currentExplanationsEntry\022\031\n\021deployed_mod" + + "el_id\030\002 \001(\t\022+\n\013predictions\030\003 \003(\0132\026.googl" + + "e.protobuf.Value\032[\n\025ConcurrentExplanatio" + + "n\022B\n\014explanations\030\001 \003(\0132,.google.cloud.a" + + "iplatform.v1beta1.Explanation\032\205\001\n\033Concur" + + "rentExplanationsEntry\022\013\n\003key\030\001 \001(\t\022U\n\005va" + + "lue\030\002 \001(\0132F.google.cloud.aiplatform.v1be" + "ta1.ExplainResponse.ConcurrentExplanatio" - + "nsEntry\022\031\n\021deployed_model_id\030\002 \001(\t\022+\n\013pr" - + "edictions\030\003 \003(\0132\026.google.protobuf.Value\032" - + "[\n\025ConcurrentExplanation\022B\n\014explanations" - + "\030\001 \003(\0132,.google.cloud.aiplatform.v1beta1" - + ".Explanation\032\205\001\n\033ConcurrentExplanationsE" - + "ntry\022\013\n\003key\030\001 \001(\t\022U\n\005value\030\002 \001(\0132F.googl" - + "e.cloud.aiplatform.v1beta1.ExplainRespon" - + "se.ConcurrentExplanation:\0028\001\"\204\001\n\022CountTo" - + "kensRequest\022=\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"" - + "aiplatform.googleapis.com/Endpoint\022/\n\tin" - + "stances\030\002 \003(\0132\026.google.protobuf.ValueB\004\342" - + "A\001\002\"N\n\023CountTokensResponse\022\024\n\014total_toke" - + "ns\030\001 \001(\005\022!\n\031total_billable_characters\030\002 " - + "\001(\0052\211\014\n\021PredictionService\022\250\002\n\007Predict\022/." - + "google.cloud.aiplatform.v1beta1.PredictR" - + "equest\0320.google.cloud.aiplatform.v1beta1" - + ".PredictResponse\"\271\001\332A\035endpoint,instances" - + ",parameters\202\323\344\223\002\222\001\">/v1beta1/{endpoint=p" - + "rojects/*/locations/*/endpoints/*}:predi" - + "ct:\001*ZM\"H/v1beta1/{endpoint=projects/*/l" - + "ocations/*/publishers/*/models/*}:predic" - + "t:\001*\022\215\002\n\nRawPredict\0222.google.cloud.aipla" - + "tform.v1beta1.RawPredictRequest\032\024.google" - + ".api.HttpBody\"\264\001\332A\022endpoint,http_body\202\323\344" - + "\223\002\230\001\"A/v1beta1/{endpoint=projects/*/loca" - + "tions/*/endpoints/*}:rawPredict:\001*ZP\"K/v" - + "1beta1/{endpoint=projects/*/locations/*/" - + "publishers/*/models/*}:rawPredict:\001*\022\311\002\n" - + "\026ServerStreamingPredict\0228.google.cloud.a" - + "iplatform.v1beta1.StreamingPredictReques" - + "t\0329.google.cloud.aiplatform.v1beta1.Stre" - + "amingPredictResponse\"\267\001\202\323\344\223\002\260\001\"M/v1beta1" + + "n:\0028\001\"\204\001\n\022CountTokensRequest\022=\n\010endpoint" + + "\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapis.c" + + "om/Endpoint\022/\n\tinstances\030\002 \003(\0132\026.google." + + "protobuf.ValueB\004\342A\001\002\"N\n\023CountTokensRespo" + + "nse\022\024\n\014total_tokens\030\001 \001(\005\022!\n\031total_billa" + + "ble_characters\030\002 \001(\0052\342\021\n\021PredictionServi" + + "ce\022\250\002\n\007Predict\022/.google.cloud.aiplatform" + + ".v1beta1.PredictRequest\0320.google.cloud.a" + + "iplatform.v1beta1.PredictResponse\"\271\001\332A\035e" + + "ndpoint,instances,parameters\202\323\344\223\002\222\001\">/v1" + + "beta1/{endpoint=projects/*/locations/*/e" + + "ndpoints/*}:predict:\001*ZM\"H/v1beta1/{endp" + + "oint=projects/*/locations/*/publishers/*" + + "/models/*}:predict:\001*\022\215\002\n\nRawPredict\0222.g" + + "oogle.cloud.aiplatform.v1beta1.RawPredic" + + "tRequest\032\024.google.api.HttpBody\"\264\001\332A\022endp" + + "oint,http_body\202\323\344\223\002\230\001\"A/v1beta1/{endpoin" + + "t=projects/*/locations/*/endpoints/*}:ra" + + "wPredict:\001*ZP\"K/v1beta1/{endpoint=projec" + + "ts/*/locations/*/publishers/*/models/*}:" + + "rawPredict:\001*\022\317\001\n\rDirectPredict\0225.google" + + ".cloud.aiplatform.v1beta1.DirectPredictR" + + "equest\0326.google.cloud.aiplatform.v1beta1" + + ".DirectPredictResponse\"O\202\323\344\223\002I\"D/v1beta1" + "/{endpoint=projects/*/locations/*/endpoi" - + "nts/*}:serverStreamingPredict:\001*Z\\\"W/v1b" - + "eta1/{endpoint=projects/*/locations/*/pu" - + "blishers/*/models/*}:serverStreamingPred" - + "ict:\001*0\001\022\351\001\n\007Explain\022/.google.cloud.aipl" - + "atform.v1beta1.ExplainRequest\0320.google.c" - + "loud.aiplatform.v1beta1.ExplainResponse\"" - + "{\332A/endpoint,instances,parameters,deploy" - + "ed_model_id\202\323\344\223\002C\">/v1beta1/{endpoint=pr" - + "ojects/*/locations/*/endpoints/*}:explai" - + "n:\001*\022\261\002\n\013CountTokens\0223.google.cloud.aipl" - + "atform.v1beta1.CountTokensRequest\0324.goog" - + "le.cloud.aiplatform.v1beta1.CountTokensR" - + "esponse\"\266\001\332A\022endpoint,instances\202\323\344\223\002\232\001\"B" - + "/v1beta1/{endpoint=projects/*/locations/" - + "*/endpoints/*}:countTokens:\001*ZQ\"L/v1beta" - + "1/{endpoint=projects/*/locations/*/publi" - + "shers/*/models/*}:countTokens:\001*\032M\312A\031aip" - + "latform.googleapis.com\322A.https://www.goo" - + "gleapis.com/auth/cloud-platformB\355\001\n#com." - + "google.cloud.aiplatform.v1beta1B\026Predict" - + "ionServiceProtoP\001ZCcloud.google.com/go/a" - + "iplatform/apiv1beta1/aiplatformpb;aiplat" - + "formpb\252\002\037Google.Cloud.AIPlatform.V1Beta1" - + "\312\002\037Google\\Cloud\\AIPlatform\\V1beta1\352\002\"Goo" - + "gle::Cloud::AIPlatform::V1beta1b\006proto3" + + "nts/*}:directPredict:\001*\022\333\001\n\020DirectRawPre" + + "dict\0228.google.cloud.aiplatform.v1beta1.D" + + "irectRawPredictRequest\0329.google.cloud.ai" + + "platform.v1beta1.DirectRawPredictRespons" + + "e\"R\202\323\344\223\002L\"G/v1beta1/{endpoint=projects/*" + + "/locations/*/endpoints/*}:directRawPredi" + + "ct:\001*\022\215\001\n\020StreamingPredict\0228.google.clou" + + "d.aiplatform.v1beta1.StreamingPredictReq" + + "uest\0329.google.cloud.aiplatform.v1beta1.S" + + "treamingPredictResponse\"\000(\0010\001\022\311\002\n\026Server" + + "StreamingPredict\0228.google.cloud.aiplatfo" + + "rm.v1beta1.StreamingPredictRequest\0329.goo" + + "gle.cloud.aiplatform.v1beta1.StreamingPr" + + "edictResponse\"\267\001\202\323\344\223\002\260\001\"M/v1beta1/{endpo" + + "int=projects/*/locations/*/endpoints/*}:" + + "serverStreamingPredict:\001*Z\\\"W/v1beta1/{e" + + "ndpoint=projects/*/locations/*/publisher" + + "s/*/models/*}:serverStreamingPredict:\001*0" + + "\001\022\226\001\n\023StreamingRawPredict\022;.google.cloud" + + ".aiplatform.v1beta1.StreamingRawPredictR" + + "equest\032<.google.cloud.aiplatform.v1beta1" + + ".StreamingRawPredictResponse\"\000(\0010\001\022\351\001\n\007E" + + "xplain\022/.google.cloud.aiplatform.v1beta1" + + ".ExplainRequest\0320.google.cloud.aiplatfor" + + "m.v1beta1.ExplainResponse\"{\332A/endpoint,i" + + "nstances,parameters,deployed_model_id\202\323\344" + + "\223\002C\">/v1beta1/{endpoint=projects/*/locat" + + "ions/*/endpoints/*}:explain:\001*\022\261\002\n\013Count" + + "Tokens\0223.google.cloud.aiplatform.v1beta1" + + ".CountTokensRequest\0324.google.cloud.aipla" + + "tform.v1beta1.CountTokensResponse\"\266\001\332A\022e" + + "ndpoint,instances\202\323\344\223\002\232\001\"B/v1beta1/{endp" + + "oint=projects/*/locations/*/endpoints/*}" + + ":countTokens:\001*ZQ\"L/v1beta1/{endpoint=pr" + + "ojects/*/locations/*/publishers/*/models" + + "/*}:countTokens:\001*\032M\312A\031aiplatform.google" + + "apis.com\322A.https://www.googleapis.com/au" + + "th/cloud-platformB\355\001\n#com.google.cloud.a" + + "iplatform.v1beta1B\026PredictionServiceProt" + + "oP\001ZCcloud.google.com/go/aiplatform/apiv" + + "1beta1/aiplatformpb;aiplatformpb\252\002\037Googl" + + "e.Cloud.AIPlatform.V1Beta1\312\002\037Google\\Clou" + + "d\\AIPlatform\\V1beta1\352\002\"Google::Cloud::AI" + + "Platform::V1beta1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -236,8 +296,40 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Endpoint", "HttpBody", }); - internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor = + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_descriptor = getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictRequest_descriptor, + new java.lang.String[] { + "Endpoint", "Inputs", "Parameters", + }); + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_DirectPredictResponse_descriptor, + new java.lang.String[] { + "Outputs", "Parameters", + }); + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictRequest_descriptor, + new java.lang.String[] { + "Endpoint", "MethodName", "Input", + }); + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_DirectRawPredictResponse_descriptor, + new java.lang.String[] { + "Output", + }); + internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor = + getDescriptor().getMessageTypes().get(7); internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictRequest_descriptor, @@ -245,15 +337,31 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Endpoint", "Inputs", "Parameters", }); internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageTypes().get(8); internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_StreamingPredictResponse_descriptor, new java.lang.String[] { "Outputs", "Parameters", }); + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_descriptor, + new java.lang.String[] { + "Endpoint", "MethodName", "Input", + }); + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_descriptor, + new java.lang.String[] { + "Output", + }); internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_descriptor = - getDescriptor().getMessageTypes().get(5); + getDescriptor().getMessageTypes().get(11); internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_ExplainRequest_descriptor, @@ -276,7 +384,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_aiplatform_v1beta1_ExplainResponse_descriptor = - getDescriptor().getMessageTypes().get(6); + getDescriptor().getMessageTypes().get(12); internal_static_google_cloud_aiplatform_v1beta1_ExplainResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_ExplainResponse_descriptor, @@ -304,7 +412,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Key", "Value", }); internal_static_google_cloud_aiplatform_v1beta1_CountTokensRequest_descriptor = - getDescriptor().getMessageTypes().get(7); + getDescriptor().getMessageTypes().get(13); internal_static_google_cloud_aiplatform_v1beta1_CountTokensRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_CountTokensRequest_descriptor, @@ -312,7 +420,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Endpoint", "Instances", }); internal_static_google_cloud_aiplatform_v1beta1_CountTokensResponse_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageTypes().get(14); internal_static_google_cloud_aiplatform_v1beta1_CountTokensResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1beta1_CountTokensResponse_descriptor, diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictRequest.java new file mode 100644 index 000000000000..fc8fb42c384d --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictRequest.java @@ -0,0 +1,1003 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * 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.
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest} + */ +public final class StreamingRawPredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) + StreamingRawPredictRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingRawPredictRequest.newBuilder() to construct. + private StreamingRawPredictRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingRawPredictRequest() { + endpoint_ = ""; + methodName_ = ""; + input_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingRawPredictRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.class, + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.Builder.class); + } + + public static final int ENDPOINT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object endpoint_ = ""; + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The endpoint. + */ + @java.lang.Override + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } + } + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int METHOD_NAME_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object methodName_ = ""; + /** + * + * + *
+   * 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; + * + * @return The methodName. + */ + @java.lang.Override + public java.lang.String getMethodName() { + java.lang.Object ref = methodName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + methodName_ = s; + return s; + } + } + /** + * + * + *
+   * 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; + * + * @return The bytes for methodName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMethodNameBytes() { + java.lang.Object ref = methodName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + methodName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INPUT_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString input_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * bytes input = 3; + * + * @return The input. + */ + @java.lang.Override + public com.google.protobuf.ByteString getInput() { + return input_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, endpoint_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(methodName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, methodName_); + } + if (!input_.isEmpty()) { + output.writeBytes(3, input_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(endpoint_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, endpoint_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(methodName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, methodName_); + } + if (!input_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, input_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest other = + (com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) obj; + + if (!getEndpoint().equals(other.getEndpoint())) return false; + if (!getMethodName().equals(other.getMethodName())) return false; + if (!getInput().equals(other.getInput())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + ENDPOINT_FIELD_NUMBER; + hash = (53 * hash) + getEndpoint().hashCode(); + hash = (37 * hash) + METHOD_NAME_FIELD_NUMBER; + hash = (53 * hash) + getMethodName().hashCode(); + hash = (37 * hash) + INPUT_FIELD_NUMBER; + hash = (53 * hash) + getInput().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * 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.
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.class, + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + endpoint_ = ""; + methodName_ = ""; + input_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest build() { + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest buildPartial() { + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest result = + new com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.endpoint_ = endpoint_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.methodName_ = methodName_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.input_ = input_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest other) { + if (other + == com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest.getDefaultInstance()) + return this; + if (!other.getEndpoint().isEmpty()) { + endpoint_ = other.endpoint_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getMethodName().isEmpty()) { + methodName_ = other.methodName_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.getInput() != com.google.protobuf.ByteString.EMPTY) { + setInput(other.getInput()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + endpoint_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + methodName_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input_ = input.readBytes(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object endpoint_ = ""; + /** + * + * + *
+     * 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) = { ... } + * + * + * @return The endpoint. + */ + public java.lang.String getEndpoint() { + java.lang.Object ref = endpoint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + endpoint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + public com.google.protobuf.ByteString getEndpointBytes() { + java.lang.Object ref = endpoint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + endpoint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @param value The endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpoint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearEndpoint() { + endpoint_ = getDefaultInstance().getEndpoint(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * 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) = { ... } + * + * + * @param value The bytes for endpoint to set. + * @return This builder for chaining. + */ + public Builder setEndpointBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + endpoint_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object methodName_ = ""; + /** + * + * + *
+     * 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; + * + * @return The methodName. + */ + public java.lang.String getMethodName() { + java.lang.Object ref = methodName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + methodName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * 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; + * + * @return The bytes for methodName. + */ + public com.google.protobuf.ByteString getMethodNameBytes() { + java.lang.Object ref = methodName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + methodName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * 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; + * + * @param value The methodName to set. + * @return This builder for chaining. + */ + public Builder setMethodName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + methodName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * 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; + * + * @return This builder for chaining. + */ + public Builder clearMethodName() { + methodName_ = getDefaultInstance().getMethodName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * 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; + * + * @param value The bytes for methodName to set. + * @return This builder for chaining. + */ + public Builder setMethodNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + methodName_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString input_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * bytes input = 3; + * + * @return The input. + */ + @java.lang.Override + public com.google.protobuf.ByteString getInput() { + return input_; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * bytes input = 3; + * + * @param value The input to set. + * @return This builder for chaining. + */ + public Builder setInput(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + input_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * bytes input = 3; + * + * @return This builder for chaining. + */ + public Builder clearInput() { + bitField0_ = (bitField0_ & ~0x00000004); + input_ = getDefaultInstance().getInput(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) + private static final com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest(); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingRawPredictRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictRequestOrBuilder.java new file mode 100644 index 000000000000..69144c6fb323 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictRequestOrBuilder.java @@ -0,0 +1,108 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface StreamingRawPredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The endpoint. + */ + java.lang.String getEndpoint(); + /** + * + * + *
+   * 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) = { ... } + * + * + * @return The bytes for endpoint. + */ + com.google.protobuf.ByteString getEndpointBytes(); + + /** + * + * + *
+   * 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; + * + * @return The methodName. + */ + java.lang.String getMethodName(); + /** + * + * + *
+   * 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; + * + * @return The bytes for methodName. + */ + com.google.protobuf.ByteString getMethodNameBytes(); + + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * bytes input = 3; + * + * @return The input. + */ + com.google.protobuf.ByteString getInput(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictResponse.java new file mode 100644 index 000000000000..10edcfdd7a91 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictResponse.java @@ -0,0 +1,548 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +/** + * + * + *
+ * Response message for
+ * [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingRawPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse} + */ +public final class StreamingRawPredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) + StreamingRawPredictResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use StreamingRawPredictResponse.newBuilder() to construct. + private StreamingRawPredictResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private StreamingRawPredictResponse() { + output_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new StreamingRawPredictResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.class, + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.Builder.class); + } + + public static final int OUTPUT_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString output_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * bytes output = 1; + * + * @return The output. + */ + @java.lang.Override + public com.google.protobuf.ByteString getOutput() { + return output_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!output_.isEmpty()) { + output.writeBytes(1, output_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!output_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, output_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse other = + (com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) obj; + + if (!getOutput().equals(other.getOutput())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + OUTPUT_FIELD_NUMBER; + hash = (53 * hash) + getOutput().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for
+   * [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1beta1.PredictionService.StreamingRawPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.class, + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + output_ = com.google.protobuf.ByteString.EMPTY; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.aiplatform.v1beta1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1beta1_StreamingRawPredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse build() { + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse buildPartial() { + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse result = + new com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.output_ = output_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse other) { + if (other + == com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse.getDefaultInstance()) + return this; + if (other.getOutput() != com.google.protobuf.ByteString.EMPTY) { + setOutput(other.getOutput()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + output_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.ByteString output_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * bytes output = 1; + * + * @return The output. + */ + @java.lang.Override + public com.google.protobuf.ByteString getOutput() { + return output_; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * bytes output = 1; + * + * @param value The output to set. + * @return This builder for chaining. + */ + public Builder setOutput(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + output_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * bytes output = 1; + * + * @return This builder for chaining. + */ + public Builder clearOutput() { + bitField0_ = (bitField0_ & ~0x00000001); + output_ = getDefaultInstance().getOutput(); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) + private static final com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse(); + } + + public static com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public StreamingRawPredictResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictResponseOrBuilder.java new file mode 100644 index 000000000000..fc21d8cf27ec --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/java/com/google/cloud/aiplatform/v1beta1/StreamingRawPredictResponseOrBuilder.java @@ -0,0 +1,38 @@ +/* + * 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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/aiplatform/v1beta1/prediction_service.proto + +package com.google.cloud.aiplatform.v1beta1; + +public interface StreamingRawPredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * bytes output = 1; + * + * @return The output. + */ + com.google.protobuf.ByteString getOutput(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/model.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/model.proto index 10bf0807c107..ebe344577197 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/model.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/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/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/prediction_service.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/prediction_service.proto index 55b67ed4add6..f5bb5d616c17 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/google/cloud/aiplatform/v1beta1/prediction_service.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1beta1/src/main/proto/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/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directpredict/AsyncDirectPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directpredict/AsyncDirectPredict.java new file mode 100644 index 000000000000..9a33a509160e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directpredict/AsyncDirectPredict.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_DirectPredict_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.Tensor; +import java.util.ArrayList; + +public class AsyncDirectPredict { + + public static void main(String[] args) throws Exception { + asyncDirectPredict(); + } + + public static void asyncDirectPredict() throws Exception { + // 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. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + DirectPredictRequest request = + DirectPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + ApiFuture future = + predictionServiceClient.directPredictCallable().futureCall(request); + // Do something. + DirectPredictResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_DirectPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directpredict/SyncDirectPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directpredict/SyncDirectPredict.java new file mode 100644 index 000000000000..db4ee61ae58e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directpredict/SyncDirectPredict.java @@ -0,0 +1,53 @@ +/* + * 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. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_DirectPredict_sync] +import com.google.cloud.aiplatform.v1beta1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.Tensor; +import java.util.ArrayList; + +public class SyncDirectPredict { + + public static void main(String[] args) throws Exception { + syncDirectPredict(); + } + + public static void syncDirectPredict() throws Exception { + // 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. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + DirectPredictRequest request = + DirectPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + DirectPredictResponse response = predictionServiceClient.directPredict(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_DirectPredict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directrawpredict/AsyncDirectRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directrawpredict/AsyncDirectRawPredict.java new file mode 100644 index 000000000000..c26898d79190 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directrawpredict/AsyncDirectRawPredict.java @@ -0,0 +1,56 @@ +/* + * 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. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_DirectRawPredict_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.ByteString; + +public class AsyncDirectRawPredict { + + public static void main(String[] args) throws Exception { + asyncDirectRawPredict(); + } + + public static void asyncDirectRawPredict() throws Exception { + // 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. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + DirectRawPredictRequest request = + DirectRawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setMethodName("methodName-723163380") + .setInput(ByteString.EMPTY) + .build(); + ApiFuture future = + predictionServiceClient.directRawPredictCallable().futureCall(request); + // Do something. + DirectRawPredictResponse response = future.get(); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_DirectRawPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directrawpredict/SyncDirectRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directrawpredict/SyncDirectRawPredict.java new file mode 100644 index 000000000000..fa1bceea724e --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/directrawpredict/SyncDirectRawPredict.java @@ -0,0 +1,52 @@ +/* + * 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. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_DirectRawPredict_sync] +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.DirectRawPredictResponse; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.protobuf.ByteString; + +public class SyncDirectRawPredict { + + public static void main(String[] args) throws Exception { + syncDirectRawPredict(); + } + + public static void syncDirectRawPredict() throws Exception { + // 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. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + DirectRawPredictRequest request = + DirectRawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setMethodName("methodName-723163380") + .setInput(ByteString.EMPTY) + .build(); + DirectRawPredictResponse response = predictionServiceClient.directRawPredict(request); + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_DirectRawPredict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/streamingpredict/AsyncStreamingPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/streamingpredict/AsyncStreamingPredict.java new file mode 100644 index 000000000000..d5047e5eac99 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/streamingpredict/AsyncStreamingPredict.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_StreamingPredict_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1beta1.Tensor; +import java.util.ArrayList; + +public class AsyncStreamingPredict { + + public static void main(String[] args) throws Exception { + asyncStreamingPredict(); + } + + public static void asyncStreamingPredict() throws Exception { + // 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. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + BidiStream bidiStream = + predictionServiceClient.streamingPredictCallable().call(); + StreamingPredictRequest request = + StreamingPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .addAllInputs(new ArrayList()) + .setParameters(Tensor.newBuilder().build()) + .build(); + bidiStream.send(request); + for (StreamingPredictResponse response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_StreamingPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/streamingrawpredict/AsyncStreamingRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/streamingrawpredict/AsyncStreamingRawPredict.java new file mode 100644 index 000000000000..47b5832916df --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1beta1/predictionservice/streamingrawpredict/AsyncStreamingRawPredict.java @@ -0,0 +1,58 @@ +/* + * 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. + */ + +package com.google.cloud.aiplatform.v1beta1.samples; + +// [START aiplatform_v1beta1_generated_PredictionService_StreamingRawPredict_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.aiplatform.v1beta1.EndpointName; +import com.google.cloud.aiplatform.v1beta1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1beta1.StreamingRawPredictRequest; +import com.google.cloud.aiplatform.v1beta1.StreamingRawPredictResponse; +import com.google.protobuf.ByteString; + +public class AsyncStreamingRawPredict { + + public static void main(String[] args) throws Exception { + asyncStreamingRawPredict(); + } + + public static void asyncStreamingRawPredict() throws Exception { + // 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. + // - It may require specifying regional endpoints when creating the service client as shown in + // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library + try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) { + BidiStream bidiStream = + predictionServiceClient.streamingRawPredictCallable().call(); + StreamingRawPredictRequest request = + StreamingRawPredictRequest.newBuilder() + .setEndpoint( + EndpointName.ofProjectLocationEndpointName( + "[PROJECT]", "[LOCATION]", "[ENDPOINT]") + .toString()) + .setMethodName("methodName-723163380") + .setInput(ByteString.EMPTY) + .build(); + bidiStream.send(request); + for (StreamingRawPredictResponse response : bidiStream) { + // Do something when a response is received. + } + } + } +} +// [END aiplatform_v1beta1_generated_PredictionService_StreamingRawPredict_async]