Skip to content

Commit 998f5a5

Browse files
Linting checks
1 parent 163729d commit 998f5a5

25 files changed

+550
-512
lines changed

model-armor/snippets/createTemplate.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/**
1818
* Creates a Model Armor template with Responsible AI (RAI) filters.
19-
*
19+
*
2020
* This function creates a template that can be used for sanitizing user prompts and model responses.
2121
*
2222
* @param {string} projectId - Google Cloud project ID where the template will be created.
@@ -51,12 +51,18 @@ async function main(projectId, locationId, templateId) {
5151
raiSettings: {
5252
raiFilters: [
5353
{
54-
filterType: protos.google.cloud.modelarmor.v1.RaiFilterType.HATE_SPEECH,
55-
confidenceLevel: protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel.HIGH,
54+
filterType:
55+
protos.google.cloud.modelarmor.v1.RaiFilterType.HATE_SPEECH,
56+
confidenceLevel:
57+
protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel.HIGH,
5658
},
5759
{
58-
filterType: protos.google.cloud.modelarmor.v1.RaiFilterType.SEXUALLY_EXPLICIT,
59-
confidenceLevel: protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel.MEDIUM_AND_ABOVE,
60+
filterType:
61+
protos.google.cloud.modelarmor.v1.RaiFilterType
62+
.SEXUALLY_EXPLICIT,
63+
confidenceLevel:
64+
protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel
65+
.MEDIUM_AND_ABOVE,
6066
},
6167
],
6268
},
@@ -80,4 +86,4 @@ async function main(projectId, locationId, templateId) {
8086
}
8187

8288
const args = process.argv.slice(2);
83-
main(...args).catch(console.error);
89+
main(...args).catch(console.error);

model-armor/snippets/createTemplateWithAdvancedSdp.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ async function main(
4848
const {protos} = modelarmor;
4949

5050
const RaiFilterType = protos.google.cloud.modelarmor.v1.RaiFilterType;
51-
const DetectionConfidenceLevel = protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel;
51+
const DetectionConfidenceLevel =
52+
protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel;
5253

5354
// Instantiates a client
5455
const client = new ModelArmorClient({
@@ -106,4 +107,4 @@ async function main(
106107

107108
// Check if this script is being run directly
108109
const args = process.argv.slice(2);
109-
main(...args).catch(console.error);
110+
main(...args).catch(console.error);

model-armor/snippets/createTemplateWithBasicSdp.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
* @param {string} locationId - Google Cloud location where the template will be created.
2222
* @param {string} templateId - ID for the template to create.
2323
*/
24-
async function main(
25-
projectId,
26-
locationId,
27-
templateId
28-
) {
24+
async function main(projectId, locationId, templateId) {
2925
// [START modelarmor_create_template_with_basic_sdp]
3026
/**
3127
* TODO(developer): Uncomment these variables before running the sample.
@@ -42,8 +38,10 @@ async function main(
4238
const {protos} = modelarmor;
4339

4440
const RaiFilterType = protos.google.cloud.modelarmor.v1.RaiFilterType;
45-
const DetectionConfidenceLevel = protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel;
46-
const SdpBasicConfigEnforcement = protos.google.cloud.modelarmor.v1.SdpBasicConfig.SdpBasicConfigEnforcement;
41+
const DetectionConfidenceLevel =
42+
protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel;
43+
const SdpBasicConfigEnforcement =
44+
protos.google.cloud.modelarmor.v1.SdpBasicConfig.SdpBasicConfigEnforcement;
4745

4846
// Instantiates a client
4947
const client = new ModelArmorClient({
@@ -98,4 +96,4 @@ async function main(
9896
}
9997

10098
const args = process.argv.slice(2);
101-
main(...args).catch(console.error);
99+
main(...args).catch(console.error);

model-armor/snippets/createTemplateWithLabels.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function main(projectId, locationId, templateId, labelKey, labelValue) {
3535
// const labelValue = 'production';
3636

3737
const parent = `projects/${projectId}/locations/${locationId}`;
38-
38+
3939
// Imports the Model Armor library
4040
const modelarmor = require('@google-cloud/modelarmor');
4141
const {ModelArmorClient} = modelarmor.v1;
@@ -45,7 +45,7 @@ async function main(projectId, locationId, templateId, labelKey, labelValue) {
4545
const client = new ModelArmorClient({
4646
apiEndpoint: `modelarmor.${locationId}.rep.googleapis.com`,
4747
});
48-
48+
4949
async function callCreateTemplateWithLabels() {
5050
// Construct the request with template configuration and labels
5151
const request = {
@@ -56,12 +56,19 @@ async function main(projectId, locationId, templateId, labelKey, labelValue) {
5656
raiSettings: {
5757
raiFilters: [
5858
{
59-
filterType: protos.google.cloud.modelarmor.v1.RaiFilterType.HATE_SPEECH,
60-
confidenceLevel: protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel.HIGH,
59+
filterType:
60+
protos.google.cloud.modelarmor.v1.RaiFilterType.HATE_SPEECH,
61+
confidenceLevel:
62+
protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel
63+
.HIGH,
6164
},
6265
{
63-
filterType: protos.google.cloud.modelarmor.v1.RaiFilterType.SEXUALLY_EXPLICIT,
64-
confidenceLevel: protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel.MEDIUM_AND_ABOVE,
66+
filterType:
67+
protos.google.cloud.modelarmor.v1.RaiFilterType
68+
.SEXUALLY_EXPLICIT,
69+
confidenceLevel:
70+
protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel
71+
.MEDIUM_AND_ABOVE,
6572
},
6673
],
6774
},
@@ -82,4 +89,4 @@ async function main(projectId, locationId, templateId, labelKey, labelValue) {
8289
}
8390

8491
const args = process.argv.slice(2);
85-
main(...args).catch(console.error);
92+
main(...args).catch(console.error);

model-armor/snippets/createTemplateWithMetadata.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
* @param {string} locationId - Google Cloud location where the template will be created.
2222
* @param {string} templateId - ID for the template to create.
2323
*/
24-
async function main(
25-
projectId,
26-
locationId,
27-
templateId
28-
) {
24+
async function main(projectId, locationId, templateId) {
2925
// [START modelarmor_create_template_with_metadata]
3026
/**
3127
* TODO(developer): Uncomment these variables before running the sample.
@@ -42,7 +38,8 @@ async function main(
4238
const {protos} = modelarmor;
4339

4440
const RaiFilterType = protos.google.cloud.modelarmor.v1.RaiFilterType;
45-
const DetectionConfidenceLevel = protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel;
41+
const DetectionConfidenceLevel =
42+
protos.google.cloud.modelarmor.v1.DetectionConfidenceLevel;
4643

4744
// Instantiates a client
4845
const client = new ModelArmorClient({
@@ -89,4 +86,4 @@ async function main(
8986
}
9087

9188
const args = process.argv.slice(2);
92-
main(...args).catch(console.error);
89+
main(...args).catch(console.error);

model-armor/snippets/deleteTemplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ async function main(projectId, locationId, templateId) {
5454
}
5555

5656
const args = process.argv.slice(2);
57-
main(...args).catch(console.error);
57+
main(...args).catch(console.error);

model-armor/snippets/getFolderFloorSettings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/**
1818
* Retrieves the floor settings for a Google Cloud folder.
19-
*
19+
*
2020
* @param {string} folderId - The ID of the Google Cloud folder for which to retrieve floor settings.
2121
*/
2222
async function main(folderId) {
@@ -49,4 +49,4 @@ async function main(folderId) {
4949
}
5050

5151
const args = process.argv.slice(2);
52-
main(...args).catch(console.error);
52+
main(...args).catch(console.error);

model-armor/snippets/getOrganizationFloorSettings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
/**
1818
* Retrieves the floor settings for a Google Cloud organization.
19-
*
20-
* @param {string} organizationId - The ID of the Google Cloud organization for which to retrieve
19+
*
20+
* @param {string} organizationId - The ID of the Google Cloud organization for which to retrieve
2121
* floor settings.
2222
*/
2323
async function main(organizationId) {
@@ -51,4 +51,4 @@ async function main(organizationId) {
5151
}
5252

5353
const args = process.argv.slice(2);
54-
main(...args).catch(console.error);
54+
main(...args).catch(console.error);

model-armor/snippets/getProjectFloorSettings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Retrieves the floor settings for a Google Cloud project.
1919
*
20-
* @param {string} projectId - The ID of the Google Cloud project for which to retrieve
20+
* @param {string} projectId - The ID of the Google Cloud project for which to retrieve
2121
* floor settings.
2222
*/
2323
async function main(projectId) {

model-armor/snippets/getTemplate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/**
1818
* Retrieves a Model Armor template by its ID.
19-
*
19+
*
2020
* @param {string} projectId - Google Cloud project ID where the template exists.
2121
* @param {string} locationId - Google Cloud location (region) of the template.
2222
* @param {string} templateId - Identifier of the template to retrieve.
@@ -58,4 +58,4 @@ async function main(projectId, locationId, templateId) {
5858
}
5959

6060
const args = process.argv.slice(2);
61-
main(...args).catch(console.error);
61+
main(...args).catch(console.error);

0 commit comments

Comments
 (0)