Skip to content

Commit 8a37e54

Browse files
author
Guiners
committed
fixing failed tests
1 parent d565c52 commit 8a37e54

File tree

9 files changed

+33
-204
lines changed

9 files changed

+33
-204
lines changed

genai/bounding-box/boundingbox-with-txt-img.js

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

genai/output-folder/image.png

-107 KB
Loading

genai/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@
1515
"dependencies": {
1616
"@google/genai": "^0.13.0",
1717
"axios": "^1.6.2",
18-
"supertest": "^7.0.0",
1918
"canvas": "^3.1.0",
20-
"node-fetch": "^2.7.0"
19+
"google-auth-library": "^10.5.0",
20+
"luxon": "^3.7.2",
21+
"node-fetch": "^2.7.0",
22+
"openai": "^6.9.1",
23+
"supertest": "^7.0.0"
2124
},
2225
"devDependencies": {
2326
"c8": "^10.0.0",
2427
"chai": "^4.5.0",
2528
"mocha": "^10.0.0",
29+
"proxyquire": "^2.1.3",
2630
"sinon": "^18.0.0",
27-
"uuid": "^10.0.0",
28-
"proxyquire": "^2.1.3"
31+
"uuid": "^10.0.0"
2932
}
3033
}

genai/safety/safety-with-txt.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ async function generateWithSafetySettings(
6363
},
6464
});
6565

66-
console.log(response.text);
67-
console.log(response.candidates[0].finishMessage);
68-
69-
for (const each of response.candidates[0].safetyRatings) {
70-
console.log('\nCategory:', String(each.category));
71-
console.log('Is Blocked:', each.blocked);
72-
console.log('Probability:', each.probability);
73-
console.log('Probability Score:', each.probabilityScore);
74-
console.log('Severity:', each.severity);
75-
console.log('Severity Score:', each.severityScore);
76-
}
66+
// console.log(response.text);
67+
// console.log(response.candidates[0].finishMessage);
68+
//
69+
// for (const each of response.candidates[0].safetyRatings) {
70+
// console.log('\nCategory:', String(each.category));
71+
// console.log('Is Blocked:', each.blocked);
72+
// console.log('Probability:', each.probability);
73+
// console.log('Probability Score:', each.probabilityScore);
74+
// console.log('Severity:', each.severity);
75+
// console.log('Severity Score:', each.severityScore);
76+
// }
7777

7878
// Example response:
7979
//

genai/test/api-key-example.test.js

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

1717
const {assert} = require('chai');
1818
const {describe, it} = require('mocha');
19+
const {delay} = require('./util');
1920
const proxyquire = require('proxyquire').noCallThru();
2021

2122
describe('vertexai-express-mode', () => {
2223
it('should call generateContentStream and return the mocked response', async function () {
2324
this.timeout(10000);
2425

26+
this.retries(4);
27+
await delay(this.test);
28+
2529
const mockGenerateContentStreamResult = {
2630
text: 'Bubble sort works by repeatedly swapping adjacent elements until sorted.',
2731
};

genai/test/boundingbox-with-txt-img.test.js

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

genai/test/embeddings-docretrieval-with-txt.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ const {describe, it} = require('mocha');
1919

2020
const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../embeddings/embeddings-docretrieval-with-txt.js');
22+
const {delay} = require('./util');
2223

2324
describe('embeddings-docretrieval-with-txt', async () => {
2425
it('should return an object containing embeddings and metadata', async () => {
26+
this.retries(4);
27+
await delay(this.test);
2528
const generatedFileNames =
2629
await sample.generateEmbeddingsForRetrieval(projectId);
2730
assert.containsAllKeys(generatedFileNames, ['embeddings', 'metadata']);

genai/test/provisionedthroughput-with-txt.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ const {describe, it} = require('mocha');
1919

2020
const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../provisioned-throughput/provisionedthroughput-with-txt.js');
22+
const {delay} = require('./util');
2223

2324
describe('provisionedthroughput-with-txt', () => {
2425
it('should return provisioned throughput result', async function () {
2526
this.timeout(50000);
27+
this.retries(4);
28+
await delay(this.test);
2629
const output = await sample.generateWithProvisionedThroughput(projectId);
2730
assert(output.length > 0);
2831
});

genai/test/safety-with-txt.test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ const {describe, it} = require('mocha');
1919

2020
const projectId = process.env.CAIP_PROJECT_ID;
2121
const sample = require('../safety/safety-with-txt.js');
22+
const {delay} = require('./util');
2223

2324
describe('safety-with-txt', () => {
2425
it('should call generateContentStream with safety instructions', async function () {
2526
this.timeout(50000);
27+
this.retries(4);
28+
await delay(this.test);
2629
const output = await sample.generateWithSafetySettings(projectId);
27-
assert(output > 0);
30+
console.log('output', output);
31+
assert.isObject(output);
2832
});
2933
});

0 commit comments

Comments
 (0)