Skip to content

Commit 4ebc716

Browse files
feat: [vertexai] Update GAPIC library to include new features (#11473)
PiperOrigin-RevId: 734345919 Co-authored-by: Jaycee Li <[email protected]>
1 parent 104305e commit 4ebc716

File tree

377 files changed

+69593
-6179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+69593
-6179
lines changed

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/api/EndpointServiceClient.java

+138-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -160,6 +160,25 @@
160160
* </td>
161161
* </tr>
162162
* <tr>
163+
* <td><p> UpdateEndpointLongRunning</td>
164+
* <td><p> Updates an Endpoint with a long running operation.</td>
165+
* <td>
166+
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
167+
* <ul>
168+
* <li><p> updateEndpointLongRunningAsync(UpdateEndpointLongRunningRequest request)
169+
* </ul>
170+
* <p>Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.</p>
171+
* <ul>
172+
* <li><p> updateEndpointLongRunningAsync(Endpoint endpoint)
173+
* </ul>
174+
* <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
175+
* <ul>
176+
* <li><p> updateEndpointLongRunningOperationCallable()
177+
* <li><p> updateEndpointLongRunningCallable()
178+
* </ul>
179+
* </td>
180+
* </tr>
181+
* <tr>
163182
* <td><p> DeleteEndpoint</td>
164183
* <td><p> Deletes an Endpoint.</td>
165184
* <td>
@@ -1077,6 +1096,124 @@ public final UnaryCallable<UpdateEndpointRequest, Endpoint> updateEndpointCallab
10771096
return stub.updateEndpointCallable();
10781097
}
10791098

1099+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1100+
/**
1101+
* Updates an Endpoint with a long running operation.
1102+
*
1103+
* <p>Sample code:
1104+
*
1105+
* <pre>{@code
1106+
* // This snippet has been automatically generated and should be regarded as a code template only.
1107+
* // It will require modifications to work:
1108+
* // - It may require correct/in-range values for request initialization.
1109+
* // - It may require specifying regional endpoints when creating the service client as shown in
1110+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1111+
* try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
1112+
* Endpoint endpoint = Endpoint.newBuilder().build();
1113+
* Endpoint response = endpointServiceClient.updateEndpointLongRunningAsync(endpoint).get();
1114+
* }
1115+
* }</pre>
1116+
*
1117+
* @param endpoint Required. The Endpoint which replaces the resource on the server. Currently we
1118+
* only support updating the `client_connection_config` field, all the other fields' update
1119+
* will be blocked.
1120+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1121+
*/
1122+
public final OperationFuture<Endpoint, UpdateEndpointOperationMetadata>
1123+
updateEndpointLongRunningAsync(Endpoint endpoint) {
1124+
UpdateEndpointLongRunningRequest request =
1125+
UpdateEndpointLongRunningRequest.newBuilder().setEndpoint(endpoint).build();
1126+
return updateEndpointLongRunningAsync(request);
1127+
}
1128+
1129+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1130+
/**
1131+
* Updates an Endpoint with a long running operation.
1132+
*
1133+
* <p>Sample code:
1134+
*
1135+
* <pre>{@code
1136+
* // This snippet has been automatically generated and should be regarded as a code template only.
1137+
* // It will require modifications to work:
1138+
* // - It may require correct/in-range values for request initialization.
1139+
* // - It may require specifying regional endpoints when creating the service client as shown in
1140+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1141+
* try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
1142+
* UpdateEndpointLongRunningRequest request =
1143+
* UpdateEndpointLongRunningRequest.newBuilder()
1144+
* .setEndpoint(Endpoint.newBuilder().build())
1145+
* .build();
1146+
* Endpoint response = endpointServiceClient.updateEndpointLongRunningAsync(request).get();
1147+
* }
1148+
* }</pre>
1149+
*
1150+
* @param request The request object containing all of the parameters for the API call.
1151+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1152+
*/
1153+
public final OperationFuture<Endpoint, UpdateEndpointOperationMetadata>
1154+
updateEndpointLongRunningAsync(UpdateEndpointLongRunningRequest request) {
1155+
return updateEndpointLongRunningOperationCallable().futureCall(request);
1156+
}
1157+
1158+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1159+
/**
1160+
* Updates an Endpoint with a long running operation.
1161+
*
1162+
* <p>Sample code:
1163+
*
1164+
* <pre>{@code
1165+
* // This snippet has been automatically generated and should be regarded as a code template only.
1166+
* // It will require modifications to work:
1167+
* // - It may require correct/in-range values for request initialization.
1168+
* // - It may require specifying regional endpoints when creating the service client as shown in
1169+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1170+
* try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
1171+
* UpdateEndpointLongRunningRequest request =
1172+
* UpdateEndpointLongRunningRequest.newBuilder()
1173+
* .setEndpoint(Endpoint.newBuilder().build())
1174+
* .build();
1175+
* OperationFuture<Endpoint, UpdateEndpointOperationMetadata> future =
1176+
* endpointServiceClient.updateEndpointLongRunningOperationCallable().futureCall(request);
1177+
* // Do something.
1178+
* Endpoint response = future.get();
1179+
* }
1180+
* }</pre>
1181+
*/
1182+
public final OperationCallable<
1183+
UpdateEndpointLongRunningRequest, Endpoint, UpdateEndpointOperationMetadata>
1184+
updateEndpointLongRunningOperationCallable() {
1185+
return stub.updateEndpointLongRunningOperationCallable();
1186+
}
1187+
1188+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1189+
/**
1190+
* Updates an Endpoint with a long running operation.
1191+
*
1192+
* <p>Sample code:
1193+
*
1194+
* <pre>{@code
1195+
* // This snippet has been automatically generated and should be regarded as a code template only.
1196+
* // It will require modifications to work:
1197+
* // - It may require correct/in-range values for request initialization.
1198+
* // - It may require specifying regional endpoints when creating the service client as shown in
1199+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1200+
* try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
1201+
* UpdateEndpointLongRunningRequest request =
1202+
* UpdateEndpointLongRunningRequest.newBuilder()
1203+
* .setEndpoint(Endpoint.newBuilder().build())
1204+
* .build();
1205+
* ApiFuture<Operation> future =
1206+
* endpointServiceClient.updateEndpointLongRunningCallable().futureCall(request);
1207+
* // Do something.
1208+
* Operation response = future.get();
1209+
* }
1210+
* }</pre>
1211+
*/
1212+
public final UnaryCallable<UpdateEndpointLongRunningRequest, Operation>
1213+
updateEndpointLongRunningCallable() {
1214+
return stub.updateEndpointLongRunningCallable();
1215+
}
1216+
10801217
// AUTO-GENERATED DOCUMENTATION AND METHOD.
10811218
/**
10821219
* Deletes an Endpoint.

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/api/EndpointServiceSettings.java

+69-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -63,7 +63,9 @@
6363
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
6464
* build() is called, the tree of builders is called to create the complete settings object.
6565
*
66-
* <p>For example, to set the total timeout of getEndpoint to 30 seconds:
66+
* <p>For example, to set the
67+
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
68+
* of getEndpoint:
6769
*
6870
* <pre>{@code
6971
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -80,10 +82,47 @@
8082
* .getEndpointSettings()
8183
* .getRetrySettings()
8284
* .toBuilder()
83-
* .setTotalTimeout(Duration.ofSeconds(30))
85+
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
86+
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
87+
* .setMaxAttempts(5)
88+
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
89+
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
90+
* .setRetryDelayMultiplier(1.3)
91+
* .setRpcTimeoutMultiplier(1.5)
92+
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
8493
* .build());
8594
* EndpointServiceSettings endpointServiceSettings = endpointServiceSettingsBuilder.build();
8695
* }</pre>
96+
*
97+
* Please refer to the [Client Side Retry
98+
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
99+
* additional support in setting retries.
100+
*
101+
* <p>To configure the RetrySettings of a Long Running Operation method, create an
102+
* OperationTimedPollAlgorithm object and update the RPC's polling algorithm. For example, to
103+
* configure the RetrySettings for createEndpoint:
104+
*
105+
* <pre>{@code
106+
* // This snippet has been automatically generated and should be regarded as a code template only.
107+
* // It will require modifications to work:
108+
* // - It may require correct/in-range values for request initialization.
109+
* // - It may require specifying regional endpoints when creating the service client as shown in
110+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
111+
* EndpointServiceSettings.Builder endpointServiceSettingsBuilder =
112+
* EndpointServiceSettings.newBuilder();
113+
* TimedRetryAlgorithm timedRetryAlgorithm =
114+
* OperationalTimedPollAlgorithm.create(
115+
* RetrySettings.newBuilder()
116+
* .setInitialRetryDelayDuration(Duration.ofMillis(500))
117+
* .setRetryDelayMultiplier(1.5)
118+
* .setMaxRetryDelayDuration(Duration.ofMillis(5000))
119+
* .setTotalTimeoutDuration(Duration.ofHours(24))
120+
* .build());
121+
* endpointServiceSettingsBuilder
122+
* .createClusterOperationSettings()
123+
* .setPollingAlgorithm(timedRetryAlgorithm)
124+
* .build();
125+
* }</pre>
87126
*/
88127
@Generated("by gapic-generator-java")
89128
public class EndpointServiceSettings extends ClientSettings<EndpointServiceSettings> {
@@ -115,6 +154,20 @@ public UnaryCallSettings<UpdateEndpointRequest, Endpoint> updateEndpointSettings
115154
return ((EndpointServiceStubSettings) getStubSettings()).updateEndpointSettings();
116155
}
117156

157+
/** Returns the object with the settings used for calls to updateEndpointLongRunning. */
158+
public UnaryCallSettings<UpdateEndpointLongRunningRequest, Operation>
159+
updateEndpointLongRunningSettings() {
160+
return ((EndpointServiceStubSettings) getStubSettings()).updateEndpointLongRunningSettings();
161+
}
162+
163+
/** Returns the object with the settings used for calls to updateEndpointLongRunning. */
164+
public OperationCallSettings<
165+
UpdateEndpointLongRunningRequest, Endpoint, UpdateEndpointOperationMetadata>
166+
updateEndpointLongRunningOperationSettings() {
167+
return ((EndpointServiceStubSettings) getStubSettings())
168+
.updateEndpointLongRunningOperationSettings();
169+
}
170+
118171
/** Returns the object with the settings used for calls to deleteEndpoint. */
119172
public UnaryCallSettings<DeleteEndpointRequest, Operation> deleteEndpointSettings() {
120173
return ((EndpointServiceStubSettings) getStubSettings()).deleteEndpointSettings();
@@ -332,6 +385,19 @@ public UnaryCallSettings.Builder<UpdateEndpointRequest, Endpoint> updateEndpoint
332385
return getStubSettingsBuilder().updateEndpointSettings();
333386
}
334387

388+
/** Returns the builder for the settings used for calls to updateEndpointLongRunning. */
389+
public UnaryCallSettings.Builder<UpdateEndpointLongRunningRequest, Operation>
390+
updateEndpointLongRunningSettings() {
391+
return getStubSettingsBuilder().updateEndpointLongRunningSettings();
392+
}
393+
394+
/** Returns the builder for the settings used for calls to updateEndpointLongRunning. */
395+
public OperationCallSettings.Builder<
396+
UpdateEndpointLongRunningRequest, Endpoint, UpdateEndpointOperationMetadata>
397+
updateEndpointLongRunningOperationSettings() {
398+
return getStubSettingsBuilder().updateEndpointLongRunningOperationSettings();
399+
}
400+
335401
/** Returns the builder for the settings used for calls to deleteEndpoint. */
336402
public UnaryCallSettings.Builder<DeleteEndpointRequest, Operation> deleteEndpointSettings() {
337403
return getStubSettingsBuilder().deleteEndpointSettings();

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/api/LlmUtilityServiceClient.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -385,6 +385,7 @@ public final CountTokensResponse countTokens(String endpoint, List<Value> instan
385385
* .addAllContents(new ArrayList<Content>())
386386
* .setSystemInstruction(Content.newBuilder().build())
387387
* .addAllTools(new ArrayList<Tool>())
388+
* .setGenerationConfig(GenerationConfig.newBuilder().build())
388389
* .build();
389390
* CountTokensResponse response = llmUtilityServiceClient.countTokens(request);
390391
* }
@@ -421,6 +422,7 @@ public final CountTokensResponse countTokens(CountTokensRequest request) {
421422
* .addAllContents(new ArrayList<Content>())
422423
* .setSystemInstruction(Content.newBuilder().build())
423424
* .addAllTools(new ArrayList<Tool>())
425+
* .setGenerationConfig(GenerationConfig.newBuilder().build())
424426
* .build();
425427
* ApiFuture<CountTokensResponse> future =
426428
* llmUtilityServiceClient.countTokensCallable().futureCall(request);

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/api/LlmUtilityServiceSettings.java

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -59,7 +59,9 @@
5959
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
6060
* build() is called, the tree of builders is called to create the complete settings object.
6161
*
62-
* <p>For example, to set the total timeout of countTokens to 30 seconds:
62+
* <p>For example, to set the
63+
* [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings)
64+
* of countTokens:
6365
*
6466
* <pre>{@code
6567
* // This snippet has been automatically generated and should be regarded as a code template only.
@@ -76,10 +78,21 @@
7678
* .countTokensSettings()
7779
* .getRetrySettings()
7880
* .toBuilder()
79-
* .setTotalTimeout(Duration.ofSeconds(30))
81+
* .setInitialRetryDelayDuration(Duration.ofSeconds(1))
82+
* .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
83+
* .setMaxAttempts(5)
84+
* .setMaxRetryDelayDuration(Duration.ofSeconds(30))
85+
* .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
86+
* .setRetryDelayMultiplier(1.3)
87+
* .setRpcTimeoutMultiplier(1.5)
88+
* .setTotalTimeoutDuration(Duration.ofSeconds(300))
8089
* .build());
8190
* LlmUtilityServiceSettings llmUtilityServiceSettings = llmUtilityServiceSettingsBuilder.build();
8291
* }</pre>
92+
*
93+
* Please refer to the [Client Side Retry
94+
* Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for
95+
* additional support in setting retries.
8396
*/
8497
@Generated("by gapic-generator-java")
8598
public class LlmUtilityServiceSettings extends ClientSettings<LlmUtilityServiceSettings> {

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/api/PredictionServiceClient.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Google LLC
2+
* Copyright 2025 Google LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -1413,8 +1413,11 @@ public final GenerateContentResponse generateContent(String model, List<Content>
14131413
* .setModel("model104069929")
14141414
* .addAllContents(new ArrayList<Content>())
14151415
* .setSystemInstruction(Content.newBuilder().build())
1416+
* .setCachedContent(
1417+
* CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString())
14161418
* .addAllTools(new ArrayList<Tool>())
14171419
* .setToolConfig(ToolConfig.newBuilder().build())
1420+
* .putAllLabels(new HashMap<String, String>())
14181421
* .addAllSafetySettings(new ArrayList<SafetySetting>())
14191422
* .setGenerationConfig(GenerationConfig.newBuilder().build())
14201423
* .build();
@@ -1447,8 +1450,11 @@ public final GenerateContentResponse generateContent(GenerateContentRequest requ
14471450
* .setModel("model104069929")
14481451
* .addAllContents(new ArrayList<Content>())
14491452
* .setSystemInstruction(Content.newBuilder().build())
1453+
* .setCachedContent(
1454+
* CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString())
14501455
* .addAllTools(new ArrayList<Tool>())
14511456
* .setToolConfig(ToolConfig.newBuilder().build())
1457+
* .putAllLabels(new HashMap<String, String>())
14521458
* .addAllSafetySettings(new ArrayList<SafetySetting>())
14531459
* .setGenerationConfig(GenerationConfig.newBuilder().build())
14541460
* .build();
@@ -1482,8 +1488,11 @@ public final GenerateContentResponse generateContent(GenerateContentRequest requ
14821488
* .setModel("model104069929")
14831489
* .addAllContents(new ArrayList<Content>())
14841490
* .setSystemInstruction(Content.newBuilder().build())
1491+
* .setCachedContent(
1492+
* CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString())
14851493
* .addAllTools(new ArrayList<Tool>())
14861494
* .setToolConfig(ToolConfig.newBuilder().build())
1495+
* .putAllLabels(new HashMap<String, String>())
14871496
* .addAllSafetySettings(new ArrayList<SafetySetting>())
14881497
* .setGenerationConfig(GenerationConfig.newBuilder().build())
14891498
* .build();

0 commit comments

Comments
 (0)