Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [aiplatform] add grpc_ports to UploadModel ModelContainerSpec #10091

Merged
merged 4 commits into from Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -24,6 +24,7 @@
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.BidiStreamingCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.ServerStreamingCallable;
import com.google.api.gax.rpc.UnaryCallable;
Expand Down Expand Up @@ -544,6 +545,175 @@ public final UnaryCallable<RawPredictRequest, HttpBody> rawPredictCallable() {
return stub.rawPredictCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform an unary online prediction request for Vertex first-party products and frameworks.
*
* <p>Sample code:
*
* <pre>{@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<Tensor>())
* .setParameters(Tensor.newBuilder().build())
* .build();
* DirectPredictResponse response = predictionServiceClient.directPredict(request);
* }
* }</pre>
*
* @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.
*
* <p>Sample code:
*
* <pre>{@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<Tensor>())
* .setParameters(Tensor.newBuilder().build())
* .build();
* ApiFuture<DirectPredictResponse> future =
* predictionServiceClient.directPredictCallable().futureCall(request);
* // Do something.
* DirectPredictResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<DirectPredictRequest, DirectPredictResponse> directPredictCallable() {
return stub.directPredictCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform an online prediction request through gRPC.
*
* <p>Sample code:
*
* <pre>{@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);
* }
* }</pre>
*
* @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.
*
* <p>Sample code:
*
* <pre>{@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<DirectRawPredictResponse> future =
* predictionServiceClient.directRawPredictCallable().futureCall(request);
* // Do something.
* DirectRawPredictResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<DirectRawPredictRequest, DirectRawPredictResponse>
directRawPredictCallable() {
return stub.directRawPredictCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform a streaming online prediction request for Vertex first-party products and frameworks.
*
* <p>Sample code:
*
* <pre>{@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<StreamingPredictRequest, StreamingPredictResponse> bidiStream =
* predictionServiceClient.streamingPredictCallable().call();
* StreamingPredictRequest request =
* StreamingPredictRequest.newBuilder()
* .setEndpoint(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .addAllInputs(new ArrayList<Tensor>())
* .setParameters(Tensor.newBuilder().build())
* .build();
* bidiStream.send(request);
* for (StreamingPredictResponse response : bidiStream) {
* // Do something when a response is received.
* }
* }
* }</pre>
*/
public final BidiStreamingCallable<StreamingPredictRequest, StreamingPredictResponse>
streamingPredictCallable() {
return stub.streamingPredictCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform a server-side streaming online prediction request for Vertex LLM streaming.
Expand Down Expand Up @@ -579,6 +749,42 @@ public final UnaryCallable<RawPredictRequest, HttpBody> rawPredictCallable() {
return stub.serverStreamingPredictCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform a streaming online prediction request through gRPC.
*
* <p>Sample code:
*
* <pre>{@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<StreamingRawPredictRequest, StreamingRawPredictResponse> 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.
* }
* }
* }</pre>
*/
public final BidiStreamingCallable<StreamingRawPredictRequest, StreamingRawPredictResponse>
streamingRawPredictCallable() {
return stub.streamingRawPredictCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Perform an online explanation.
Expand Down
Expand Up @@ -29,6 +29,7 @@
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.ServerStreamingCallSettings;
import com.google.api.gax.rpc.StreamingCallSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.aiplatform.v1beta1.stub.PredictionServiceStubSettings;
Expand Down Expand Up @@ -96,12 +97,35 @@ public UnaryCallSettings<RawPredictRequest, HttpBody> rawPredictSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).rawPredictSettings();
}

/** Returns the object with the settings used for calls to directPredict. */
public UnaryCallSettings<DirectPredictRequest, DirectPredictResponse> directPredictSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).directPredictSettings();
}

/** Returns the object with the settings used for calls to directRawPredict. */
public UnaryCallSettings<DirectRawPredictRequest, DirectRawPredictResponse>
directRawPredictSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).directRawPredictSettings();
}

/** Returns the object with the settings used for calls to streamingPredict. */
public StreamingCallSettings<StreamingPredictRequest, StreamingPredictResponse>
streamingPredictSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).streamingPredictSettings();
}

/** Returns the object with the settings used for calls to serverStreamingPredict. */
public ServerStreamingCallSettings<StreamingPredictRequest, StreamingPredictResponse>
serverStreamingPredictSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).serverStreamingPredictSettings();
}

/** Returns the object with the settings used for calls to streamingRawPredict. */
public StreamingCallSettings<StreamingRawPredictRequest, StreamingRawPredictResponse>
streamingRawPredictSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).streamingRawPredictSettings();
}

/** Returns the object with the settings used for calls to explain. */
public UnaryCallSettings<ExplainRequest, ExplainResponse> explainSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).explainSettings();
Expand Down Expand Up @@ -246,12 +270,36 @@ public UnaryCallSettings.Builder<RawPredictRequest, HttpBody> rawPredictSettings
return getStubSettingsBuilder().rawPredictSettings();
}

/** Returns the builder for the settings used for calls to directPredict. */
public UnaryCallSettings.Builder<DirectPredictRequest, DirectPredictResponse>
directPredictSettings() {
return getStubSettingsBuilder().directPredictSettings();
}

/** Returns the builder for the settings used for calls to directRawPredict. */
public UnaryCallSettings.Builder<DirectRawPredictRequest, DirectRawPredictResponse>
directRawPredictSettings() {
return getStubSettingsBuilder().directRawPredictSettings();
}

/** Returns the builder for the settings used for calls to streamingPredict. */
public StreamingCallSettings.Builder<StreamingPredictRequest, StreamingPredictResponse>
streamingPredictSettings() {
return getStubSettingsBuilder().streamingPredictSettings();
}

/** Returns the builder for the settings used for calls to serverStreamingPredict. */
public ServerStreamingCallSettings.Builder<StreamingPredictRequest, StreamingPredictResponse>
serverStreamingPredictSettings() {
return getStubSettingsBuilder().serverStreamingPredictSettings();
}

/** Returns the builder for the settings used for calls to streamingRawPredict. */
public StreamingCallSettings.Builder<StreamingRawPredictRequest, StreamingRawPredictResponse>
streamingRawPredictSettings() {
return getStubSettingsBuilder().streamingRawPredictSettings();
}

/** Returns the builder for the settings used for calls to explain. */
public UnaryCallSettings.Builder<ExplainRequest, ExplainResponse> explainSettings() {
return getStubSettingsBuilder().explainSettings();
Expand Down
Expand Up @@ -1078,6 +1078,12 @@
"CountTokens": {
"methods": ["countTokens", "countTokens", "countTokens", "countTokensCallable"]
},
"DirectPredict": {
"methods": ["directPredict", "directPredictCallable"]
},
"DirectRawPredict": {
"methods": ["directRawPredict", "directRawPredictCallable"]
},
"Explain": {
"methods": ["explain", "explain", "explain", "explainCallable"]
},
Expand All @@ -1102,6 +1108,12 @@
"SetIamPolicy": {
"methods": ["setIamPolicy", "setIamPolicyCallable"]
},
"StreamingPredict": {
"methods": ["streamingPredictCallable"]
},
"StreamingRawPredict": {
"methods": ["streamingRawPredictCallable"]
},
"TestIamPermissions": {
"methods": ["testIamPermissions", "testIamPermissionsCallable"]
}
Expand Down