Skip to content
Merged
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
884368f
feat!: initial generation of library (#4)
Nov 10, 2020
b9770cc
chore: release 1.0.0 (#6)
release-please[bot] Nov 10, 2020
bb76ec5
feat: adds enhancements to library (#22)
telpirion Dec 18, 2020
c6916e6
chore: release 1.1.0 (#29)
release-please[bot] Jan 7, 2021
ecd8583
feat: adds cleaner utility for orphaned resources (#34)
telpirion Jan 7, 2021
9138e20
chore: release 1.2.0 (#36)
release-please[bot] Jan 12, 2021
ea5e774
feat(samples): adds samples for enhanced version of library (#16)
telpirion Jan 13, 2021
6b734a1
Remove cleaning script from tests (#58)
lucaswadedavis Jan 14, 2021
4daab03
chore: release 1.3.0 (#39)
release-please[bot] Jan 15, 2021
31d2992
build: increase retries and timeout for flaky tests (#60)
sofisl Jan 19, 2021
a26c64d
build: increase retries for #33 (#61)
sofisl Jan 20, 2021
4d446d5
samples: fix region tag (#65)
telpirion Feb 4, 2021
a35f497
fix: reduces image object detection test file size (#69)
telpirion Feb 4, 2021
66ff554
feat(samples): add additional samples to library (#25)
lucaswadedavis Feb 10, 2021
4dc0382
feat: updates enhanced client library veneer and samples (#73)
telpirion Feb 12, 2021
19be240
chore: release 1.4.0 (#64)
release-please[bot] Feb 16, 2021
0e1ed18
test: extend timeout (#78)
lucaswadedavis Feb 17, 2021
85870eb
chore: release 1.5.0 (#79)
release-please[bot] Feb 18, 2021
26e3429
Rename apiEndpoint for samples (#82)
lucaswadedavis Feb 22, 2021
3bc8a08
chore: release 1.6.0 (#87)
release-please[bot] Mar 15, 2021
e414fb5
Fix typo in path (#112)
lucaswadedavis Apr 21, 2021
feaac09
samples: adds batch prediction samples for text (#119)
telpirion May 7, 2021
631d2ea
chore: new owl bot post processor docker image (#121)
gcf-owl-bot[bot] May 10, 2021
d5d8366
chore: release 1.7.0 (#125)
release-please[bot] May 11, 2021
f89ca59
samples: adds missing Node.js samples (#128)
telpirion May 20, 2021
4c75bec
chore: release 1.7.1 (#144)
release-please[bot] Jun 3, 2021
f85f8e2
test: deploy mode test failure (#145)
telpirion Jun 4, 2021
bde81ef
chore: release 1.7.2 (#153)
release-please[bot] Jun 22, 2021
0efbbea
chore: release 1.7.3 (#159)
release-please[bot] Jun 29, 2021
1092d8f
chore: release 1.7.4 (#165)
release-please[bot] Jul 12, 2021
02e5a65
chore: release 1.8.0 (#169)
release-please[bot] Jul 14, 2021
47c61d4
chore: release 1.9.0 (#171)
release-please[bot] Jul 15, 2021
4714ba5
chore: release 1.9.1 (#173)
release-please[bot] Jul 21, 2021
d0d9c04
chore: release 1.10.0 (#179)
release-please[bot] Jul 27, 2021
a900d8c
chore: release 1.10.1 (#185)
release-please[bot] Aug 10, 2021
3b0b78c
feat: add prediction service RPC RawPredict to aiplatform_v1beta1 fea…
gcf-owl-bot[bot] Sep 15, 2021
f34262b
chore: release 1.11.0 (#194)
release-please[bot] Sep 27, 2021
f0951c6
samples: remove unnecessary back-ticks from samples (#209)
orionnye Oct 21, 2021
ef40b25
test: added back BQ tabular dataset sample test (#215)
kweinmeister Oct 21, 2021
9b8f0ab
chore: release 1.12.0 (#208)
release-please[bot] Nov 8, 2021
e67f2c6
chore: release 1.13.0 (#230)
release-please[bot] Nov 11, 2021
4310826
docs: Added eval_id comments to node.js samples (#236)
nayaknishant Dec 2, 2021
9033f27
chore: add '_sample' suffix to samples (#242)
aribray Dec 9, 2021
9e28e7d
chore: release 1.14.0 (#235)
release-please[bot] Dec 13, 2021
d2fcdfd
fix: remove duplicate sample (#243)
aribray Dec 14, 2021
6bfcbc8
chore(main): release 1.15.0 (#263)
release-please[bot] Feb 8, 2022
aa4bbf8
chore(main): release 1.16.0 (#270)
release-please[bot] Feb 23, 2022
6ad2a93
chore(main): release 1.17.0 (#276)
release-please[bot] Mar 15, 2022
4276871
chore(main): release 1.18.0 (#279)
release-please[bot] Mar 23, 2022
f37ce35
chore(main): release 1.19.0 (#281)
release-please[bot] Mar 24, 2022
e12bdb3
fix: added retries to flaky test (#299)
nayaknishant May 10, 2022
3012345
build!: update library to use Node 12 (#304)
alexander-fenster May 17, 2022
28c3182
feat(samples): add create-featurestore samples (#317)
suryaguthikonda Jun 23, 2022
b3649d0
chore(main): release 2.0.0 (#305)
release-please[bot] Jun 30, 2022
40d1ac9
chore(main): release 2.1.0 (#345)
release-please[bot] Jul 4, 2022
1cab5c0
feat(samples): add remaining featurestore api samples (#338)
suryaguthikonda Aug 2, 2022
2a5baca
feat(samples): add entity type apis samples (#339)
suryaguthikonda Aug 3, 2022
e23b2ff
feat(samples): add feature apis samples (#340)
suryaguthikonda Aug 3, 2022
bf6b6d8
feat(samples): add feature values apis samples (#341)
suryaguthikonda Aug 4, 2022
3028c74
chore(main): release 2.2.0 (#348)
release-please[bot] Sep 7, 2022
de833b9
chore(deps): update dependency uuid to v9 (#367)
renovate-bot Sep 9, 2022
c63b65e
chore(main): release 2.3.0 (#369)
release-please[bot] Sep 26, 2022
e579e69
Merge remote-tracking branch 'migration/main' into nodejs-ai-platform…
pattishin Nov 18, 2022
59c7512
chore: adding ai-platform/snippets to workflow.json
pattishin Nov 18, 2022
c313d20
Merge branch 'main' into nodejs-ai-platform-migration
pattishin Nov 18, 2022
104dfe6
Merge branch 'main' into nodejs-ai-platform-migration
pattishin Nov 19, 2022
007ec07
Merge branch 'main' into nodejs-ai-platform-migration
pattishin Nov 21, 2022
03143d7
test: moving kokoro configs from original nodejs-ai-platform
pattishin Nov 21, 2022
cf8358a
test: updating kokoro configs and migrating populate-secrets scripts …
pattishin Nov 21, 2022
09a99d3
Merge branch 'main' into nodejs-ai-platform-migration
pattishin Nov 21, 2022
f073dce
test: adding .trampolinerc
pattishin Nov 21, 2022
20041b0
test: adding in missing secret ref for ai-platform snippet test
pattishin Nov 21, 2022
b46005b
test: adding in location secret ref for ai-platform snippet test & cl…
pattishin Nov 22, 2022
0f55512
chore: clean up
pattishin Nov 22, 2022
2b28da0
Merge branch 'main' into nodejs-ai-platform-migration
pattishin Nov 22, 2022
bb6544b
Merge branch 'main' into nodejs-ai-platform-migration
telpirion Nov 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/ai-platform-snippets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: ai-platform-snippets
on:
push:
branches:
- main
paths:
- "ai-platform/snippets/**"
pull_request:
paths:
- "ai-platform/snippets/**"
pull_request_target:
types: [labeled]
paths:
- "ai-platform/snippets/**"
schedule:
- cron: "0 0 * * 0"
jobs:
test:
if: ${{ github.event.action != 'labeled' || github.event.label.name == 'actions:force-run' }}
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: "write"
pull-requests: "write"
id-token: "write"
steps:
- uses: actions/[email protected]
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: "google-github-actions/[email protected]"
with:
workload_identity_provider: "projects/1046198160504/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
service_account: "[email protected]"
create_credentials_file: "true"
access_token_lifetime: 600s
- id: secrets
uses: "google-github-actions/get-secretmanager-secrets@v0"
with:
secrets: |-
caip_id:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-caip-project-id
location:nodejs-docs-samples-tests/nodejs-docs-samples-ai-platform-location
- uses: actions/[email protected]
with:
node-version: 16
- run: npm install
working-directory: ai-platform/snippets
- run: npm test
working-directory: ai-platform/snippets
env:
LOCATION: ${{ steps.secrets.outputs.location }}
CAIP_PROJECT_ID: ${{ steps.secrets.outputs.caip_id }}
MOCHA_REPORTER_SUITENAME: ai_platform_snippets
MOCHA_REPORTER_OUTPUT: ai_platform_snippets_sponge_log.xml
MOCHA_REPORTER: xunit
- if: ${{ github.event.action == 'labeled' && github.event.label.name == 'actions:force-run' }}
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
await github.rest.issues.removeLabel({
name: 'actions:force-run',
owner: 'GoogleCloudPlatform',
repo: 'nodejs-docs-samples',
issue_number: context.payload.pull_request.number
});
} catch (e) {
if (!e.message.includes('Label does not exist')) {
throw e;
}
}
- if: ${{ github.event_name == 'schedule'}}
run: |
curl https://github.com/googleapis/repo-automation-bots/releases/download/flakybot-1.1.0/flakybot -o flakybot -s -L
chmod +x ./flakybot
./flakybot --repo GoogleCloudPlatform/nodejs-docs-samples --commit_hash ${{github.sha}} --build_url https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
1 change: 1 addition & 0 deletions .github/workflows/workflows.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"ai-platform/snippets",
"appengine/analytics",
"appengine/building-an-app/build",
"appengine/building-an-app/update",
Expand Down
124 changes: 124 additions & 0 deletions ai-platform/snippets/batch-create-features-sample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Creates a batch of Features in a given EntityType.
* See https://cloud.google.com/vertex-ai/docs/featurestore/setup before running
* the code snippet
*/

'use strict';

async function main(
project,
featurestoreId,
entityTypeId,
location = 'us-central1',
apiEndpoint = 'us-central1-aiplatform.googleapis.com',
timeout = 300000
) {
// [START aiplatform_batch_create_features_sample]
/**
* TODO(developer): Uncomment these variables before running the sample.\
* (Not necessary if passing values as arguments)
*/

// const project = 'YOUR_PROJECT_ID';
// const featurestoreId = 'YOUR_FEATURESTORE_ID';
// const entityTypeId = 'YOUR_ENTITY_TYPE_ID';
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} = require('@google-cloud/aiplatform').v1;

// Specifies the location of the api endpoint
const clientOptions = {
apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
clientOptions
);

async function batchCreateFeatures() {
// Configure the parent resource
const parent = `projects/${project}/locations/${location}/featurestores/${featurestoreId}/entityTypes/${entityTypeId}`;

const ageFeature = {
valueType: 'INT64',
description: 'User age',
};

const ageFeatureRequest = {
feature: ageFeature,
featureId: 'age',
};

const genderFeature = {
valueType: 'STRING',
description: 'User gender',
};

const genderFeatureRequest = {
feature: genderFeature,
featureId: 'gender',
};

const likedGenresFeature = {
valueType: 'STRING_ARRAY',
description: 'An array of genres that this user liked',
};

const likedGenresFeatureRequest = {
feature: likedGenresFeature,
featureId: 'liked_genres',
};

const requests = [
ageFeatureRequest,
genderFeatureRequest,
likedGenresFeatureRequest,
];

const request = {
parent: parent,
requests: requests,
};

// Batch Create Features request
const [operation] = await featurestoreServiceClient.batchCreateFeatures(
request,
{timeout: Number(timeout)}
);
const [response] = await operation.promise();

console.log('Batch create features response');
console.log('Raw response:');
console.log(JSON.stringify(response, null, 2));
}
batchCreateFeatures();
// [END aiplatform_batch_create_features_sample]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});

main(...process.argv.slice(2));
136 changes: 136 additions & 0 deletions ai-platform/snippets/batch-read-feature-values-sample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*
* Batch reads Feature values from a Featurestore.
* See https://cloud.google.com/vertex-ai/docs/featurestore/setup before running
* the code snippet
*/

'use strict';

async function main(
project,
featurestoreId,
inputCsvFile,
destinationTableUri,
location = 'us-central1',
apiEndpoint = 'us-central1-aiplatform.googleapis.com',
timeout = 300000
) {
// [START aiplatform_batch_read_feature_values_sample]
/**
* TODO(developer): Uncomment these variables before running the sample.\
* (Not necessary if passing values as arguments)
*/

// const project = 'YOUR_PROJECT_ID';
// const featurestoreId = 'YOUR_FEATURESTORE_ID';
// const inputCsvFile = 'YOUR_INPUT_CSV_FILE_URI';
// const destinationTableUri = 'YOUR_BQ_DESTINATION_TABLE_URI';
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} = require('@google-cloud/aiplatform').v1;

// Specifies the location of the api endpoint
const clientOptions = {
apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
clientOptions
);

async function batchReadFeatureValues() {
// Configure the featurestoreId resource
const featurestore = `projects/${project}/locations/${location}/featurestores/${featurestoreId}`;
const csvReadInstances = {
gcsSource: {
uris: [inputCsvFile],
},
};

const destination = {
bigqueryDestination: {
// # Output to BigQuery table created earlier
outputUri: destinationTableUri,
},
};

const usersFeatureSelector = {
idMatcher: {
ids: [
// features, use "*" if you want to select all features within this entity type
'age',
'gender',
'liked_genres',
],
},
};

const usersEntityTypeSpec = {
// Read the 'age', 'gender' and 'liked_genres' features from the 'perm_users' entity
entityTypeId: 'perm_users',
featureSelector: usersFeatureSelector,
};

const moviesFeatureSelector = {
idMatcher: {
ids: ['*'],
},
};

const moviesEntityTypeSpec = {
// Read the all features from the 'perm_movies' entity
entityTypeId: 'perm_movies',
featureSelector: moviesFeatureSelector,
};

const entityTypeSpecs = [usersEntityTypeSpec, moviesEntityTypeSpec];

// Construct request
const request = {
featurestore: featurestore,
csvReadInstances: csvReadInstances,
destination: destination,
entityTypeSpecs: entityTypeSpecs,
};

// Batch Read Feature Values Request
const [operation] = await featurestoreServiceClient.batchReadFeatureValues(
request,
{timeout: Number(timeout)}
);
const [response] = await operation.promise();

console.log('Batch read feature values response');
console.log('Raw response:');
console.log(JSON.stringify(response, null, 2));
}
batchReadFeatureValues();
// [END aiplatform_batch_read_feature_values_sample]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});

main(...process.argv.slice(2));
Loading