1616
1717package com .google .cloud .vertexai ;
1818
19+ import com .google .api .core .InternalApi ;
1920import com .google .api .gax .core .CredentialsProvider ;
2021import com .google .api .gax .core .FixedCredentialsProvider ;
2122import com .google .api .gax .core .GaxProperties ;
@@ -220,11 +221,30 @@ public void setApiEndpoint(String apiEndpoint) {
220221 }
221222 }
222223
224+ /**
225+ * Returns the {@link PredictionServiceClient} with GRPC or REST, based on the Transport type. The
226+ * client will be instantiated when the first prediction API call is made.
227+ *
228+ * @return {@link PredictionServiceClient} that send requests to the backing service through
229+ * method calls that map to the API methods.
230+ */
231+ @ InternalApi
232+ public PredictionServiceClient getPredictionServiceClient () throws IOException {
233+ if (this .transport == Transport .GRPC ) {
234+ return getPredictionServiceGrpcClient ();
235+ } else {
236+ return getPredictionServiceRestClient ();
237+ }
238+ }
239+
223240 /**
224241 * Returns the {@link PredictionServiceClient} with GRPC. The client will be instantiated when the
225242 * first prediction API call is made.
243+ *
244+ * @return {@link PredictionServiceClient} that send GRPC requests to the backing service through
245+ * method calls that map to the API methods.
226246 */
227- public PredictionServiceClient getPredictionServiceClient () throws IOException {
247+ private PredictionServiceClient getPredictionServiceGrpcClient () throws IOException {
228248 if (predictionServiceClient == null ) {
229249 PredictionServiceSettings .Builder settingsBuilder = PredictionServiceSettings .newBuilder ();
230250 settingsBuilder .setEndpoint (String .format ("%s:443" , this .apiEndpoint ));
@@ -257,7 +277,7 @@ public PredictionServiceClient getPredictionServiceClient() throws IOException {
257277 * @return {@link PredictionServiceClient} that send REST requests to the backing service through
258278 * method calls that map to the API methods.
259279 */
260- public PredictionServiceClient getPredictionServiceRestClient () throws IOException {
280+ private PredictionServiceClient getPredictionServiceRestClient () throws IOException {
261281 if (predictionServiceRestClient == null ) {
262282 PredictionServiceSettings .Builder settingsBuilder =
263283 PredictionServiceSettings .newHttpJsonBuilder ();
@@ -284,14 +304,30 @@ public PredictionServiceClient getPredictionServiceRestClient() throws IOExcepti
284304 return predictionServiceRestClient ;
285305 }
286306
307+ /**
308+ * Returns the {@link LlmUtilityServiceClient} with GRPC or REST, based on the Transport type. The
309+ * client will be instantiated when the first API call is made.
310+ *
311+ * @return {@link LlmUtilityServiceClient} that makes calls to the backing service through method
312+ * calls that map to the API methods.
313+ */
314+ @ InternalApi
315+ public LlmUtilityServiceClient getLlmUtilityClient () throws IOException {
316+ if (this .transport == Transport .GRPC ) {
317+ return getLlmUtilityGrpcClient ();
318+ } else {
319+ return getLlmUtilityRestClient ();
320+ }
321+ }
322+
287323 /**
288324 * Returns the {@link LlmUtilityServiceClient} with GRPC. The client will be instantiated when the
289- * first prediction API call is made.
325+ * first API call is made.
290326 *
291327 * @return {@link LlmUtilityServiceClient} that makes gRPC calls to the backing service through
292328 * method calls that map to the API methods.
293329 */
294- public LlmUtilityServiceClient getLlmUtilityClient () throws IOException {
330+ private LlmUtilityServiceClient getLlmUtilityGrpcClient () throws IOException {
295331 if (llmUtilityClient == null ) {
296332 LlmUtilityServiceSettings .Builder settingsBuilder = LlmUtilityServiceSettings .newBuilder ();
297333 settingsBuilder .setEndpoint (String .format ("%s:443" , this .apiEndpoint ));
@@ -319,12 +355,12 @@ public LlmUtilityServiceClient getLlmUtilityClient() throws IOException {
319355
320356 /**
321357 * Returns the {@link LlmUtilityServiceClient} with REST. The client will be instantiated when the
322- * first prediction API call is made.
358+ * first API call is made.
323359 *
324360 * @return {@link LlmUtilityServiceClient} that makes REST requests to the backing service through
325361 * method calls that map to the API methods.
326362 */
327- public LlmUtilityServiceClient getLlmUtilityRestClient () throws IOException {
363+ private LlmUtilityServiceClient getLlmUtilityRestClient () throws IOException {
328364 if (llmUtilityRestClient == null ) {
329365 LlmUtilityServiceSettings .Builder settingsBuilder =
330366 LlmUtilityServiceSettings .newHttpJsonBuilder ();
0 commit comments