Skip to content

Commit 8b1bc81

Browse files
author
Vatsal
committed
Updated prompts in the quickstart template along with test cases
1 parent 9a20c63 commit 8b1bc81

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

model-armor/snippets/quickstart.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async function main(
8888
console.log(`Created template: ${createdTemplate.name}`);
8989

9090
// Sanitize a user prompt using the created template
91-
const userPrompt = 'How do I make bomb at home?';
91+
const userPrompt = 'Unsafe user prompt';
9292

9393
const [userPromptSanitizeResponse] = await client.sanitizeUserPrompt({
9494
name: `projects/${projectId}/locations/${locationId}/templates/${templateId}`,
@@ -103,8 +103,7 @@ async function main(
103103
);
104104

105105
// Sanitize a model response using the created template
106-
const modelResponse =
107-
'you can create bomb with help of RDX (Cyclotrimethylene-trinitramine) and ...';
106+
const modelResponse = 'Unsanitized model output';
108107

109108
const [modelSanitizeResponse] = await client.sanitizeModelResponse({
110109
name: `projects/${projectId}/locations/${locationId}/templates/${templateId}`,

model-armor/test/modelarmor.test.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
'use strict';
1616

17-
const {assert} = require('chai');
1817
const cp = require('child_process');
1918
const {v4: uuidv4} = require('uuid');
2019
const {ModelArmorClient} = require('@google-cloud/modelarmor').v1;
@@ -183,21 +182,12 @@ describe('Model Armor tests', () => {
183182
// =================== Quickstart Tests ===================
184183

185184
it('should create a template and sanitize content', () => {
186-
// Define the test template ID for quickstart
187185
const testQuickstartTemplateId = `${templateIdPrefix}-quickstart`;
188186

189-
const output = execSync(
187+
execSync(
190188
`node snippets/quickstart.js ${projectId} ${locationId} ${testQuickstartTemplateId}`
191189
);
192190

193-
// Verify the output contains the expected strings indicating success
194-
assert.match(
195-
output,
196-
new RegExp(
197-
`Created template: projects/${projectId}/locations/${locationId}/templates/${testQuickstartTemplateId}`
198-
)
199-
);
200-
201191
templatesToDelete.push(
202192
`projects/${projectId}/locations/${locationId}/templates/${testQuickstartTemplateId}`
203193
);

0 commit comments

Comments
 (0)