Skip to content

Commit d71e65a

Browse files
committed
Merge branch 'GoogleCloudPlatform:main' into model-optimizer
2 parents bbaeb8d + c382868 commit d71e65a

File tree

140 files changed

+7706
-657
lines changed

Some content is hidden

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

140 files changed

+7706
-657
lines changed

.github/CODEOWNERS

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,24 @@
2929
/workflows @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
3030

3131
# Infrastructure
32-
/accessapproval @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
33-
/auth @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/googleapis-auth
34-
/batch @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
35-
/compute @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
36-
/cdn @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
37-
/iam @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
38-
/iap @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
39-
/kms @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
40-
/parametermanager @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/cloud-secrets-team @GoogleCloudPlatform/cloud-parameters-team
41-
/privateca @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
42-
/recaptcha_enterprise @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
43-
/recaptcha_enterprise/demosite @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/recaptcha-customer-obsession-reviewers
44-
/secretmanager @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/cloud-secrets-team
45-
/security-command-center @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra @GoogleCloudPlatform/gcp-security-command-center
46-
/servicedirectory @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
47-
/webrisk @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
48-
/tpu @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/dee-infra
32+
/accessapproval @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
33+
/auth @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/googleapis-auth
34+
/batch @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
35+
/compute @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
36+
/cdn @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
37+
/iam @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
38+
/iap @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
39+
/kms @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
40+
/modelarmor @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/cloud-modelarmor-team
41+
/parametermanager @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/cloud-secrets-team @GoogleCloudPlatform/cloud-parameters-team
42+
/privateca @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
43+
/recaptcha_enterprise @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
44+
/recaptcha_enterprise/demosite @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/recaptcha-customer-obsession-reviewers
45+
/secretmanager @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/cloud-secrets-team
46+
/security-command-center @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers @GoogleCloudPlatform/gcp-security-command-center
47+
/servicedirectory @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
48+
/webrisk @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
49+
/tpu @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
4950

5051
# DEE Platform Ops (DEEPO)
5152
/errorreporting @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
@@ -73,6 +74,7 @@
7374
/dialogflow-cx @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
7475
/discoveryengine @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
7576
/document-ai @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
77+
/genai @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
7678
/jobs @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
7779
/language @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers
7880
/mediatranslation @GoogleCloudPlatform/java-samples-reviewers @yoshi-approver @GoogleCloudPlatform/cloud-samples-reviewers

.github/blunderbuss.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
assign_issues:
16-
- GoogleCloudPlatform/java-samples-reviewers
17-
1815
assign_issues_by:
1916
- labels:
2017
- "api: routeoptimization"
@@ -87,7 +84,6 @@ assign_issues_by:
8784
- "api: recaptchaenterprise"
8885
to:
8986
- GoogleCloudPlatform/recaptcha-customer-obsession-reviewers
90-
- GoogleCloudPlatform/dee-infra
9187
- labels:
9288
- "api: appengine"
9389
to:
@@ -96,9 +92,10 @@ assign_issues_by:
9692
- "api: bigquerydatatransfer"
9793
to:
9894
- GoogleCloudPlatform/bigquery-data-connectors
99-
100-
assign_prs:
101-
- GoogleCloudPlatform/java-samples-reviewers
95+
- labels:
96+
- "api: modelarmor"
97+
to:
98+
- GoogleCloudPlatform/cloud-modelarmor-team
10299

103100
assign_prs_by:
104101
- labels:
@@ -168,8 +165,11 @@ assign_prs_by:
168165
- "api: recaptchaenterprise"
169166
to:
170167
- GoogleCloudPlatform/recaptcha-customer-obsession-reviewers
171-
- GoogleCloudPlatform/dee-infra
172168
- labels:
173169
- "api: appengine"
174170
to:
175171
- GoogleCloudPlatform/serverless-runtimes
172+
- labels:
173+
- "api: modelarmor"
174+
to:
175+
- GoogleCloudPlatform/cloud-modelarmor-team

.github/flakybot.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/header-checker-lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,9 @@ sourceFileExtensions:
3838
- 'yml'
3939
ignoreFiles:
4040
- '.github/auto-label.yaml'
41+
- '.github/auto-approve.yml'
42+
- '.github/renovate.json5'
43+
- '.github/snippet-bot.yml'
44+
- '.github/stale.yml'
4145
- '.github/sync-repo-settings.yaml'
4246
ignoreLicenseYear: true

.github/stale.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ exemptLabels:
1111
- type: process
1212
- type: feature request
1313
- type: docs
14-
- flakybot: issue
15-
- flakybot: flaky
1614
- :rotating_light:
1715

1816
# Label to use when marking an issue as stale

.kokoro/tests/run_tests.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fi
4545
if [[ "$SCRIPT_DEBUG" != "true" ]]; then
4646
# Update `gcloud` and log versioning for debugging
4747
apt update && apt -y upgrade google-cloud-sdk
48-
48+
4949
echo "********** GIT INFO ***********"
5050
git version
5151
echo "********** GCLOUD INFO ***********"
@@ -67,7 +67,10 @@ if [[ "$SCRIPT_DEBUG" != "true" ]]; then
6767
# For Cloud Run filesystem sample
6868
export FILESTORE_IP_ADDRESS=$(gcloud secrets versions access latest --secret fs-app)
6969
export MNT_DIR=$PWD/run/filesystem
70-
70+
# For Model Armor tests
71+
export MA_FOLDER_ID=695279264361
72+
export MA_ORG_ID=951890214235
73+
7174
SECRET_FILES=("java-docs-samples-service-account.json" \
7275
"java-aiplatform-samples-secrets.txt" \
7376
"java-automl-samples-secrets.txt" \
@@ -88,7 +91,7 @@ if [[ "$SCRIPT_DEBUG" != "true" ]]; then
8891

8992
# create secret dir
9093
mkdir -p "${KOKORO_GFILE_DIR}/secrets"
91-
94+
9295
for SECRET in "${SECRET_FILES[@]}"; do
9396
# grab latest version of secret
9497
gcloud secrets versions access latest --secret="${SECRET%.*}" > "${KOKORO_GFILE_DIR}/secrets/$SECRET"
@@ -166,7 +169,7 @@ test_prog="$PWD/.kokoro/tests/run_test_java.sh"
166169

167170
git config --global --add safe.directory $PWD
168171

169-
# Use btlr to run all the tests in each folder
172+
# Use btlr to run all the tests in each folder
170173
echo "btlr" "${btlr_args[@]}" -- "${test_prog}"
171174
btlr "${btlr_args[@]}" -- "${test_prog}"
172175

aiplatform/src/main/java/aiplatform/PredictTextEmbeddingsSample.java

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ public static void main(String[] args) throws IOException {
4141
// https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings
4242
String endpoint = "us-central1-aiplatform.googleapis.com:443";
4343
String project = "YOUR_PROJECT_ID";
44-
String model = "text-embedding-005";
44+
String model = "gemini-embedding-001";
4545
predictTextEmbeddings(
4646
endpoint,
4747
project,
4848
model,
4949
List.of("banana bread?", "banana muffins?"),
5050
"QUESTION_ANSWERING",
51-
OptionalInt.of(256));
51+
OptionalInt.of(3072));
5252
}
5353

5454
// Gets text embeddings from a pretrained, foundational model.
@@ -67,37 +67,40 @@ public static List<List<Float>> predictTextEmbeddings(
6767
EndpointName endpointName =
6868
EndpointName.ofProjectLocationPublisherModelName(project, location, "google", model);
6969

70+
List<List<Float>> floats = new ArrayList<>();
7071
// You can use this prediction service client for multiple requests.
7172
try (PredictionServiceClient client = PredictionServiceClient.create(settings)) {
72-
PredictRequest.Builder request =
73-
PredictRequest.newBuilder().setEndpoint(endpointName.toString());
74-
if (outputDimensionality.isPresent()) {
75-
request.setParameters(
76-
Value.newBuilder()
77-
.setStructValue(
78-
Struct.newBuilder()
79-
.putFields("outputDimensionality", valueOf(outputDimensionality.getAsInt()))
80-
.build()));
81-
}
73+
// gemini-embedding-001 takes one input at a time.
8274
for (int i = 0; i < texts.size(); i++) {
75+
PredictRequest.Builder request =
76+
PredictRequest.newBuilder().setEndpoint(endpointName.toString());
77+
if (outputDimensionality.isPresent()) {
78+
request.setParameters(
79+
Value.newBuilder()
80+
.setStructValue(
81+
Struct.newBuilder()
82+
.putFields(
83+
"outputDimensionality", valueOf(outputDimensionality.getAsInt()))
84+
.build()));
85+
}
8386
request.addInstances(
8487
Value.newBuilder()
8588
.setStructValue(
8689
Struct.newBuilder()
8790
.putFields("content", valueOf(texts.get(i)))
8891
.putFields("task_type", valueOf(task))
8992
.build()));
90-
}
91-
PredictResponse response = client.predict(request.build());
92-
List<List<Float>> floats = new ArrayList<>();
93-
for (Value prediction : response.getPredictionsList()) {
94-
Value embeddings = prediction.getStructValue().getFieldsOrThrow("embeddings");
95-
Value values = embeddings.getStructValue().getFieldsOrThrow("values");
96-
floats.add(
97-
values.getListValue().getValuesList().stream()
98-
.map(Value::getNumberValue)
99-
.map(Double::floatValue)
100-
.collect(toList()));
93+
PredictResponse response = client.predict(request.build());
94+
95+
for (Value prediction : response.getPredictionsList()) {
96+
Value embeddings = prediction.getStructValue().getFieldsOrThrow("embeddings");
97+
Value values = embeddings.getStructValue().getFieldsOrThrow("values");
98+
floats.add(
99+
values.getListValue().getValuesList().stream()
100+
.map(Value::getNumberValue)
101+
.map(Double::floatValue)
102+
.collect(toList()));
103+
}
101104
}
102105
return floats;
103106
}

aiplatform/src/test/java/aiplatform/PredictTextEmbeddingsSampleTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void testPredictTextEmbeddings() throws IOException {
5252
PredictTextEmbeddingsSample.predictTextEmbeddings(
5353
APIS_ENDPOINT,
5454
PROJECT,
55-
"text-embedding-005",
55+
"gemini-embedding-001",
5656
texts,
5757
"QUESTION_ANSWERING",
5858
OptionalInt.of(5));

appengine-java11/appengine-simple-jetty-main/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2222
<maven.compiler.source>11</maven.compiler.source>
2323
<maven.compiler.target>11</maven.compiler.target>
24-
<jetty.version>9.4.56.v20240826</jetty.version>
24+
<jetty.version>9.4.57.v20241219</jetty.version>
2525
</properties>
2626

2727
<!-- [START gae_java11_server_dependencies] -->

dataflow/snippets/pom.xml

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
<!-- For initializing the KafkaIO connector -->
167167
<groupId>org.apache.kafka</groupId>
168168
<artifactId>kafka-clients</artifactId>
169-
<version>3.8.0</version>
169+
<version>3.9.1</version>
170170
</dependency>
171171
<dependency>
172172
<!-- For running containerized Kafka instance in the integration test -->

0 commit comments

Comments
 (0)