16
16
17
17
package com .google .cloud .vertexai ;
18
18
19
+ import com .google .api .core .InternalApi ;
19
20
import com .google .api .gax .core .CredentialsProvider ;
20
21
import com .google .api .gax .core .FixedCredentialsProvider ;
21
22
import com .google .api .gax .core .GaxProperties ;
@@ -220,11 +221,30 @@ public void setApiEndpoint(String apiEndpoint) {
220
221
}
221
222
}
222
223
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
+
223
240
/**
224
241
* Returns the {@link PredictionServiceClient} with GRPC. The client will be instantiated when the
225
242
* 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.
226
246
*/
227
- public PredictionServiceClient getPredictionServiceClient () throws IOException {
247
+ private PredictionServiceClient getPredictionServiceGrpcClient () throws IOException {
228
248
if (predictionServiceClient == null ) {
229
249
PredictionServiceSettings .Builder settingsBuilder = PredictionServiceSettings .newBuilder ();
230
250
settingsBuilder .setEndpoint (String .format ("%s:443" , this .apiEndpoint ));
@@ -257,7 +277,7 @@ public PredictionServiceClient getPredictionServiceClient() throws IOException {
257
277
* @return {@link PredictionServiceClient} that send REST requests to the backing service through
258
278
* method calls that map to the API methods.
259
279
*/
260
- public PredictionServiceClient getPredictionServiceRestClient () throws IOException {
280
+ private PredictionServiceClient getPredictionServiceRestClient () throws IOException {
261
281
if (predictionServiceRestClient == null ) {
262
282
PredictionServiceSettings .Builder settingsBuilder =
263
283
PredictionServiceSettings .newHttpJsonBuilder ();
@@ -284,14 +304,30 @@ public PredictionServiceClient getPredictionServiceRestClient() throws IOExcepti
284
304
return predictionServiceRestClient ;
285
305
}
286
306
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
+
287
323
/**
288
324
* 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.
290
326
*
291
327
* @return {@link LlmUtilityServiceClient} that makes gRPC calls to the backing service through
292
328
* method calls that map to the API methods.
293
329
*/
294
- public LlmUtilityServiceClient getLlmUtilityClient () throws IOException {
330
+ private LlmUtilityServiceClient getLlmUtilityGrpcClient () throws IOException {
295
331
if (llmUtilityClient == null ) {
296
332
LlmUtilityServiceSettings .Builder settingsBuilder = LlmUtilityServiceSettings .newBuilder ();
297
333
settingsBuilder .setEndpoint (String .format ("%s:443" , this .apiEndpoint ));
@@ -319,12 +355,12 @@ public LlmUtilityServiceClient getLlmUtilityClient() throws IOException {
319
355
320
356
/**
321
357
* 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.
323
359
*
324
360
* @return {@link LlmUtilityServiceClient} that makes REST requests to the backing service through
325
361
* method calls that map to the API methods.
326
362
*/
327
- public LlmUtilityServiceClient getLlmUtilityRestClient () throws IOException {
363
+ private LlmUtilityServiceClient getLlmUtilityRestClient () throws IOException {
328
364
if (llmUtilityRestClient == null ) {
329
365
LlmUtilityServiceSettings .Builder settingsBuilder =
330
366
LlmUtilityServiceSettings .newHttpJsonBuilder ();
0 commit comments