From de32d7a5c7738761b2cb30fb30b6b53836c9556c Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:26:22 -0500 Subject: [PATCH] feat: [aiplatform] add grpc_ports to UploadModel ModelContainerSpec (#10065) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add grpc_ports to UploadModel ModelContainerSpec feat: add DirectPredict to PredictionService feat: add DirectRawPredict to PredictionService feat: add StreamingPredict to PredictionService. feat: add StreamingRawPredict to PredictionService. PiperOrigin-RevId: 583502805 Source-Link: https://github.com/googleapis/googleapis/commit/31c70c91df94c85ee372de99a1a6cb061d018c17 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a041c3d8068cb99a1dcf83124d0cd63eba91a4c7 Copy-Tag: eyJwIjoiamF2YS1haXBsYXRmb3JtLy5Pd2xCb3QueWFtbCIsImgiOiJhMDQxYzNkODA2OGNiOTlhMWRjZjgzMTI0ZDBjZDYzZWJhOTFhNGM3In0= * 🦉 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 --- .../v1/PredictionServiceClient.java | 206 +++ .../v1/PredictionServiceSettings.java | 48 + .../cloud/aiplatform/v1/gapic_metadata.json | 12 + .../v1/stub/GrpcPredictionServiceStub.java | 126 ++ .../v1/stub/PredictionServiceStub.java | 26 + .../stub/PredictionServiceStubSettings.java | 97 ++ .../reflect-config.json | 108 ++ .../v1/MockPredictionServiceImpl.java | 116 ++ .../v1/PredictionServiceClientTest.java | 236 +++ .../aiplatform/v1/PredictionServiceGrpc.java | 439 ++++- .../aiplatform/v1/DirectPredictRequest.java | 1410 +++++++++++++++++ .../v1/DirectPredictRequestOrBuilder.java | 144 ++ .../aiplatform/v1/DirectPredictResponse.java | 1200 ++++++++++++++ .../v1/DirectPredictResponseOrBuilder.java | 112 ++ .../v1/DirectRawPredictRequest.java | 975 ++++++++++++ .../v1/DirectRawPredictRequestOrBuilder.java | 108 ++ .../v1/DirectRawPredictResponse.java | 541 +++++++ .../v1/DirectRawPredictResponseOrBuilder.java | 38 + .../aiplatform/v1/ModelContainerSpec.java | 779 ++++++++- .../v1/ModelContainerSpecOrBuilder.java | 102 ++ .../cloud/aiplatform/v1/ModelProto.java | 49 +- .../aiplatform/v1/PredictionServiceProto.java | 238 ++- .../v1/StreamingRawPredictRequest.java | 997 ++++++++++++ .../StreamingRawPredictRequestOrBuilder.java | 108 ++ .../v1/StreamingRawPredictResponse.java | 541 +++++++ .../StreamingRawPredictResponseOrBuilder.java | 38 + .../google/cloud/aiplatform/v1/model.proto | 11 + .../aiplatform/v1/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, 9152 insertions(+), 122 deletions(-) create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictRequest.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictRequestOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictResponse.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictResponseOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictRequest.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictRequestOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictResponse.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictResponseOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictRequest.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictRequestOrBuilder.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictResponse.java create mode 100644 java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictResponseOrBuilder.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directpredict/AsyncDirectPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directpredict/SyncDirectPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directrawpredict/AsyncDirectRawPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directrawpredict/SyncDirectRawPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/streamingpredict/AsyncStreamingPredict.java create mode 100644 java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/streamingrawpredict/AsyncStreamingRawPredict.java diff --git a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java index 3f192e8ed984..caa9360b932e 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java @@ -23,6 +23,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; @@ -536,6 +537,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. @@ -571,6 +741,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/v1/PredictionServiceSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceSettings.java index beedb36b2526..0ed59912d0e4 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceSettings.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/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.v1.stub.PredictionServiceStubSettings; @@ -95,12 +96,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(); @@ -240,12 +264,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/v1/gapic_metadata.json b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json index 8068a89d2445..251d47a17dbf 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json @@ -991,6 +991,12 @@ "grpc": { "libraryClient": "PredictionServiceClient", "rpcs": { + "DirectPredict": { + "methods": ["directPredict", "directPredictCallable"] + }, + "DirectRawPredict": { + "methods": ["directRawPredict", "directRawPredictCallable"] + }, "Explain": { "methods": ["explain", "explain", "explain", "explainCallable"] }, @@ -1015,6 +1021,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/v1/stub/GrpcPredictionServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcPredictionServiceStub.java index 461ffd2f68db..7e08db0e559c 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcPredictionServiceStub.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/GrpcPredictionServiceStub.java @@ -23,10 +23,15 @@ 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.v1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1.DirectRawPredictResponse; import com.google.cloud.aiplatform.v1.ExplainRequest; import com.google.cloud.aiplatform.v1.ExplainResponse; import com.google.cloud.aiplatform.v1.PredictRequest; @@ -34,6 +39,8 @@ import com.google.cloud.aiplatform.v1.RawPredictRequest; import com.google.cloud.aiplatform.v1.StreamingPredictRequest; import com.google.cloud.aiplatform.v1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1.StreamingRawPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingRawPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -74,6 +81,39 @@ 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.v1.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.v1.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.v1.PredictionService/StreamingPredict") + .setRequestMarshaller( + ProtoUtils.marshaller(StreamingPredictRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(StreamingPredictResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor serverStreamingPredictMethodDescriptor = MethodDescriptor.newBuilder() @@ -86,6 +126,17 @@ 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.v1.PredictionService/StreamingRawPredict") + .setRequestMarshaller( + ProtoUtils.marshaller(StreamingRawPredictRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(StreamingRawPredictResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor explainMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) @@ -142,8 +193,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 listLocationsCallable; private final UnaryCallable @@ -218,6 +276,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() @@ -229,6 +313,11 @@ protected GrpcPredictionServiceStub( return builder.build(); }) .build(); + GrpcCallSettings + streamingRawPredictTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(streamingRawPredictMethodDescriptor) + .build(); GrpcCallSettings explainTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(explainMethodDescriptor) @@ -297,11 +386,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); @@ -344,12 +447,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/v1/stub/PredictionServiceStub.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStub.java index 36417dbfc42e..9586de5e6be0 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStub.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStub.java @@ -20,8 +20,13 @@ import com.google.api.HttpBody; 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.v1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1.DirectRawPredictResponse; import com.google.cloud.aiplatform.v1.ExplainRequest; import com.google.cloud.aiplatform.v1.ExplainResponse; import com.google.cloud.aiplatform.v1.PredictRequest; @@ -29,6 +34,8 @@ import com.google.cloud.aiplatform.v1.RawPredictRequest; import com.google.cloud.aiplatform.v1.StreamingPredictRequest; import com.google.cloud.aiplatform.v1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1.StreamingRawPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingRawPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -57,11 +64,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/v1/stub/PredictionServiceStubSettings.java b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStubSettings.java index 09970c36306a..e5a6f19d3b8d 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStubSettings.java +++ b/java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/stub/PredictionServiceStubSettings.java @@ -38,10 +38,15 @@ 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.v1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1.DirectRawPredictResponse; import com.google.cloud.aiplatform.v1.ExplainRequest; import com.google.cloud.aiplatform.v1.ExplainResponse; import com.google.cloud.aiplatform.v1.PredictRequest; @@ -49,6 +54,8 @@ import com.google.cloud.aiplatform.v1.RawPredictRequest; import com.google.cloud.aiplatform.v1.StreamingPredictRequest; import com.google.cloud.aiplatform.v1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1.StreamingRawPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingRawPredictResponse; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; @@ -112,8 +119,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 PagedCallSettings< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> @@ -187,12 +202,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; @@ -302,7 +340,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(); listLocationsSettings = settingsBuilder.listLocationsSettings().build(); getLocationSettings = settingsBuilder.getLocationSettings().build(); @@ -316,9 +358,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 PagedCallSettings.Builder< ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> @@ -357,7 +408,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(); listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT); getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); @@ -369,6 +424,8 @@ protected Builder(ClientContext clientContext) { ImmutableList.>of( predictSettings, rawPredictSettings, + directPredictSettings, + directRawPredictSettings, explainSettings, listLocationsSettings, getLocationSettings, @@ -383,7 +440,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(); listLocationsSettings = settings.listLocationsSettings.toBuilder(); getLocationSettings = settings.getLocationSettings.toBuilder(); @@ -395,6 +456,8 @@ protected Builder(PredictionServiceStubSettings settings) { ImmutableList.>of( predictSettings, rawPredictSettings, + directPredictSettings, + directRawPredictSettings, explainSettings, listLocationsSettings, getLocationSettings, @@ -427,6 +490,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")) @@ -490,12 +563,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.v1/reflect-config.json b/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1/reflect-config.json index d4232da73a20..66f35c5c050d 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1/reflect-config.json +++ b/java-aiplatform/google-cloud-aiplatform/src/main/resources/META-INF/native-image/com.google.cloud.aiplatform.v1/reflect-config.json @@ -3689,6 +3689,78 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.DirectPredictRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.DirectPredictRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.DirectPredictResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.DirectPredictResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.DirectRawPredictRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.DirectRawPredictRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.DirectRawPredictResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.DirectRawPredictResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.DiskSpec", "queryAllDeclaredConstructors": true, @@ -11411,6 +11483,42 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.aiplatform.v1.StreamingRawPredictRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.StreamingRawPredictRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.StreamingRawPredictResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.aiplatform.v1.StreamingRawPredictResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.aiplatform.v1.StreamingReadFeatureValuesRequest", "queryAllDeclaredConstructors": true, diff --git a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockPredictionServiceImpl.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockPredictionServiceImpl.java index 93cfad302ead..705cec08717c 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/MockPredictionServiceImpl.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/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/v1/PredictionServiceClientTest.java b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/PredictionServiceClientTest.java index 70a4eacc9f76..15d6cc38007b 100644 --- a/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/PredictionServiceClientTest.java +++ b/java-aiplatform/google-cloud-aiplatform/src/test/java/com/google/cloud/aiplatform/v1/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-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceGrpc.java b/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceGrpc.java index 0693dba2b708..65c7c7701234 100644 --- a/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceGrpc.java +++ b/java-aiplatform/grpc-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceGrpc.java @@ -122,6 +122,147 @@ private PredictionServiceGrpc() {} return getRawPredictMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DirectPredictRequest, + com.google.cloud.aiplatform.v1.DirectPredictResponse> + getDirectPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DirectPredict", + requestType = com.google.cloud.aiplatform.v1.DirectPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1.DirectPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DirectPredictRequest, + com.google.cloud.aiplatform.v1.DirectPredictResponse> + getDirectPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DirectPredictRequest, + com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.DirectPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("DirectPredict")) + .build(); + } + } + } + return getDirectPredictMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DirectRawPredictRequest, + com.google.cloud.aiplatform.v1.DirectRawPredictResponse> + getDirectRawPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DirectRawPredict", + requestType = com.google.cloud.aiplatform.v1.DirectRawPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1.DirectRawPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DirectRawPredictRequest, + com.google.cloud.aiplatform.v1.DirectRawPredictResponse> + getDirectRawPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.DirectRawPredictRequest, + com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.DirectRawPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("DirectRawPredict")) + .build(); + } + } + } + return getDirectRawPredictMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1.StreamingPredictResponse> + getStreamingPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "StreamingPredict", + requestType = com.google.cloud.aiplatform.v1.StreamingPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1.StreamingPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1.StreamingPredictResponse> + getStreamingPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1.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.v1.StreamingPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.StreamingPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("StreamingPredict")) + .build(); + } + } + } + return getStreamingPredictMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.cloud.aiplatform.v1.StreamingPredictRequest, com.google.cloud.aiplatform.v1.StreamingPredictResponse> @@ -173,6 +314,56 @@ private PredictionServiceGrpc() {} return getServerStreamingPredictMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest, + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse> + getStreamingRawPredictMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "StreamingRawPredict", + requestType = com.google.cloud.aiplatform.v1.StreamingRawPredictRequest.class, + responseType = com.google.cloud.aiplatform.v1.StreamingRawPredictResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) + public static io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest, + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse> + getStreamingRawPredictMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest, + com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new PredictionServiceMethodDescriptorSupplier("StreamingRawPredict")) + .build(); + } + } + } + return getStreamingRawPredictMethod; + } + private static volatile io.grpc.MethodDescriptor< com.google.cloud.aiplatform.v1.ExplainRequest, com.google.cloud.aiplatform.v1.ExplainResponse> @@ -301,6 +492,53 @@ 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.v1.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.v1.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 + responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall( + getStreamingPredictMethod(), responseObserver); + } + /** * * @@ -317,6 +555,21 @@ default void serverStreamingPredict( getServerStreamingPredictMethod(), responseObserver); } + /** + * + * + *
+     * Perform a streaming online prediction request through gRPC.
+     * 
+ */ + default io.grpc.stub.StreamObserver + streamingRawPredict( + io.grpc.stub.StreamObserver + responseObserver) { + return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall( + getStreamingRawPredictMethod(), responseObserver); + } + /** * * @@ -412,6 +665,57 @@ 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.v1.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.v1.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 + responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getStreamingPredictMethod(), getCallOptions()), responseObserver); + } + /** * * @@ -430,6 +734,21 @@ public void serverStreamingPredict( responseObserver); } + /** + * + * + *
+     * Perform a streaming online prediction request through gRPC.
+     * 
+ */ + public io.grpc.stub.StreamObserver + streamingRawPredict( + io.grpc.stub.StreamObserver + responseObserver) { + return io.grpc.stub.ClientCalls.asyncBidiStreamingCall( + getChannel().newCall(getStreamingRawPredictMethod(), getCallOptions()), responseObserver); + } + /** * * @@ -508,6 +827,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.v1.DirectPredictResponse directPredict( + com.google.cloud.aiplatform.v1.DirectPredictRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDirectPredictMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Perform an online prediction request through gRPC.
+     * 
+ */ + public com.google.cloud.aiplatform.v1.DirectRawPredictResponse directRawPredict( + com.google.cloud.aiplatform.v1.DirectRawPredictRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDirectRawPredictMethod(), getCallOptions(), request); + } + /** * * @@ -598,6 +944,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.v1.DirectPredictResponse> + directPredict(com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse> + directRawPredict(com.google.cloud.aiplatform.v1.DirectRawPredictRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDirectRawPredictMethod(), getCallOptions()), request); + } + /** * * @@ -624,8 +999,12 @@ public com.google.common.util.concurrent.ListenableFuture implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -655,6 +1034,18 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (com.google.cloud.aiplatform.v1.RawPredictRequest) request, (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_DIRECT_PREDICT: + serviceImpl.directPredict( + (com.google.cloud.aiplatform.v1.DirectPredictRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DIRECT_RAW_PREDICT: + serviceImpl.directRawPredict( + (com.google.cloud.aiplatform.v1.DirectRawPredictRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; case METHODID_SERVER_STREAMING_PREDICT: serviceImpl.serverStreamingPredict( (com.google.cloud.aiplatform.v1.StreamingPredictRequest) request, @@ -677,6 +1068,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.v1.StreamingPredictResponse>) + responseObserver); + case METHODID_STREAMING_RAW_PREDICT: + return (io.grpc.stub.StreamObserver) + serviceImpl.streamingRawPredict( + (io.grpc.stub.StreamObserver< + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse>) + responseObserver); default: throw new AssertionError(); } @@ -697,6 +1100,27 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser new MethodHandlers< com.google.cloud.aiplatform.v1.RawPredictRequest, com.google.api.HttpBody>( service, METHODID_RAW_PREDICT))) + .addMethod( + getDirectPredictMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.DirectPredictRequest, + com.google.cloud.aiplatform.v1.DirectPredictResponse>( + service, METHODID_DIRECT_PREDICT))) + .addMethod( + getDirectRawPredictMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.DirectRawPredictRequest, + com.google.cloud.aiplatform.v1.DirectRawPredictResponse>( + service, METHODID_DIRECT_RAW_PREDICT))) + .addMethod( + getStreamingPredictMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.StreamingPredictRequest, + com.google.cloud.aiplatform.v1.StreamingPredictResponse>( + service, METHODID_STREAMING_PREDICT))) .addMethod( getServerStreamingPredictMethod(), io.grpc.stub.ServerCalls.asyncServerStreamingCall( @@ -704,6 +1128,13 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser com.google.cloud.aiplatform.v1.StreamingPredictRequest, com.google.cloud.aiplatform.v1.StreamingPredictResponse>( service, METHODID_SERVER_STREAMING_PREDICT))) + .addMethod( + getStreamingRawPredictMethod(), + io.grpc.stub.ServerCalls.asyncBidiStreamingCall( + new MethodHandlers< + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest, + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse>( + service, METHODID_STREAMING_RAW_PREDICT))) .addMethod( getExplainMethod(), io.grpc.stub.ServerCalls.asyncUnaryCall( @@ -763,7 +1194,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()) .build(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictRequest.java new file mode 100644 index 000000000000..c0bf36691673 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictRequest.java @@ -0,0 +1,1410 @@ +/* + * 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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [PredictionService.DirectPredict][google.cloud.aiplatform.v1.PredictionService.DirectPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DirectPredictRequest} + */ +public final class DirectPredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DirectPredictRequest.class, + com.google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + @java.lang.Override + public java.util.List getInputsList() { + return inputs_; + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public java.util.List + getInputsOrBuilderList() { + return inputs_; + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public int getInputsCount() { + return inputs_.size(); + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getInputs(int index) { + return inputs_.get(index); + } + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getInputsOrBuilder(int index) { + return inputs_.get(index); + } + + public static final int PARAMETERS_FIELD_NUMBER = 3; + private com.google.cloud.aiplatform.v1.Tensor parameters_; + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.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.v1.Tensor parameters = 3; + * + * @return The parameters. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getParameters() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.DirectPredictRequest other = + (com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.PredictionService.DirectPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DirectPredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.DirectPredictRequest) + com.google.cloud.aiplatform.v1.DirectPredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DirectPredictRequest.class, + com.google.cloud.aiplatform.v1.DirectPredictRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectPredictRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.DirectPredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectPredictRequest build() { + com.google.cloud.aiplatform.v1.DirectPredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectPredictRequest buildPartial() { + com.google.cloud.aiplatform.v1.DirectPredictRequest result = + new com.google.cloud.aiplatform.v1.DirectPredictRequest(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1.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.v1.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.v1.DirectPredictRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.DirectPredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.DirectPredictRequest other) { + if (other == com.google.cloud.aiplatform.v1.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.v1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1.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.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + inputsBuilder_; + + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + public int getInputsCount() { + if (inputsBuilder_ == null) { + return inputs_.size(); + } else { + return inputsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor getInputs(int index) { + if (inputsBuilder_ == null) { + return inputs_.get(index); + } else { + return inputsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public Builder setInputs(int index, com.google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + public Builder setInputs( + int index, com.google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + public Builder addInputs(com.google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + public Builder addInputs(int index, com.google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + public Builder addInputs(com.google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + public Builder addInputs( + int index, com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getInputsBuilder(int index) { + return getInputsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getInputsOrBuilder(int index) { + if (inputsBuilder_ == null) { + return inputs_.get(index); + } else { + return inputsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addInputsBuilder() { + return getInputsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addInputsBuilder(int index) { + return getInputsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction input.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + public java.util.List getInputsBuilderList() { + return getInputsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getInputsFieldBuilder() { + if (inputsBuilder_ == null) { + inputsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder>( + inputs_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + inputs_ = null; + } + return inputsBuilder_; + } + + private com.google.cloud.aiplatform.v1.Tensor parameters_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + parametersBuilder_; + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.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.v1.Tensor parameters = 3; + * + * @return The parameters. + */ + public com.google.cloud.aiplatform.v1.Tensor getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1.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.v1.Tensor parameters = 3; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1.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.v1.Tensor parameters = 3; + */ + public Builder mergeParameters(com.google.cloud.aiplatform.v1.Tensor value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && parameters_ != null + && parameters_ != com.google.cloud.aiplatform.v1.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.v1.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.v1.Tensor parameters = 3; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getParametersBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getParametersFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.DirectPredictRequest) + private static final com.google.cloud.aiplatform.v1.DirectPredictRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.DirectPredictRequest(); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictRequestOrBuilder.java new file mode 100644 index 000000000000..4dedefc12023 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictRequestOrBuilder.java @@ -0,0 +1,144 @@ +/* + * 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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface DirectPredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.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.v1.Tensor inputs = 2; + */ + java.util.List getInputsList(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + com.google.cloud.aiplatform.v1.Tensor getInputs(int index); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + int getInputsCount(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + java.util.List getInputsOrBuilderList(); + /** + * + * + *
+   * The prediction input.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor inputs = 2; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getInputsOrBuilder(int index); + + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + * + * @return The parameters. + */ + com.google.cloud.aiplatform.v1.Tensor getParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 3; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictResponse.java new file mode 100644 index 000000000000..041b9f8158b3 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictResponse.java @@ -0,0 +1,1200 @@ +/* + * 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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Response message for
+ * [PredictionService.DirectPredict][google.cloud.aiplatform.v1.PredictionService.DirectPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DirectPredictResponse} + */ +public final class DirectPredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DirectPredictResponse.class, + com.google.cloud.aiplatform.v1.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.v1.Tensor outputs = 1; + */ + @java.lang.Override + public java.util.List getOutputsList() { + return outputs_; + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public java.util.List + getOutputsOrBuilderList() { + return outputs_; + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public int getOutputsCount() { + return outputs_.size(); + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getOutputs(int index) { + return outputs_.get(index); + } + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getOutputsOrBuilder(int index) { + return outputs_.get(index); + } + + public static final int PARAMETERS_FIELD_NUMBER = 2; + private com.google.cloud.aiplatform.v1.Tensor parameters_; + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.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.v1.Tensor parameters = 2; + * + * @return The parameters. + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.Tensor getParameters() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder() { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.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.v1.DirectPredictResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.DirectPredictResponse other = + (com.google.cloud.aiplatform.v1.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.v1.DirectPredictResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.PredictionService.DirectPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DirectPredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.DirectPredictResponse) + com.google.cloud.aiplatform.v1.DirectPredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DirectPredictResponse.class, + com.google.cloud.aiplatform.v1.DirectPredictResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectPredictResponse getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.DirectPredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectPredictResponse build() { + com.google.cloud.aiplatform.v1.DirectPredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectPredictResponse buildPartial() { + com.google.cloud.aiplatform.v1.DirectPredictResponse result = + new com.google.cloud.aiplatform.v1.DirectPredictResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.aiplatform.v1.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.v1.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.v1.DirectPredictResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1.DirectPredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.DirectPredictResponse other) { + if (other == com.google.cloud.aiplatform.v1.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.v1.Tensor m = + input.readMessage( + com.google.cloud.aiplatform.v1.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.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + outputsBuilder_; + + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.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.v1.Tensor outputs = 1; + */ + public int getOutputsCount() { + if (outputsBuilder_ == null) { + return outputs_.size(); + } else { + return outputsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.Tensor getOutputs(int index) { + if (outputsBuilder_ == null) { + return outputs_.get(index); + } else { + return outputsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public Builder setOutputs(int index, com.google.cloud.aiplatform.v1.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.v1.Tensor outputs = 1; + */ + public Builder setOutputs( + int index, com.google.cloud.aiplatform.v1.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.v1.Tensor outputs = 1; + */ + public Builder addOutputs(com.google.cloud.aiplatform.v1.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.v1.Tensor outputs = 1; + */ + public Builder addOutputs(int index, com.google.cloud.aiplatform.v1.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.v1.Tensor outputs = 1; + */ + public Builder addOutputs(com.google.cloud.aiplatform.v1.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.v1.Tensor outputs = 1; + */ + public Builder addOutputs( + int index, com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getOutputsBuilder(int index) { + return getOutputsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getOutputsOrBuilder(int index) { + if (outputsBuilder_ == null) { + return outputs_.get(index); + } else { + return outputsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.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.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addOutputsBuilder() { + return getOutputsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder addOutputsBuilder(int index) { + return getOutputsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance()); + } + /** + * + * + *
+     * The prediction output.
+     * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + public java.util.List getOutputsBuilderList() { + return getOutputsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getOutputsFieldBuilder() { + if (outputsBuilder_ == null) { + outputsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder>( + outputs_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + outputs_ = null; + } + return outputsBuilder_; + } + + private com.google.cloud.aiplatform.v1.Tensor parameters_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + parametersBuilder_; + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.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.v1.Tensor parameters = 2; + * + * @return The parameters. + */ + public com.google.cloud.aiplatform.v1.Tensor getParameters() { + if (parametersBuilder_ == null) { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } else { + return parametersBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1.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.v1.Tensor parameters = 2; + */ + public Builder setParameters(com.google.cloud.aiplatform.v1.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.v1.Tensor parameters = 2; + */ + public Builder mergeParameters(com.google.cloud.aiplatform.v1.Tensor value) { + if (parametersBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && parameters_ != null + && parameters_ != com.google.cloud.aiplatform.v1.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.v1.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.v1.Tensor parameters = 2; + */ + public com.google.cloud.aiplatform.v1.Tensor.Builder getParametersBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getParametersFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + public com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder() { + if (parametersBuilder_ != null) { + return parametersBuilder_.getMessageOrBuilder(); + } else { + return parameters_ == null + ? com.google.cloud.aiplatform.v1.Tensor.getDefaultInstance() + : parameters_; + } + } + /** + * + * + *
+     * The parameters that govern the prediction.
+     * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.TensorOrBuilder> + getParametersFieldBuilder() { + if (parametersBuilder_ == null) { + parametersBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.aiplatform.v1.Tensor, + com.google.cloud.aiplatform.v1.Tensor.Builder, + com.google.cloud.aiplatform.v1.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.v1.DirectPredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.DirectPredictResponse) + private static final com.google.cloud.aiplatform.v1.DirectPredictResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.DirectPredictResponse(); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectPredictResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectPredictResponseOrBuilder.java new file mode 100644 index 000000000000..826494e1bd00 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface DirectPredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.DirectPredictResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + java.util.List getOutputsList(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + com.google.cloud.aiplatform.v1.Tensor getOutputs(int index); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + int getOutputsCount(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + java.util.List + getOutputsOrBuilderList(); + /** + * + * + *
+   * The prediction output.
+   * 
+ * + * repeated .google.cloud.aiplatform.v1.Tensor outputs = 1; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getOutputsOrBuilder(int index); + + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + * + * @return Whether the parameters field is set. + */ + boolean hasParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + * + * @return The parameters. + */ + com.google.cloud.aiplatform.v1.Tensor getParameters(); + /** + * + * + *
+   * The parameters that govern the prediction.
+   * 
+ * + * .google.cloud.aiplatform.v1.Tensor parameters = 2; + */ + com.google.cloud.aiplatform.v1.TensorOrBuilder getParametersOrBuilder(); +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictRequest.java new file mode 100644 index 000000000000..9a2c3f42066b --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1.PredictionService.DirectRawPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DirectRawPredictRequest} + */ +public final class DirectRawPredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DirectRawPredictRequest.class, + com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.DirectRawPredictRequest other = + (com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.PredictionService.DirectRawPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DirectRawPredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.DirectRawPredictRequest) + com.google.cloud.aiplatform.v1.DirectRawPredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DirectRawPredictRequest.class, + com.google.cloud.aiplatform.v1.DirectRawPredictRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectRawPredictRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.DirectRawPredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectRawPredictRequest build() { + com.google.cloud.aiplatform.v1.DirectRawPredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectRawPredictRequest buildPartial() { + com.google.cloud.aiplatform.v1.DirectRawPredictRequest result = + new com.google.cloud.aiplatform.v1.DirectRawPredictRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.DirectRawPredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.DirectRawPredictRequest other) { + if (other == com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.DirectRawPredictRequest) + private static final com.google.cloud.aiplatform.v1.DirectRawPredictRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.DirectRawPredictRequest(); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictRequestOrBuilder.java new file mode 100644 index 000000000000..68d90611668c --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface DirectRawPredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.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-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictResponse.java new file mode 100644 index 000000000000..9e579652f38e --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictResponse.java @@ -0,0 +1,541 @@ +/* + * 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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Response message for
+ * [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1.PredictionService.DirectRawPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DirectRawPredictResponse} + */ +public final class DirectRawPredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DirectRawPredictResponse.class, + com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.DirectRawPredictResponse other = + (com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.PredictionService.DirectRawPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.DirectRawPredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.DirectRawPredictResponse) + com.google.cloud.aiplatform.v1.DirectRawPredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.DirectRawPredictResponse.class, + com.google.cloud.aiplatform.v1.DirectRawPredictResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectRawPredictResponse getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.DirectRawPredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectRawPredictResponse build() { + com.google.cloud.aiplatform.v1.DirectRawPredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.DirectRawPredictResponse buildPartial() { + com.google.cloud.aiplatform.v1.DirectRawPredictResponse result = + new com.google.cloud.aiplatform.v1.DirectRawPredictResponse(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1.DirectRawPredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.DirectRawPredictResponse other) { + if (other == com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.DirectRawPredictResponse) + private static final com.google.cloud.aiplatform.v1.DirectRawPredictResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.DirectRawPredictResponse(); + } + + public static com.google.cloud.aiplatform.v1.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.v1.DirectRawPredictResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/DirectRawPredictResponseOrBuilder.java new file mode 100644 index 000000000000..b3407fedfdf6 --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface DirectRawPredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.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-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelContainerSpec.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelContainerSpec.java index 3b6fa9d267be..174f5b741af2 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelContainerSpec.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelContainerSpec.java @@ -47,6 +47,7 @@ private ModelContainerSpec() { ports_ = java.util.Collections.emptyList(); predictRoute_ = ""; healthRoute_ = ""; + grpcPorts_ = java.util.Collections.emptyList(); } @java.lang.Override @@ -1178,6 +1179,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.v1.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.v1.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.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + @java.lang.Override + public com.google.cloud.aiplatform.v1.PortOrBuilder getGrpcPortsOrBuilder(int index) { + return grpcPorts_.get(index); + } + public static final int DEPLOYMENT_TIMEOUT_FIELD_NUMBER = 10; private com.google.protobuf.Duration deploymentTimeout_; /** @@ -1403,6 +1525,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()); } @@ -1455,6 +1580,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()); } @@ -1490,6 +1618,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; @@ -1536,6 +1665,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(); @@ -1710,6 +1843,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(); @@ -1781,6 +1921,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.v1.ModelContainerSpec result) { @@ -1802,20 +1951,20 @@ private void buildPartial0(com.google.cloud.aiplatform.v1.ModelContainerSpec res 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(); } @@ -1956,6 +2105,33 @@ public Builder mergeFrom(com.google.cloud.aiplatform.v1.ModelContainerSpec other 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()); } @@ -2052,29 +2228,42 @@ public Builder mergeFrom( bitField0_ |= 0x00000040; break; } // case 58 + case 74: + { + com.google.cloud.aiplatform.v1.Port m = + input.readMessage( + com.google.cloud.aiplatform.v1.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: @@ -5395,6 +5584,534 @@ 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.v1.Port, + com.google.cloud.aiplatform.v1.Port.Builder, + com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder setGrpcPorts(int index, com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder setGrpcPorts( + int index, com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addGrpcPorts(com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addGrpcPorts(int index, com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addGrpcPorts(com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public Builder addGrpcPorts( + int index, com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1.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.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1.Port.Builder addGrpcPortsBuilder() { + return getGrpcPortsFieldBuilder() + .addBuilder(com.google.cloud.aiplatform.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + public com.google.cloud.aiplatform.v1.Port.Builder addGrpcPortsBuilder(int index) { + return getGrpcPortsFieldBuilder() + .addBuilder(index, com.google.cloud.aiplatform.v1.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.v1.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.v1.Port, + com.google.cloud.aiplatform.v1.Port.Builder, + com.google.cloud.aiplatform.v1.PortOrBuilder> + getGrpcPortsFieldBuilder() { + if (grpcPortsBuilder_ == null) { + grpcPortsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.aiplatform.v1.Port, + com.google.cloud.aiplatform.v1.Port.Builder, + com.google.cloud.aiplatform.v1.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, @@ -5416,7 +6133,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); } /** * @@ -5462,7 +6179,7 @@ public Builder setDeploymentTimeout(com.google.protobuf.Duration value) { } else { deploymentTimeoutBuilder_.setMessage(value); } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return this; } @@ -5484,7 +6201,7 @@ public Builder setDeploymentTimeout(com.google.protobuf.Duration.Builder builder } else { deploymentTimeoutBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return this; } @@ -5502,7 +6219,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); @@ -5512,7 +6229,7 @@ public Builder mergeDeploymentTimeout(com.google.protobuf.Duration value) { } else { deploymentTimeoutBuilder_.mergeFrom(value); } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return this; } @@ -5529,7 +6246,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(); @@ -5551,7 +6268,7 @@ public Builder clearDeploymentTimeout() { * */ public com.google.protobuf.Duration.Builder getDeploymentTimeoutBuilder() { - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000100; onChanged(); return getDeploymentTimeoutFieldBuilder().getBuilder(); } @@ -5638,7 +6355,7 @@ public long getSharedMemorySizeMb() { public Builder setSharedMemorySizeMb(long value) { sharedMemorySizeMb_ = value; - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000200; onChanged(); return this; } @@ -5655,7 +6372,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; @@ -5681,7 +6398,7 @@ public Builder clearSharedMemorySizeMb() { * @return Whether the startupProbe field is set. */ public boolean hasStartupProbe() { - return ((bitField0_ & 0x00000200) != 0); + return ((bitField0_ & 0x00000400) != 0); } /** * @@ -5725,7 +6442,7 @@ public Builder setStartupProbe(com.google.cloud.aiplatform.v1.Probe value) { } else { startupProbeBuilder_.setMessage(value); } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return this; } @@ -5746,7 +6463,7 @@ public Builder setStartupProbe(com.google.cloud.aiplatform.v1.Probe.Builder buil } else { startupProbeBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return this; } @@ -5763,7 +6480,7 @@ public Builder setStartupProbe(com.google.cloud.aiplatform.v1.Probe.Builder buil */ public Builder mergeStartupProbe(com.google.cloud.aiplatform.v1.Probe value) { if (startupProbeBuilder_ == null) { - if (((bitField0_ & 0x00000200) != 0) + if (((bitField0_ & 0x00000400) != 0) && startupProbe_ != null && startupProbe_ != com.google.cloud.aiplatform.v1.Probe.getDefaultInstance()) { getStartupProbeBuilder().mergeFrom(value); @@ -5773,7 +6490,7 @@ public Builder mergeStartupProbe(com.google.cloud.aiplatform.v1.Probe value) { } else { startupProbeBuilder_.mergeFrom(value); } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return this; } @@ -5789,7 +6506,7 @@ public Builder mergeStartupProbe(com.google.cloud.aiplatform.v1.Probe value) { * */ public Builder clearStartupProbe() { - bitField0_ = (bitField0_ & ~0x00000200); + bitField0_ = (bitField0_ & ~0x00000400); startupProbe_ = null; if (startupProbeBuilder_ != null) { startupProbeBuilder_.dispose(); @@ -5810,7 +6527,7 @@ public Builder clearStartupProbe() { * */ public com.google.cloud.aiplatform.v1.Probe.Builder getStartupProbeBuilder() { - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000400; onChanged(); return getStartupProbeFieldBuilder().getBuilder(); } @@ -5882,7 +6599,7 @@ public com.google.cloud.aiplatform.v1.ProbeOrBuilder getStartupProbeOrBuilder() * @return Whether the healthProbe field is set. */ public boolean hasHealthProbe() { - return ((bitField0_ & 0x00000400) != 0); + return ((bitField0_ & 0x00000800) != 0); } /** * @@ -5926,7 +6643,7 @@ public Builder setHealthProbe(com.google.cloud.aiplatform.v1.Probe value) { } else { healthProbeBuilder_.setMessage(value); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return this; } @@ -5947,7 +6664,7 @@ public Builder setHealthProbe(com.google.cloud.aiplatform.v1.Probe.Builder build } else { healthProbeBuilder_.setMessage(builderForValue.build()); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return this; } @@ -5964,7 +6681,7 @@ public Builder setHealthProbe(com.google.cloud.aiplatform.v1.Probe.Builder build */ public Builder mergeHealthProbe(com.google.cloud.aiplatform.v1.Probe value) { if (healthProbeBuilder_ == null) { - if (((bitField0_ & 0x00000400) != 0) + if (((bitField0_ & 0x00000800) != 0) && healthProbe_ != null && healthProbe_ != com.google.cloud.aiplatform.v1.Probe.getDefaultInstance()) { getHealthProbeBuilder().mergeFrom(value); @@ -5974,7 +6691,7 @@ public Builder mergeHealthProbe(com.google.cloud.aiplatform.v1.Probe value) { } else { healthProbeBuilder_.mergeFrom(value); } - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return this; } @@ -5990,7 +6707,7 @@ public Builder mergeHealthProbe(com.google.cloud.aiplatform.v1.Probe value) { * */ public Builder clearHealthProbe() { - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000800); healthProbe_ = null; if (healthProbeBuilder_ != null) { healthProbeBuilder_.dispose(); @@ -6011,7 +6728,7 @@ public Builder clearHealthProbe() { * */ public com.google.cloud.aiplatform.v1.Probe.Builder getHealthProbeBuilder() { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; onChanged(); return getHealthProbeFieldBuilder().getBuilder(); } diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelContainerSpecOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelContainerSpecOrBuilder.java index cddccf524687..f36e3ff00fc3 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelContainerSpecOrBuilder.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelContainerSpecOrBuilder.java @@ -987,6 +987,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.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.Port grpc_ports = 9 [(.google.api.field_behavior) = IMMUTABLE]; + * + */ + com.google.cloud.aiplatform.v1.PortOrBuilder getGrpcPortsOrBuilder(int index); + /** * * diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelProto.java index 6715ad386a65..f68cb42258a1 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/ModelProto.java @@ -148,35 +148,37 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "ence\022\022\n\004name\030\001 \001(\tB\004\342A\001\002\"~\n\017PredictSchem" + "ata\022!\n\023instance_schema_uri\030\001 \001(\tB\004\342A\001\005\022#" + "\n\025parameters_schema_uri\030\002 \001(\tB\004\342A\001\005\022#\n\025p" - + "rediction_schema_uri\030\003 \001(\tB\004\342A\001\005\"\341\003\n\022Mod" + + "rediction_schema_uri\030\003 \001(\tB\004\342A\001\005\"\235\004\n\022Mod" + "elContainerSpec\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\0225\n\003env\030\004 \003(\0132\".google.cloud.aiplatf" + "orm.v1.EnvVarB\004\342A\001\005\0225\n\005ports\030\005 \003(\0132 .goo" + "gle.cloud.aiplatform.v1.PortB\004\342A\001\005\022\033\n\rpr" + "edict_route\030\006 \001(\tB\004\342A\001\005\022\032\n\014health_route\030" - + "\007 \001(\tB\004\342A\001\005\022;\n\022deployment_timeout\030\n \001(\0132" - + "\031.google.protobuf.DurationB\004\342A\001\005\022#\n\025shar" - + "ed_memory_size_mb\030\013 \001(\003B\004\342A\001\005\022>\n\rstartup" - + "_probe\030\014 \001(\0132!.google.cloud.aiplatform.v" - + "1.ProbeB\004\342A\001\005\022=\n\014health_probe\030\r \001(\0132!.go" - + "ogle.cloud.aiplatform.v1.ProbeB\004\342A\001\005\"\036\n\004" - + "Port\022\026\n\016container_port\030\003 \001(\005\"\346\001\n\017ModelSo" - + "urceInfo\022P\n\013source_type\030\001 \001(\0162;.google.c" - + "loud.aiplatform.v1.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\"\243\001\n\005Probe\022<\n\004exec\030" - + "\001 \001(\0132,.google.cloud.aiplatform.v1.Probe" - + ".ExecActionH\000\022\026\n\016period_seconds\030\002 \001(\005\022\027\n" - + "\017timeout_seconds\030\003 \001(\005\032\035\n\nExecAction\022\017\n\007" - + "command\030\001 \003(\tB\014\n\nprobe_typeB\310\001\n\036com.goog" - + "le.cloud.aiplatform.v1B\nModelProtoP\001Z>cl" - + "oud.google.com/go/aiplatform/apiv1/aipla" - + "tformpb;aiplatformpb\252\002\032Google.Cloud.AIPl" - + "atform.V1\312\002\032Google\\Cloud\\AIPlatform\\V1\352\002" - + "\035Google::Cloud::AIPlatform::V1b\006proto3" + + "\007 \001(\tB\004\342A\001\005\022:\n\ngrpc_ports\030\t \003(\0132 .google" + + ".cloud.aiplatform.v1.PortB\004\342A\001\005\022;\n\022deplo" + + "yment_timeout\030\n \001(\0132\031.google.protobuf.Du" + + "rationB\004\342A\001\005\022#\n\025shared_memory_size_mb\030\013 " + + "\001(\003B\004\342A\001\005\022>\n\rstartup_probe\030\014 \001(\0132!.googl" + + "e.cloud.aiplatform.v1.ProbeB\004\342A\001\005\022=\n\014hea" + + "lth_probe\030\r \001(\0132!.google.cloud.aiplatfor" + + "m.v1.ProbeB\004\342A\001\005\"\036\n\004Port\022\026\n\016container_po" + + "rt\030\003 \001(\005\"\346\001\n\017ModelSourceInfo\022P\n\013source_t" + + "ype\030\001 \001(\0162;.google.cloud.aiplatform.v1.M" + + "odelSourceInfo.ModelSourceType\022\014\n\004copy\030\002" + + " \001(\010\"s\n\017ModelSourceType\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\014MODEL_GARDEN\020\004\022\t\n\005GENIE\020" + + "\005\"\243\001\n\005Probe\022<\n\004exec\030\001 \001(\0132,.google.cloud" + + ".aiplatform.v1.Probe.ExecActionH\000\022\026\n\016per" + + "iod_seconds\030\002 \001(\005\022\027\n\017timeout_seconds\030\003 \001" + + "(\005\032\035\n\nExecAction\022\017\n\007command\030\001 \003(\tB\014\n\npro" + + "be_typeB\310\001\n\036com.google.cloud.aiplatform." + + "v1B\nModelProtoP\001Z>cloud.google.com/go/ai" + + "platform/apiv1/aiplatformpb;aiplatformpb" + + "\252\002\032Google.Cloud.AIPlatform.V1\312\002\032Google\\C" + + "loud\\AIPlatform\\V1\352\002\035Google::Cloud::AIPl" + + "atform::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -281,6 +283,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-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceProto.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceProto.java index dd184e4fa46a..642922d87e33 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceProto.java +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceProto.java @@ -39,6 +39,22 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_aiplatform_v1_RawPredictRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1_RawPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_aiplatform_v1_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_v1_StreamingPredictResponse_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_aiplatform_v1_ExplainRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -94,67 +118,101 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "tobuf.ValueB\004\342A\001\003\"{\n\021RawPredictRequest\022=" + "\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.go" + "ogleapis.com/Endpoint\022\'\n\thttp_body\030\002 \001(\013" - + "2\024.google.api.HttpBody\"\304\001\n\027StreamingPred" + + "2\024.google.api.HttpBody\"\301\001\n\024DirectPredict" + + "Request\022=\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"aipl" + + "atform.googleapis.com/Endpoint\0222\n\006inputs" + + "\030\002 \003(\0132\".google.cloud.aiplatform.v1.Tens" + + "or\0226\n\nparameters\030\003 \001(\0132\".google.cloud.ai" + + "platform.v1.Tensor\"\204\001\n\025DirectPredictResp" + + "onse\0223\n\007outputs\030\001 \003(\0132\".google.cloud.aip" + + "latform.v1.Tensor\0226\n\nparameters\030\002 \001(\0132\"." + + "google.cloud.aiplatform.v1.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\"\304\001\n\027StreamingPredictRequest\022=\n\010endpo" + + "int\030\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapi" + + "s.com/Endpoint\0222\n\006inputs\030\002 \003(\0132\".google." + + "cloud.aiplatform.v1.Tensor\0226\n\nparameters" + + "\030\003 \001(\0132\".google.cloud.aiplatform.v1.Tens" + + "or\"\207\001\n\030StreamingPredictResponse\0223\n\007outpu" + + "ts\030\001 \003(\0132\".google.cloud.aiplatform.v1.Te" + + "nsor\0226\n\nparameters\030\002 \001(\0132\".google.cloud." + + "aiplatform.v1.Tensor\"\177\n\032StreamingRawPred" + "ictRequest\022=\n\010endpoint\030\001 \001(\tB+\342A\001\002\372A$\n\"a" - + "iplatform.googleapis.com/Endpoint\0222\n\006inp" - + "uts\030\002 \003(\0132\".google.cloud.aiplatform.v1.T" - + "ensor\0226\n\nparameters\030\003 \001(\0132\".google.cloud" - + ".aiplatform.v1.Tensor\"\207\001\n\030StreamingPredi" - + "ctResponse\0223\n\007outputs\030\001 \003(\0132\".google.clo" - + "ud.aiplatform.v1.Tensor\0226\n\nparameters\030\002 " - + "\001(\0132\".google.cloud.aiplatform.v1.Tensor\"" - + "\237\002\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\022V\n\031explanation_spec_overr" - + "ide\030\005 \001(\01323.google.cloud.aiplatform.v1.E" - + "xplanationSpecOverride\022\031\n\021deployed_model" - + "_id\030\003 \001(\t\"\230\001\n\017ExplainResponse\022=\n\014explana" - + "tions\030\001 \003(\0132\'.google.cloud.aiplatform.v1" - + ".Explanation\022\031\n\021deployed_model_id\030\002 \001(\t\022" - + "+\n\013predictions\030\003 \003(\0132\026.google.protobuf.V" - + "alue\"\204\001\n\022CountTokensRequest\022=\n\010endpoint\030" - + "\001 \001(\tB+\342A\001\002\372A$\n\"aiplatform.googleapis.co" - + "m/Endpoint\022/\n\tinstances\030\002 \003(\0132\026.google.p" - + "rotobuf.ValueB\004\342A\001\002\"N\n\023CountTokensRespon" - + "se\022\024\n\014total_tokens\030\001 \001(\005\022!\n\031total_billab" - + "le_characters\030\002 \001(\0052\217\t\n\021PredictionServic" - + "e\022\224\002\n\007Predict\022*.google.cloud.aiplatform." - + "v1.PredictRequest\032+.google.cloud.aiplatf" - + "orm.v1.PredictResponse\"\257\001\332A\035endpoint,ins" - + "tances,parameters\202\323\344\223\002\210\001\"9/v1/{endpoint=" - + "projects/*/locations/*/endpoints/*}:pred" - + "ict:\001*ZH\"C/v1/{endpoint=projects/*/locat" - + "ions/*/publishers/*/models/*}:predict:\001*" - + "\022\376\001\n\nRawPredict\022-.google.cloud.aiplatfor" - + "m.v1.RawPredictRequest\032\024.google.api.Http" - + "Body\"\252\001\332A\022endpoint,http_body\202\323\344\223\002\216\001\"\"9/v1/{endpoint=projects/*/locat" - + "ions/*/endpoints/*}:explain:\001*\032M\312A\031aipla" - + "tform.googleapis.com\322A.https://www.googl" - + "eapis.com/auth/cloud-platformB\324\001\n\036com.go" - + "ogle.cloud.aiplatform.v1B\026PredictionServ" - + "iceProtoP\001Z>cloud.google.com/go/aiplatfo" - + "rm/apiv1/aiplatformpb;aiplatformpb\252\002\032Goo" - + "gle.Cloud.AIPlatform.V1\312\002\032Google\\Cloud\\A" - + "IPlatform\\V1\352\002\035Google::Cloud::AIPlatform" - + "::V1b\006proto3" + + "iplatform.googleapis.com/Endpoint\022\023\n\013met" + + "hod_name\030\002 \001(\t\022\r\n\005input\030\003 \001(\014\"-\n\033Streami" + + "ngRawPredictResponse\022\016\n\006output\030\001 \001(\014\"\237\002\n" + + "\016ExplainRequest\022=\n\010endpoint\030\001 \001(\tB+\342A\001\002\372" + + "A$\n\"aiplatform.googleapis.com/Endpoint\022/" + + "\n\tinstances\030\002 \003(\0132\026.google.protobuf.Valu" + + "eB\004\342A\001\002\022*\n\nparameters\030\004 \001(\0132\026.google.pro" + + "tobuf.Value\022V\n\031explanation_spec_override" + + "\030\005 \001(\01323.google.cloud.aiplatform.v1.Expl" + + "anationSpecOverride\022\031\n\021deployed_model_id" + + "\030\003 \001(\t\"\230\001\n\017ExplainResponse\022=\n\014explanatio" + + "ns\030\001 \003(\0132\'.google.cloud.aiplatform.v1.Ex" + + "planation\022\031\n\021deployed_model_id\030\002 \001(\t\022+\n\013" + + "predictions\030\003 \003(\0132\026.google.protobuf.Valu" + + "e\"\204\001\n\022CountTokensRequest\022=\n\010endpoint\030\001 \001" + + "(\tB+\342A\001\002\372A$\n\"aiplatform.googleapis.com/E" + + "ndpoint\022/\n\tinstances\030\002 \003(\0132\026.google.prot" + + "obuf.ValueB\004\342A\001\002\"N\n\023CountTokensResponse\022" + + "\024\n\014total_tokens\030\001 \001(\005\022!\n\031total_billable_" + + "characters\030\002 \001(\0052\266\016\n\021PredictionService\022\224" + + "\002\n\007Predict\022*.google.cloud.aiplatform.v1." + + "PredictRequest\032+.google.cloud.aiplatform" + + ".v1.PredictResponse\"\257\001\332A\035endpoint,instan" + + "ces,parameters\202\323\344\223\002\210\001\"9/v1/{endpoint=pro" + + "jects/*/locations/*/endpoints/*}:predict" + + ":\001*ZH\"C/v1/{endpoint=projects/*/location" + + "s/*/publishers/*/models/*}:predict:\001*\022\376\001" + + "\n\nRawPredict\022-.google.cloud.aiplatform.v" + + "1.RawPredictRequest\032\024.google.api.HttpBod" + + "y\"\252\001\332A\022endpoint,http_body\202\323\344\223\002\216\001\"\"9/v1/{endpoint=projects/*/locations" + + "/*/endpoints/*}:explain:\001*\032M\312A\031aiplatfor" + + "m.googleapis.com\322A.https://www.googleapi" + + "s.com/auth/cloud-platformB\324\001\n\036com.google" + + ".cloud.aiplatform.v1B\026PredictionServiceP" + + "rotoP\001Z>cloud.google.com/go/aiplatform/a" + + "piv1/aiplatformpb;aiplatformpb\252\002\032Google." + + "Cloud.AIPlatform.V1\312\002\032Google\\Cloud\\AIPla" + + "tform\\V1\352\002\035Google::Cloud::AIPlatform::V1" + + "b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -198,8 +256,40 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Endpoint", "HttpBody", }); - internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor = + internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_descriptor = getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_DirectPredictRequest_descriptor, + new java.lang.String[] { + "Endpoint", "Inputs", "Parameters", + }); + internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_DirectPredictResponse_descriptor, + new java.lang.String[] { + "Outputs", "Parameters", + }); + internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_DirectRawPredictRequest_descriptor, + new java.lang.String[] { + "Endpoint", "MethodName", "Input", + }); + internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_DirectRawPredictResponse_descriptor, + new java.lang.String[] { + "Output", + }); + internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor = + getDescriptor().getMessageTypes().get(7); internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_StreamingPredictRequest_descriptor, @@ -207,15 +297,31 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Endpoint", "Inputs", "Parameters", }); internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageTypes().get(8); internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_StreamingPredictResponse_descriptor, new java.lang.String[] { "Outputs", "Parameters", }); + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_descriptor, + new java.lang.String[] { + "Endpoint", "MethodName", "Input", + }); + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_descriptor, + new java.lang.String[] { + "Output", + }); internal_static_google_cloud_aiplatform_v1_ExplainRequest_descriptor = - getDescriptor().getMessageTypes().get(5); + getDescriptor().getMessageTypes().get(11); internal_static_google_cloud_aiplatform_v1_ExplainRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_ExplainRequest_descriptor, @@ -223,7 +329,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Endpoint", "Instances", "Parameters", "ExplanationSpecOverride", "DeployedModelId", }); internal_static_google_cloud_aiplatform_v1_ExplainResponse_descriptor = - getDescriptor().getMessageTypes().get(6); + getDescriptor().getMessageTypes().get(12); internal_static_google_cloud_aiplatform_v1_ExplainResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_ExplainResponse_descriptor, @@ -231,7 +337,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Explanations", "DeployedModelId", "Predictions", }); internal_static_google_cloud_aiplatform_v1_CountTokensRequest_descriptor = - getDescriptor().getMessageTypes().get(7); + getDescriptor().getMessageTypes().get(13); internal_static_google_cloud_aiplatform_v1_CountTokensRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_CountTokensRequest_descriptor, @@ -239,7 +345,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "Endpoint", "Instances", }); internal_static_google_cloud_aiplatform_v1_CountTokensResponse_descriptor = - getDescriptor().getMessageTypes().get(8); + getDescriptor().getMessageTypes().get(14); internal_static_google_cloud_aiplatform_v1_CountTokensResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_aiplatform_v1_CountTokensResponse_descriptor, diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictRequest.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictRequest.java new file mode 100644 index 000000000000..749be387da4f --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictRequest.java @@ -0,0 +1,997 @@ +/* + * 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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Request message for
+ * [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamingRawPredict].
+ *
+ * The first message must contain
+ * [endpoint][google.cloud.aiplatform.v1.StreamingRawPredictRequest.endpoint]
+ * and
+ * [method_name][google.cloud.aiplatform.v1.StreamingRawPredictRequest.method_name]
+ * fields and optionally
+ * [input][google.cloud.aiplatform.v1.StreamingRawPredictRequest.input]. The
+ * subsequent messages must contain
+ * [input][google.cloud.aiplatform.v1.StreamingRawPredictRequest.input].
+ * [method_name][google.cloud.aiplatform.v1.StreamingRawPredictRequest.method_name]
+ * in the subsequent messages have no effect.
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.StreamingRawPredictRequest} + */ +public final class StreamingRawPredictRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest.class, + com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest other = + (com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.PredictionService.StreamingRawPredict].
+   *
+   * The first message must contain
+   * [endpoint][google.cloud.aiplatform.v1.StreamingRawPredictRequest.endpoint]
+   * and
+   * [method_name][google.cloud.aiplatform.v1.StreamingRawPredictRequest.method_name]
+   * fields and optionally
+   * [input][google.cloud.aiplatform.v1.StreamingRawPredictRequest.input]. The
+   * subsequent messages must contain
+   * [input][google.cloud.aiplatform.v1.StreamingRawPredictRequest.input].
+   * [method_name][google.cloud.aiplatform.v1.StreamingRawPredictRequest.method_name]
+   * in the subsequent messages have no effect.
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.StreamingRawPredictRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.StreamingRawPredictRequest) + com.google.cloud.aiplatform.v1.StreamingRawPredictRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest.class, + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingRawPredictRequest getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.StreamingRawPredictRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingRawPredictRequest build() { + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingRawPredictRequest buildPartial() { + com.google.cloud.aiplatform.v1.StreamingRawPredictRequest result = + new com.google.cloud.aiplatform.v1.StreamingRawPredictRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest) { + return mergeFrom((com.google.cloud.aiplatform.v1.StreamingRawPredictRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.StreamingRawPredictRequest other) { + if (other == com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.StreamingRawPredictRequest) + private static final com.google.cloud.aiplatform.v1.StreamingRawPredictRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.StreamingRawPredictRequest(); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictRequestOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictRequestOrBuilder.java new file mode 100644 index 000000000000..42cf17c4580a --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface StreamingRawPredictRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.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-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictResponse.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictResponse.java new file mode 100644 index 000000000000..b31fda35a92a --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictResponse.java @@ -0,0 +1,541 @@ +/* + * 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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +/** + * + * + *
+ * Response message for
+ * [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamingRawPredict].
+ * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.StreamingRawPredictResponse} + */ +public final class StreamingRawPredictResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse.class, + com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse)) { + return super.equals(obj); + } + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse other = + (com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.aiplatform.v1.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.v1.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.v1.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.v1.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.v1.PredictionService.StreamingRawPredict].
+   * 
+ * + * Protobuf type {@code google.cloud.aiplatform.v1.StreamingRawPredictResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.aiplatform.v1.StreamingRawPredictResponse) + com.google.cloud.aiplatform.v1.StreamingRawPredictResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.aiplatform.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse.class, + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse.Builder.class); + } + + // Construct using com.google.cloud.aiplatform.v1.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.v1.PredictionServiceProto + .internal_static_google_cloud_aiplatform_v1_StreamingRawPredictResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingRawPredictResponse getDefaultInstanceForType() { + return com.google.cloud.aiplatform.v1.StreamingRawPredictResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingRawPredictResponse build() { + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.aiplatform.v1.StreamingRawPredictResponse buildPartial() { + com.google.cloud.aiplatform.v1.StreamingRawPredictResponse result = + new com.google.cloud.aiplatform.v1.StreamingRawPredictResponse(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse) { + return mergeFrom((com.google.cloud.aiplatform.v1.StreamingRawPredictResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.aiplatform.v1.StreamingRawPredictResponse other) { + if (other == com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.aiplatform.v1.StreamingRawPredictResponse) + private static final com.google.cloud.aiplatform.v1.StreamingRawPredictResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.aiplatform.v1.StreamingRawPredictResponse(); + } + + public static com.google.cloud.aiplatform.v1.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.v1.StreamingRawPredictResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictResponseOrBuilder.java b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/StreamingRawPredictResponseOrBuilder.java new file mode 100644 index 000000000000..e9308b59254a --- /dev/null +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/java/com/google/cloud/aiplatform/v1/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/v1/prediction_service.proto + +package com.google.cloud.aiplatform.v1; + +public interface StreamingRawPredictResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.aiplatform.v1.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-v1/src/main/proto/google/cloud/aiplatform/v1/model.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/model.proto index 05d3ce28380c..1ca0ce1d6129 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/model.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/model.proto @@ -692,6 +692,17 @@ message ModelContainerSpec { // variable](https://cloud.google.com/vertex-ai/docs/predictions/custom-container-requirements#aip-variables).) string health_route = 7 [(google.api.field_behavior) = IMMUTABLE]; + // Immutable. List of ports to expose from the container. Vertex AI sends gRPC + // prediction requests that it receives to the first port on this list. Vertex + // AI also sends liveness and health checks to this port. + // + // If you do not specify this field, gRPC requests to the container will be + // disabled. + // + // Vertex AI does not use ports other than the first one listed. This field + // corresponds to the `ports` field of the Kubernetes Containers v1 core API. + repeated Port grpc_ports = 9 [(google.api.field_behavior) = IMMUTABLE]; + // Immutable. Deployment timeout. // Limit for deployment timeout is 2 hours. google.protobuf.Duration deployment_timeout = 10 diff --git a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/prediction_service.proto b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/prediction_service.proto index 881f981799ed..34a848b4ee7c 100644 --- a/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/prediction_service.proto +++ b/java-aiplatform/proto-google-cloud-aiplatform-v1/src/main/proto/google/cloud/aiplatform/v1/prediction_service.proto @@ -75,6 +75,29 @@ service PredictionService { option (google.api.method_signature) = "endpoint,http_body"; } + // Perform an unary online prediction request for Vertex first-party products + // and frameworks. + rpc DirectPredict(DirectPredictRequest) returns (DirectPredictResponse) { + option (google.api.http) = { + post: "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directPredict" + body: "*" + }; + } + + // Perform an online prediction request through gRPC. + rpc DirectRawPredict(DirectRawPredictRequest) + returns (DirectRawPredictResponse) { + option (google.api.http) = { + post: "/v1/{endpoint=projects/*/locations/*/endpoints/*}:directRawPredict" + body: "*" + }; + } + + // Perform a streaming online prediction request for Vertex first-party + // products and frameworks. + rpc StreamingPredict(stream StreamingPredictRequest) + returns (stream StreamingPredictResponse) {} + // Perform a server-side streaming online prediction request for Vertex // LLM streaming. rpc ServerStreamingPredict(StreamingPredictRequest) @@ -89,6 +112,10 @@ service PredictionService { }; } + // Perform a streaming online prediction request through gRPC. + rpc StreamingRawPredict(stream StreamingRawPredictRequest) + returns (stream StreamingRawPredictResponse) {} + // Perform an online explanation. // // If @@ -211,6 +238,69 @@ message RawPredictRequest { google.api.HttpBody http_body = 2; } +// Request message for +// [PredictionService.DirectPredict][google.cloud.aiplatform.v1.PredictionService.DirectPredict]. +message DirectPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // The prediction input. + repeated Tensor inputs = 2; + + // The parameters that govern the prediction. + Tensor parameters = 3; +} + +// Response message for +// [PredictionService.DirectPredict][google.cloud.aiplatform.v1.PredictionService.DirectPredict]. +message DirectPredictResponse { + // The prediction output. + repeated Tensor outputs = 1; + + // The parameters that govern the prediction. + Tensor parameters = 2; +} + +// Request message for +// [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1.PredictionService.DirectRawPredict]. +message DirectRawPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // Fully qualified name of the API method being invoked to perform + // predictions. + // + // Format: + // `/namespace.Service/Method/` + // Example: + // `/tensorflow.serving.PredictionService/Predict` + string method_name = 2; + + // The prediction input. + bytes input = 3; +} + +// Response message for +// [PredictionService.DirectRawPredict][google.cloud.aiplatform.v1.PredictionService.DirectRawPredict]. +message DirectRawPredictResponse { + // The prediction output. + bytes output = 1; +} + // Request message for // [PredictionService.StreamingPredict][google.cloud.aiplatform.v1.PredictionService.StreamingPredict]. // @@ -245,6 +335,50 @@ message StreamingPredictResponse { Tensor parameters = 2; } +// Request message for +// [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamingRawPredict]. +// +// The first message must contain +// [endpoint][google.cloud.aiplatform.v1.StreamingRawPredictRequest.endpoint] +// and +// [method_name][google.cloud.aiplatform.v1.StreamingRawPredictRequest.method_name] +// fields and optionally +// [input][google.cloud.aiplatform.v1.StreamingRawPredictRequest.input]. The +// subsequent messages must contain +// [input][google.cloud.aiplatform.v1.StreamingRawPredictRequest.input]. +// [method_name][google.cloud.aiplatform.v1.StreamingRawPredictRequest.method_name] +// in the subsequent messages have no effect. +message StreamingRawPredictRequest { + // Required. The name of the Endpoint requested to serve the prediction. + // Format: + // `projects/{project}/locations/{location}/endpoints/{endpoint}` + string endpoint = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "aiplatform.googleapis.com/Endpoint" + } + ]; + + // Fully qualified name of the API method being invoked to perform + // predictions. + // + // Format: + // `/namespace.Service/Method/` + // Example: + // `/tensorflow.serving.PredictionService/Predict` + string method_name = 2; + + // The prediction input. + bytes input = 3; +} + +// Response message for +// [PredictionService.StreamingRawPredict][google.cloud.aiplatform.v1.PredictionService.StreamingRawPredict]. +message StreamingRawPredictResponse { + // The prediction output. + bytes output = 1; +} + // Request message for // [PredictionService.Explain][google.cloud.aiplatform.v1.PredictionService.Explain]. message ExplainRequest { diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directpredict/AsyncDirectPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directpredict/AsyncDirectPredict.java new file mode 100644 index 000000000000..9785d2416f60 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/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.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_DirectPredict_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.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_v1_generated_PredictionService_DirectPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directpredict/SyncDirectPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directpredict/SyncDirectPredict.java new file mode 100644 index 000000000000..b297487ce084 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/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.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_DirectPredict_sync] +import com.google.cloud.aiplatform.v1.DirectPredictRequest; +import com.google.cloud.aiplatform.v1.DirectPredictResponse; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.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_v1_generated_PredictionService_DirectPredict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directrawpredict/AsyncDirectRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directrawpredict/AsyncDirectRawPredict.java new file mode 100644 index 000000000000..7007f9560331 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/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.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_DirectRawPredict_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.aiplatform.v1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1.DirectRawPredictResponse; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.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_v1_generated_PredictionService_DirectRawPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directrawpredict/SyncDirectRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/directrawpredict/SyncDirectRawPredict.java new file mode 100644 index 000000000000..394740bd2d03 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/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.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_DirectRawPredict_sync] +import com.google.cloud.aiplatform.v1.DirectRawPredictRequest; +import com.google.cloud.aiplatform.v1.DirectRawPredictResponse; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.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_v1_generated_PredictionService_DirectRawPredict_sync] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/streamingpredict/AsyncStreamingPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/streamingpredict/AsyncStreamingPredict.java new file mode 100644 index 000000000000..113597f57271 --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/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.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_StreamingPredict_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.StreamingPredictRequest; +import com.google.cloud.aiplatform.v1.StreamingPredictResponse; +import com.google.cloud.aiplatform.v1.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_v1_generated_PredictionService_StreamingPredict_async] diff --git a/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/streamingrawpredict/AsyncStreamingRawPredict.java b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/predictionservice/streamingrawpredict/AsyncStreamingRawPredict.java new file mode 100644 index 000000000000..6123b62470de --- /dev/null +++ b/java-aiplatform/samples/snippets/generated/com/google/cloud/aiplatform/v1/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.v1.samples; + +// [START aiplatform_v1_generated_PredictionService_StreamingRawPredict_async] +import com.google.api.gax.rpc.BidiStream; +import com.google.cloud.aiplatform.v1.EndpointName; +import com.google.cloud.aiplatform.v1.PredictionServiceClient; +import com.google.cloud.aiplatform.v1.StreamingRawPredictRequest; +import com.google.cloud.aiplatform.v1.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_v1_generated_PredictionService_StreamingRawPredict_async]