Skip to content

Commit de32d7a

Browse files
feat: [aiplatform] add grpc_ports to UploadModel ModelContainerSpec (#10065)
* 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: googleapis/googleapis@31c70c9 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 <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 7a49d63 commit de32d7a

File tree

34 files changed

+9152
-122
lines changed

34 files changed

+9152
-122
lines changed

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceClient.java

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.api.gax.paging.AbstractFixedSizeCollection;
2424
import com.google.api.gax.paging.AbstractPage;
2525
import com.google.api.gax.paging.AbstractPagedListResponse;
26+
import com.google.api.gax.rpc.BidiStreamingCallable;
2627
import com.google.api.gax.rpc.PageContext;
2728
import com.google.api.gax.rpc.ServerStreamingCallable;
2829
import com.google.api.gax.rpc.UnaryCallable;
@@ -536,6 +537,175 @@ public final UnaryCallable<RawPredictRequest, HttpBody> rawPredictCallable() {
536537
return stub.rawPredictCallable();
537538
}
538539

540+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
541+
/**
542+
* Perform an unary online prediction request for Vertex first-party products and frameworks.
543+
*
544+
* <p>Sample code:
545+
*
546+
* <pre>{@code
547+
* // This snippet has been automatically generated and should be regarded as a code template only.
548+
* // It will require modifications to work:
549+
* // - It may require correct/in-range values for request initialization.
550+
* // - It may require specifying regional endpoints when creating the service client as shown in
551+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
552+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
553+
* DirectPredictRequest request =
554+
* DirectPredictRequest.newBuilder()
555+
* .setEndpoint(
556+
* EndpointName.ofProjectLocationEndpointName(
557+
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
558+
* .toString())
559+
* .addAllInputs(new ArrayList<Tensor>())
560+
* .setParameters(Tensor.newBuilder().build())
561+
* .build();
562+
* DirectPredictResponse response = predictionServiceClient.directPredict(request);
563+
* }
564+
* }</pre>
565+
*
566+
* @param request The request object containing all of the parameters for the API call.
567+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
568+
*/
569+
public final DirectPredictResponse directPredict(DirectPredictRequest request) {
570+
return directPredictCallable().call(request);
571+
}
572+
573+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
574+
/**
575+
* Perform an unary online prediction request for Vertex first-party products and frameworks.
576+
*
577+
* <p>Sample code:
578+
*
579+
* <pre>{@code
580+
* // This snippet has been automatically generated and should be regarded as a code template only.
581+
* // It will require modifications to work:
582+
* // - It may require correct/in-range values for request initialization.
583+
* // - It may require specifying regional endpoints when creating the service client as shown in
584+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
585+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
586+
* DirectPredictRequest request =
587+
* DirectPredictRequest.newBuilder()
588+
* .setEndpoint(
589+
* EndpointName.ofProjectLocationEndpointName(
590+
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
591+
* .toString())
592+
* .addAllInputs(new ArrayList<Tensor>())
593+
* .setParameters(Tensor.newBuilder().build())
594+
* .build();
595+
* ApiFuture<DirectPredictResponse> future =
596+
* predictionServiceClient.directPredictCallable().futureCall(request);
597+
* // Do something.
598+
* DirectPredictResponse response = future.get();
599+
* }
600+
* }</pre>
601+
*/
602+
public final UnaryCallable<DirectPredictRequest, DirectPredictResponse> directPredictCallable() {
603+
return stub.directPredictCallable();
604+
}
605+
606+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
607+
/**
608+
* Perform an online prediction request through gRPC.
609+
*
610+
* <p>Sample code:
611+
*
612+
* <pre>{@code
613+
* // This snippet has been automatically generated and should be regarded as a code template only.
614+
* // It will require modifications to work:
615+
* // - It may require correct/in-range values for request initialization.
616+
* // - It may require specifying regional endpoints when creating the service client as shown in
617+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
618+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
619+
* DirectRawPredictRequest request =
620+
* DirectRawPredictRequest.newBuilder()
621+
* .setEndpoint(
622+
* EndpointName.ofProjectLocationEndpointName(
623+
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
624+
* .toString())
625+
* .setMethodName("methodName-723163380")
626+
* .setInput(ByteString.EMPTY)
627+
* .build();
628+
* DirectRawPredictResponse response = predictionServiceClient.directRawPredict(request);
629+
* }
630+
* }</pre>
631+
*
632+
* @param request The request object containing all of the parameters for the API call.
633+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
634+
*/
635+
public final DirectRawPredictResponse directRawPredict(DirectRawPredictRequest request) {
636+
return directRawPredictCallable().call(request);
637+
}
638+
639+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
640+
/**
641+
* Perform an online prediction request through gRPC.
642+
*
643+
* <p>Sample code:
644+
*
645+
* <pre>{@code
646+
* // This snippet has been automatically generated and should be regarded as a code template only.
647+
* // It will require modifications to work:
648+
* // - It may require correct/in-range values for request initialization.
649+
* // - It may require specifying regional endpoints when creating the service client as shown in
650+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
651+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
652+
* DirectRawPredictRequest request =
653+
* DirectRawPredictRequest.newBuilder()
654+
* .setEndpoint(
655+
* EndpointName.ofProjectLocationEndpointName(
656+
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
657+
* .toString())
658+
* .setMethodName("methodName-723163380")
659+
* .setInput(ByteString.EMPTY)
660+
* .build();
661+
* ApiFuture<DirectRawPredictResponse> future =
662+
* predictionServiceClient.directRawPredictCallable().futureCall(request);
663+
* // Do something.
664+
* DirectRawPredictResponse response = future.get();
665+
* }
666+
* }</pre>
667+
*/
668+
public final UnaryCallable<DirectRawPredictRequest, DirectRawPredictResponse>
669+
directRawPredictCallable() {
670+
return stub.directRawPredictCallable();
671+
}
672+
673+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
674+
/**
675+
* Perform a streaming online prediction request for Vertex first-party products and frameworks.
676+
*
677+
* <p>Sample code:
678+
*
679+
* <pre>{@code
680+
* // This snippet has been automatically generated and should be regarded as a code template only.
681+
* // It will require modifications to work:
682+
* // - It may require correct/in-range values for request initialization.
683+
* // - It may require specifying regional endpoints when creating the service client as shown in
684+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
685+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
686+
* BidiStream<StreamingPredictRequest, StreamingPredictResponse> bidiStream =
687+
* predictionServiceClient.streamingPredictCallable().call();
688+
* StreamingPredictRequest request =
689+
* StreamingPredictRequest.newBuilder()
690+
* .setEndpoint(
691+
* EndpointName.ofProjectLocationEndpointName(
692+
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
693+
* .toString())
694+
* .addAllInputs(new ArrayList<Tensor>())
695+
* .setParameters(Tensor.newBuilder().build())
696+
* .build();
697+
* bidiStream.send(request);
698+
* for (StreamingPredictResponse response : bidiStream) {
699+
* // Do something when a response is received.
700+
* }
701+
* }
702+
* }</pre>
703+
*/
704+
public final BidiStreamingCallable<StreamingPredictRequest, StreamingPredictResponse>
705+
streamingPredictCallable() {
706+
return stub.streamingPredictCallable();
707+
}
708+
539709
// AUTO-GENERATED DOCUMENTATION AND METHOD.
540710
/**
541711
* Perform a server-side streaming online prediction request for Vertex LLM streaming.
@@ -571,6 +741,42 @@ public final UnaryCallable<RawPredictRequest, HttpBody> rawPredictCallable() {
571741
return stub.serverStreamingPredictCallable();
572742
}
573743

744+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
745+
/**
746+
* Perform a streaming online prediction request through gRPC.
747+
*
748+
* <p>Sample code:
749+
*
750+
* <pre>{@code
751+
* // This snippet has been automatically generated and should be regarded as a code template only.
752+
* // It will require modifications to work:
753+
* // - It may require correct/in-range values for request initialization.
754+
* // - It may require specifying regional endpoints when creating the service client as shown in
755+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
756+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
757+
* BidiStream<StreamingRawPredictRequest, StreamingRawPredictResponse> bidiStream =
758+
* predictionServiceClient.streamingRawPredictCallable().call();
759+
* StreamingRawPredictRequest request =
760+
* StreamingRawPredictRequest.newBuilder()
761+
* .setEndpoint(
762+
* EndpointName.ofProjectLocationEndpointName(
763+
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
764+
* .toString())
765+
* .setMethodName("methodName-723163380")
766+
* .setInput(ByteString.EMPTY)
767+
* .build();
768+
* bidiStream.send(request);
769+
* for (StreamingRawPredictResponse response : bidiStream) {
770+
* // Do something when a response is received.
771+
* }
772+
* }
773+
* }</pre>
774+
*/
775+
public final BidiStreamingCallable<StreamingRawPredictRequest, StreamingRawPredictResponse>
776+
streamingRawPredictCallable() {
777+
return stub.streamingRawPredictCallable();
778+
}
779+
574780
// AUTO-GENERATED DOCUMENTATION AND METHOD.
575781
/**
576782
* Perform an online explanation.

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/PredictionServiceSettings.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.google.api.gax.rpc.ClientSettings;
3030
import com.google.api.gax.rpc.PagedCallSettings;
3131
import com.google.api.gax.rpc.ServerStreamingCallSettings;
32+
import com.google.api.gax.rpc.StreamingCallSettings;
3233
import com.google.api.gax.rpc.TransportChannelProvider;
3334
import com.google.api.gax.rpc.UnaryCallSettings;
3435
import com.google.cloud.aiplatform.v1.stub.PredictionServiceStubSettings;
@@ -95,12 +96,35 @@ public UnaryCallSettings<RawPredictRequest, HttpBody> rawPredictSettings() {
9596
return ((PredictionServiceStubSettings) getStubSettings()).rawPredictSettings();
9697
}
9798

99+
/** Returns the object with the settings used for calls to directPredict. */
100+
public UnaryCallSettings<DirectPredictRequest, DirectPredictResponse> directPredictSettings() {
101+
return ((PredictionServiceStubSettings) getStubSettings()).directPredictSettings();
102+
}
103+
104+
/** Returns the object with the settings used for calls to directRawPredict. */
105+
public UnaryCallSettings<DirectRawPredictRequest, DirectRawPredictResponse>
106+
directRawPredictSettings() {
107+
return ((PredictionServiceStubSettings) getStubSettings()).directRawPredictSettings();
108+
}
109+
110+
/** Returns the object with the settings used for calls to streamingPredict. */
111+
public StreamingCallSettings<StreamingPredictRequest, StreamingPredictResponse>
112+
streamingPredictSettings() {
113+
return ((PredictionServiceStubSettings) getStubSettings()).streamingPredictSettings();
114+
}
115+
98116
/** Returns the object with the settings used for calls to serverStreamingPredict. */
99117
public ServerStreamingCallSettings<StreamingPredictRequest, StreamingPredictResponse>
100118
serverStreamingPredictSettings() {
101119
return ((PredictionServiceStubSettings) getStubSettings()).serverStreamingPredictSettings();
102120
}
103121

122+
/** Returns the object with the settings used for calls to streamingRawPredict. */
123+
public StreamingCallSettings<StreamingRawPredictRequest, StreamingRawPredictResponse>
124+
streamingRawPredictSettings() {
125+
return ((PredictionServiceStubSettings) getStubSettings()).streamingRawPredictSettings();
126+
}
127+
104128
/** Returns the object with the settings used for calls to explain. */
105129
public UnaryCallSettings<ExplainRequest, ExplainResponse> explainSettings() {
106130
return ((PredictionServiceStubSettings) getStubSettings()).explainSettings();
@@ -240,12 +264,36 @@ public UnaryCallSettings.Builder<RawPredictRequest, HttpBody> rawPredictSettings
240264
return getStubSettingsBuilder().rawPredictSettings();
241265
}
242266

267+
/** Returns the builder for the settings used for calls to directPredict. */
268+
public UnaryCallSettings.Builder<DirectPredictRequest, DirectPredictResponse>
269+
directPredictSettings() {
270+
return getStubSettingsBuilder().directPredictSettings();
271+
}
272+
273+
/** Returns the builder for the settings used for calls to directRawPredict. */
274+
public UnaryCallSettings.Builder<DirectRawPredictRequest, DirectRawPredictResponse>
275+
directRawPredictSettings() {
276+
return getStubSettingsBuilder().directRawPredictSettings();
277+
}
278+
279+
/** Returns the builder for the settings used for calls to streamingPredict. */
280+
public StreamingCallSettings.Builder<StreamingPredictRequest, StreamingPredictResponse>
281+
streamingPredictSettings() {
282+
return getStubSettingsBuilder().streamingPredictSettings();
283+
}
284+
243285
/** Returns the builder for the settings used for calls to serverStreamingPredict. */
244286
public ServerStreamingCallSettings.Builder<StreamingPredictRequest, StreamingPredictResponse>
245287
serverStreamingPredictSettings() {
246288
return getStubSettingsBuilder().serverStreamingPredictSettings();
247289
}
248290

291+
/** Returns the builder for the settings used for calls to streamingRawPredict. */
292+
public StreamingCallSettings.Builder<StreamingRawPredictRequest, StreamingRawPredictResponse>
293+
streamingRawPredictSettings() {
294+
return getStubSettingsBuilder().streamingRawPredictSettings();
295+
}
296+
249297
/** Returns the builder for the settings used for calls to explain. */
250298
public UnaryCallSettings.Builder<ExplainRequest, ExplainResponse> explainSettings() {
251299
return getStubSettingsBuilder().explainSettings();

java-aiplatform/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1/gapic_metadata.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,12 @@
991991
"grpc": {
992992
"libraryClient": "PredictionServiceClient",
993993
"rpcs": {
994+
"DirectPredict": {
995+
"methods": ["directPredict", "directPredictCallable"]
996+
},
997+
"DirectRawPredict": {
998+
"methods": ["directRawPredict", "directRawPredictCallable"]
999+
},
9941000
"Explain": {
9951001
"methods": ["explain", "explain", "explain", "explainCallable"]
9961002
},
@@ -1015,6 +1021,12 @@
10151021
"SetIamPolicy": {
10161022
"methods": ["setIamPolicy", "setIamPolicyCallable"]
10171023
},
1024+
"StreamingPredict": {
1025+
"methods": ["streamingPredictCallable"]
1026+
},
1027+
"StreamingRawPredict": {
1028+
"methods": ["streamingRawPredictCallable"]
1029+
},
10181030
"TestIamPermissions": {
10191031
"methods": ["testIamPermissions", "testIamPermissionsCallable"]
10201032
}

0 commit comments

Comments
 (0)