Skip to content

Commit efb1144

Browse files
committed
chore: include vertexai changes
1 parent aec1b03 commit efb1144

File tree

426 files changed

+110388
-21906
lines changed

Some content is hidden

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

426 files changed

+110388
-21906
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
description = 'GAPIC library for gapic-google-cloud-vertexai-v1beta1-java'
2+
group = 'com.google.cloud'
3+
version = (version == 'unspecified') ? '0.0.0-SNAPSHOT' : version
4+
5+
compileJava.options.encoding = 'UTF-8'
6+
javadoc.options.encoding = 'UTF-8'
7+
8+
dependencies {
9+
api 'com.google.api:gax:2.37.0'
10+
testImplementation 'com.google.api:gax:2.37.0:testlib'
11+
api 'com.google.api:gax-grpc:2.37.0'
12+
testImplementation 'com.google.api:gax-grpc:2.37.0:testlib'
13+
api 'com.google.api:gax-httpjson:2.37.0'
14+
testImplementation 'com.google.api:gax-httpjson:2.37.0:testlib'
15+
api 'io.grpc:grpc-protobuf:1.59.0'
16+
testImplementation 'io.grpc:grpc-stub:1.59.0'
17+
testImplementation 'io.grpc:grpc-netty-shaded:1.59.0'
18+
testImplementation 'junit:junit:4.13.2'
19+
20+
// TODO: remove when dropping Java 8 support.
21+
// https://github.com/googleapis/gapic-generator-java/issues/888
22+
implementation 'javax.annotation:javax.annotation-api:1.3.2'
23+
24+
api project(':proto-google-cloud-vertexai-v1beta1-java')
25+
api 'com.google.api.grpc:proto-google-iam-v1:1.22.0'
26+
testImplementation project(':grpc-google-cloud-vertexai-v1beta1-java')
27+
testImplementation 'com.google.api.grpc:grpc-google-common-protos:2.27.0'
28+
testImplementation 'com.google.api.grpc:grpc-google-iam-v1:1.22.0'
29+
}
30+
31+
task smokeTest(type: Test) {
32+
filter {
33+
includeTestsMatching "*SmokeTest"
34+
setFailOnNoMatchingTests false
35+
}
36+
}
37+
38+
test {
39+
exclude "**/*SmokeTest*"
40+
}
41+
42+
clean {
43+
delete 'all-jars'
44+
}
45+
46+
task allJars(type: Copy) {
47+
dependsOn test, jar
48+
into 'all-jars'
49+
// Replace with `from configurations.testRuntimeClasspath, jar` to include test dependencies
50+
from configurations.runtimeClasspath, jar
51+
}

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@
240240
* </tr>
241241
* <tr>
242242
* <td><p> MutateDeployedModel</td>
243-
* <td><p> Updates an existing deployed model. Updatable fields include `min_replica_count`, `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and `enable_container_logging` (v1beta1 only).</td>
243+
* <td><p> Updates an existing deployed model. Updatable fields include `min_replica_count`, `max_replica_count`, `required_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and `enable_container_logging` (v1beta1 only).</td>
244244
* <td>
245245
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
246246
* <ul>
@@ -1773,8 +1773,8 @@ public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallabl
17731773
// AUTO-GENERATED DOCUMENTATION AND METHOD.
17741774
/**
17751775
* Updates an existing deployed model. Updatable fields include `min_replica_count`,
1776-
* `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
1777-
* `enable_container_logging` (v1beta1 only).
1776+
* `max_replica_count`, `required_replica_count`, `autoscaling_metric_specs`,
1777+
* `disable_container_logging` (v1 only), and `enable_container_logging` (v1beta1 only).
17781778
*
17791779
* <p>Sample code:
17801780
*
@@ -1805,6 +1805,8 @@ public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallabl
18051805
* <li>`max_replica_count` in either
18061806
* [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources] or
18071807
* [AutomaticResources][google.cloud.aiplatform.v1.AutomaticResources]
1808+
* <li>`required_replica_count` in
1809+
* [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources]
18081810
* <li>[autoscaling_metric_specs][google.cloud.aiplatform.v1.DedicatedResources.autoscaling_metric_specs]
18091811
* <li>`disable_container_logging` (v1 only)
18101812
* <li>`enable_container_logging` (v1beta1 only)
@@ -1829,8 +1831,8 @@ public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallabl
18291831
// AUTO-GENERATED DOCUMENTATION AND METHOD.
18301832
/**
18311833
* Updates an existing deployed model. Updatable fields include `min_replica_count`,
1832-
* `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
1833-
* `enable_container_logging` (v1beta1 only).
1834+
* `max_replica_count`, `required_replica_count`, `autoscaling_metric_specs`,
1835+
* `disable_container_logging` (v1 only), and `enable_container_logging` (v1beta1 only).
18341836
*
18351837
* <p>Sample code:
18361838
*
@@ -1862,6 +1864,8 @@ public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallabl
18621864
* <li>`max_replica_count` in either
18631865
* [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources] or
18641866
* [AutomaticResources][google.cloud.aiplatform.v1.AutomaticResources]
1867+
* <li>`required_replica_count` in
1868+
* [DedicatedResources][google.cloud.aiplatform.v1.DedicatedResources]
18651869
* <li>[autoscaling_metric_specs][google.cloud.aiplatform.v1.DedicatedResources.autoscaling_metric_specs]
18661870
* <li>`disable_container_logging` (v1 only)
18671871
* <li>`enable_container_logging` (v1beta1 only)
@@ -1885,8 +1889,8 @@ public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallabl
18851889
// AUTO-GENERATED DOCUMENTATION AND METHOD.
18861890
/**
18871891
* Updates an existing deployed model. Updatable fields include `min_replica_count`,
1888-
* `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
1889-
* `enable_container_logging` (v1beta1 only).
1892+
* `max_replica_count`, `required_replica_count`, `autoscaling_metric_specs`,
1893+
* `disable_container_logging` (v1 only), and `enable_container_logging` (v1beta1 only).
18901894
*
18911895
* <p>Sample code:
18921896
*
@@ -1922,8 +1926,8 @@ public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallabl
19221926
// AUTO-GENERATED DOCUMENTATION AND METHOD.
19231927
/**
19241928
* Updates an existing deployed model. Updatable fields include `min_replica_count`,
1925-
* `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
1926-
* `enable_container_logging` (v1beta1 only).
1929+
* `max_replica_count`, `required_replica_count`, `autoscaling_metric_specs`,
1930+
* `disable_container_logging` (v1 only), and `enable_container_logging` (v1beta1 only).
19271931
*
19281932
* <p>Sample code:
19291933
*
@@ -1961,8 +1965,8 @@ public final UnaryCallable<UndeployModelRequest, Operation> undeployModelCallabl
19611965
// AUTO-GENERATED DOCUMENTATION AND METHOD.
19621966
/**
19631967
* Updates an existing deployed model. Updatable fields include `min_replica_count`,
1964-
* `max_replica_count`, `autoscaling_metric_specs`, `disable_container_logging` (v1 only), and
1965-
* `enable_container_logging` (v1beta1 only).
1968+
* `max_replica_count`, `required_replica_count`, `autoscaling_metric_specs`,
1969+
* `disable_container_logging` (v1 only), and `enable_container_logging` (v1beta1 only).
19661970
*
19671971
* <p>Sample code:
19681972
*

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

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,25 @@
260260
* </td>
261261
* </tr>
262262
* <tr>
263+
* <td><p> EmbedContent</td>
264+
* <td><p> Embed content with multimodal inputs.</td>
265+
* <td>
266+
* <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
267+
* <ul>
268+
* <li><p> embedContent(EmbedContentRequest request)
269+
* </ul>
270+
* <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p>
271+
* <ul>
272+
* <li><p> embedContent(EndpointName model, Content content)
273+
* <li><p> embedContent(String model, Content content)
274+
* </ul>
275+
* <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>
276+
* <ul>
277+
* <li><p> embedContentCallable()
278+
* </ul>
279+
* </td>
280+
* </tr>
281+
* <tr>
263282
* <td><p> ListLocations</td>
264283
* <td><p> Lists information about the supported locations for this service.</td>
265284
* <td>
@@ -559,6 +578,7 @@ public final PredictResponse predict(String endpoint, List<Value> instances, Val
559578
* .toString())
560579
* .addAllInstances(new ArrayList<Value>())
561580
* .setParameters(Value.newBuilder().setBoolValue(true).build())
581+
* .putAllLabels(new HashMap<String, String>())
562582
* .build();
563583
* PredictResponse response = predictionServiceClient.predict(request);
564584
* }
@@ -592,6 +612,7 @@ public final PredictResponse predict(PredictRequest request) {
592612
* .toString())
593613
* .addAllInstances(new ArrayList<Value>())
594614
* .setParameters(Value.newBuilder().setBoolValue(true).build())
615+
* .putAllLabels(new HashMap<String, String>())
595616
* .build();
596617
* ApiFuture<PredictResponse> future =
597618
* predictionServiceClient.predictCallable().futureCall(request);
@@ -1419,6 +1440,7 @@ public final GenerateContentResponse generateContent(String model, List<Content>
14191440
* .setToolConfig(ToolConfig.newBuilder().build())
14201441
* .putAllLabels(new HashMap<String, String>())
14211442
* .addAllSafetySettings(new ArrayList<SafetySetting>())
1443+
* .setModelArmorConfig(ModelArmorConfig.newBuilder().build())
14221444
* .setGenerationConfig(GenerationConfig.newBuilder().build())
14231445
* .build();
14241446
* GenerateContentResponse response = predictionServiceClient.generateContent(request);
@@ -1456,6 +1478,7 @@ public final GenerateContentResponse generateContent(GenerateContentRequest requ
14561478
* .setToolConfig(ToolConfig.newBuilder().build())
14571479
* .putAllLabels(new HashMap<String, String>())
14581480
* .addAllSafetySettings(new ArrayList<SafetySetting>())
1481+
* .setModelArmorConfig(ModelArmorConfig.newBuilder().build())
14591482
* .setGenerationConfig(GenerationConfig.newBuilder().build())
14601483
* .build();
14611484
* ApiFuture<GenerateContentResponse> future =
@@ -1494,6 +1517,7 @@ public final GenerateContentResponse generateContent(GenerateContentRequest requ
14941517
* .setToolConfig(ToolConfig.newBuilder().build())
14951518
* .putAllLabels(new HashMap<String, String>())
14961519
* .addAllSafetySettings(new ArrayList<SafetySetting>())
1520+
* .setModelArmorConfig(ModelArmorConfig.newBuilder().build())
14971521
* .setGenerationConfig(GenerationConfig.newBuilder().build())
14981522
* .build();
14991523
* ServerStream<GenerateContentResponse> stream =
@@ -1509,6 +1533,143 @@ public final GenerateContentResponse generateContent(GenerateContentRequest requ
15091533
return stub.streamGenerateContentCallable();
15101534
}
15111535

1536+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1537+
/**
1538+
* Embed content with multimodal inputs.
1539+
*
1540+
* <p>Sample code:
1541+
*
1542+
* <pre>{@code
1543+
* // This snippet has been automatically generated and should be regarded as a code template only.
1544+
* // It will require modifications to work:
1545+
* // - It may require correct/in-range values for request initialization.
1546+
* // - It may require specifying regional endpoints when creating the service client as shown in
1547+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1548+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
1549+
* EndpointName model =
1550+
* EndpointName.ofProjectLocationPublisherModelName(
1551+
* "[PROJECT]", "[LOCATION]", "[PUBLISHER]", "[MODEL]");
1552+
* Content content = Content.newBuilder().build();
1553+
* EmbedContentResponse response = predictionServiceClient.embedContent(model, content);
1554+
* }
1555+
* }</pre>
1556+
*
1557+
* @param model Required. The name of the publisher model requested to serve the prediction.
1558+
* Format: `projects/{project}/locations/{location}/publishers/&#42;/models/&#42;`
1559+
* @param content Required. Input content to be embedded. Required.
1560+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1561+
*/
1562+
public final EmbedContentResponse embedContent(EndpointName model, Content content) {
1563+
EmbedContentRequest request =
1564+
EmbedContentRequest.newBuilder()
1565+
.setModel(model == null ? null : model.toString())
1566+
.setContent(content)
1567+
.build();
1568+
return embedContent(request);
1569+
}
1570+
1571+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1572+
/**
1573+
* Embed content with multimodal inputs.
1574+
*
1575+
* <p>Sample code:
1576+
*
1577+
* <pre>{@code
1578+
* // This snippet has been automatically generated and should be regarded as a code template only.
1579+
* // It will require modifications to work:
1580+
* // - It may require correct/in-range values for request initialization.
1581+
* // - It may require specifying regional endpoints when creating the service client as shown in
1582+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1583+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
1584+
* String model =
1585+
* EndpointName.ofProjectLocationEndpointName("[PROJECT]", "[LOCATION]", "[ENDPOINT]")
1586+
* .toString();
1587+
* Content content = Content.newBuilder().build();
1588+
* EmbedContentResponse response = predictionServiceClient.embedContent(model, content);
1589+
* }
1590+
* }</pre>
1591+
*
1592+
* @param model Required. The name of the publisher model requested to serve the prediction.
1593+
* Format: `projects/{project}/locations/{location}/publishers/&#42;/models/&#42;`
1594+
* @param content Required. Input content to be embedded. Required.
1595+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1596+
*/
1597+
public final EmbedContentResponse embedContent(String model, Content content) {
1598+
EmbedContentRequest request =
1599+
EmbedContentRequest.newBuilder().setModel(model).setContent(content).build();
1600+
return embedContent(request);
1601+
}
1602+
1603+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1604+
/**
1605+
* Embed content with multimodal inputs.
1606+
*
1607+
* <p>Sample code:
1608+
*
1609+
* <pre>{@code
1610+
* // This snippet has been automatically generated and should be regarded as a code template only.
1611+
* // It will require modifications to work:
1612+
* // - It may require correct/in-range values for request initialization.
1613+
* // - It may require specifying regional endpoints when creating the service client as shown in
1614+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1615+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
1616+
* EmbedContentRequest request =
1617+
* EmbedContentRequest.newBuilder()
1618+
* .setModel(
1619+
* EndpointName.ofProjectLocationPublisherModelName(
1620+
* "[PROJECT]", "[LOCATION]", "[PUBLISHER]", "[MODEL]")
1621+
* .toString())
1622+
* .setContent(Content.newBuilder().build())
1623+
* .setTitle("title110371416")
1624+
* .setOutputDimensionality(-495931909)
1625+
* .setAutoTruncate(true)
1626+
* .build();
1627+
* EmbedContentResponse response = predictionServiceClient.embedContent(request);
1628+
* }
1629+
* }</pre>
1630+
*
1631+
* @param request The request object containing all of the parameters for the API call.
1632+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1633+
*/
1634+
public final EmbedContentResponse embedContent(EmbedContentRequest request) {
1635+
return embedContentCallable().call(request);
1636+
}
1637+
1638+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
1639+
/**
1640+
* Embed content with multimodal inputs.
1641+
*
1642+
* <p>Sample code:
1643+
*
1644+
* <pre>{@code
1645+
* // This snippet has been automatically generated and should be regarded as a code template only.
1646+
* // It will require modifications to work:
1647+
* // - It may require correct/in-range values for request initialization.
1648+
* // - It may require specifying regional endpoints when creating the service client as shown in
1649+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1650+
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
1651+
* EmbedContentRequest request =
1652+
* EmbedContentRequest.newBuilder()
1653+
* .setModel(
1654+
* EndpointName.ofProjectLocationPublisherModelName(
1655+
* "[PROJECT]", "[LOCATION]", "[PUBLISHER]", "[MODEL]")
1656+
* .toString())
1657+
* .setContent(Content.newBuilder().build())
1658+
* .setTitle("title110371416")
1659+
* .setOutputDimensionality(-495931909)
1660+
* .setAutoTruncate(true)
1661+
* .build();
1662+
* ApiFuture<EmbedContentResponse> future =
1663+
* predictionServiceClient.embedContentCallable().futureCall(request);
1664+
* // Do something.
1665+
* EmbedContentResponse response = future.get();
1666+
* }
1667+
* }</pre>
1668+
*/
1669+
public final UnaryCallable<EmbedContentRequest, EmbedContentResponse> embedContentCallable() {
1670+
return stub.embedContentCallable();
1671+
}
1672+
15121673
// AUTO-GENERATED DOCUMENTATION AND METHOD.
15131674
/**
15141675
* Lists information about the supported locations for this service.

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ public UnaryCallSettings<ExplainRequest, ExplainResponse> explainSettings() {
173173
return ((PredictionServiceStubSettings) getStubSettings()).streamGenerateContentSettings();
174174
}
175175

176+
/** Returns the object with the settings used for calls to embedContent. */
177+
public UnaryCallSettings<EmbedContentRequest, EmbedContentResponse> embedContentSettings() {
178+
return ((PredictionServiceStubSettings) getStubSettings()).embedContentSettings();
179+
}
180+
176181
/** Returns the object with the settings used for calls to listLocations. */
177182
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
178183
listLocationsSettings() {
@@ -388,6 +393,12 @@ public UnaryCallSettings.Builder<ExplainRequest, ExplainResponse> explainSetting
388393
return getStubSettingsBuilder().streamGenerateContentSettings();
389394
}
390395

396+
/** Returns the builder for the settings used for calls to embedContent. */
397+
public UnaryCallSettings.Builder<EmbedContentRequest, EmbedContentResponse>
398+
embedContentSettings() {
399+
return getStubSettingsBuilder().embedContentSettings();
400+
}
401+
391402
/** Returns the builder for the settings used for calls to listLocations. */
392403
public PagedCallSettings.Builder<
393404
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>

java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/api/gapic_metadata.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797
"DirectRawPredict": {
9898
"methods": ["directRawPredict", "directRawPredictCallable"]
9999
},
100+
"EmbedContent": {
101+
"methods": ["embedContent", "embedContent", "embedContent", "embedContentCallable"]
102+
},
100103
"Explain": {
101104
"methods": ["explain", "explain", "explain", "explainCallable"]
102105
},

0 commit comments

Comments
 (0)