Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/config/nodejs-dev.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
"functions/v2/tips/retry",
"functions/v2/typed/googlechatbot",
"functions/v2/typed/greeting",
"genai", // parent directory
"generative-ai/snippets",
"healthcare/consent",
"healthcare/datasets",
Expand Down
1 change: 1 addition & 0 deletions .github/config/nodejs.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"functions/http/uploadFile", // no tests exist
"functions/log", // parent directory
"functions/pubsub", // parent directory
"genai", // parent directory
"memorystore/redis", // parent directory
"recaptcha_enterprise/demosite/app", // no tests exist

Expand Down
22 changes: 22 additions & 0 deletions genai/bounding-box/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "nodejs-genai-bounding-box",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"test": "c8 mocha -p -j 2 --timeout 2400000 test/*.test.js"
},
"dependencies": {
"@google/genai": "1.30.0",
"canvas": "^3.2.0",
"node-fetch": "^2.7.0"
},
"devDependencies": {
"c8": "^10.0.0",
"chai": "^4.5.0",
"mocha": "^10.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../bounding-box/boundingbox-with-txt-img');
const sample = require('../boundingbox-with-txt-img');

describe('boundingbox-with-txt-img', async () => {
it('should return the bounding box', async function () {
Expand Down
21 changes: 21 additions & 0 deletions genai/content-cache/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "nodejs-genai-content-cache",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"test": "c8 mocha -p -j 2 --timeout 2400000 test/*.test.js"
},
"dependencies": {
"@google/genai": "1.30.0",
"luxon": "^3.7.1"
},
"devDependencies": {
"c8": "^10.0.0",
"chai": "^4.5.0",
"mocha": "^10.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;

const createSample = require('../content-cache/content-cache-create-with-txt-gcs-pdf.js');
const useSample = require('../content-cache/content-cache-use-with-txt.js');
const updateSample = require('../content-cache/content-cache-update.js');
const deleteSample = require('../content-cache/content-cache-delete.js');
const {delay} = require('./util');
const createSample = require('../content-cache-create-with-txt-gcs-pdf.js');
const useSample = require('../content-cache-use-with-txt.js');
const updateSample = require('../content-cache-update.js');
const deleteSample = require('../content-cache-delete.js');
const {delay} = require('../../test/util');

describe('content-cache-create-use-update-delete', async function () {
this.timeout(600000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../content-cache/content-cache-list.js');
const sample = require('../content-cache-list.js');

describe('contentcache-list', async () => {
it('should return object with names of catches', async () => {
Expand Down
20 changes: 20 additions & 0 deletions genai/controlled-generation/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "nodejs-genai-controlled-generation",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"test": "c8 mocha -p -j 2 --timeout 2400000 test/*.test.js"
},
"dependencies": {
"@google/genai": "1.30.0"
},
"devDependencies": {
"c8": "^10.0.0",
"chai": "^4.5.0",
"mocha": "^10.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../controlled-generation/ctrlgen-with-class-schema.js');
const sample = require('../ctrlgen-with-class-schema.js');

describe('ctrlgen-with-class-schema', () => {
it('should generate text content in Json', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../controlled-generation/ctrlgen-with-enum-class-schema.js');
const {delay} = require('./util');
const sample = require('../ctrlgen-with-enum-class-schema.js');
const {delay} = require('../../test/util');

describe('ctrlgen-with-enum-class-schema', () => {
it('should generate text content matching enum schema', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../controlled-generation/ctrlgen-with-enum-schema.js');
const {delay} = require('./util');
const sample = require('../ctrlgen-with-enum-schema.js');
const {delay} = require('../../test/util');

describe('ctrlgen-with-enum-schema', async () => {
it('should generate text content in Json', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../controlled-generation/ctrlgen-with-nested-class-schema.js');
const {delay} = require('./util');
const sample = require('../ctrlgen-with-nested-class-schema.js');
const {delay} = require('../../test/util');

describe('ctrlgen-with-nested-class-schema', () => {
it('should generate text content using nested schema', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../controlled-generation/ctrlgen-with-nullable-schema.js');
const sample = require('../ctrlgen-with-nullable-schema.js');

describe('ctrlgen-with-nullable-schema', () => {
it('should generate text content using nullable schema', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../controlled-generation/ctrlgen-with-resp-schema.js');
const sample = require('../ctrlgen-with-resp-schema.js');

describe('ctrlgen-with-resp-schema', () => {
it('should generate text content in given schema', async function () {
Expand Down
20 changes: 20 additions & 0 deletions genai/count-tokens/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "nodejs-genai-count-tokens",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"test": "c8 mocha -p -j 2 --timeout 2400000 test/*.test.js"
},
"dependencies": {
"@google/genai": "1.30.0"
},
"devDependencies": {
"c8": "^10.0.0",
"chai": "^4.5.0",
"mocha": "^10.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../count-tokens/counttoken-compute-with-txt.js');
const {delay} = require('./util');
const sample = require('../counttoken-compute-with-txt.js');
const {delay} = require('../../test/util');

describe('counttoken-compute-with-txt', () => {
it('should return tokensInfo from text prompt', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../count-tokens/counttoken-localtokenizer-compute-with-txt.js');
const {delay} = require('./util');
const sample = require('../counttoken-localtokenizer-compute-with-txt.js');
const {delay} = require('../../test/util');

describe('counttoken-localtokenizer-compute-with-txt', () => {
it('should return tokensInfo from text prompt', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../count-tokens/counttoken-localtokenizer-with-txt.js');
const {delay} = require('./util');
const sample = require('../counttoken-localtokenizer-with-txt.js');
const {delay} = require('../../test/util');

describe('counttoken-localtokenizer-with-txt', () => {
it('should return totalTokens from text prompt', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../count-tokens/counttoken-resp-with-txt.js');
const sample = require('../counttoken-resp-with-txt.js');

describe('counttoken-resp-with-txt', () => {
it('should return the usageMetadata from text prompt', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../count-tokens/counttoken-with-txt-vid.js');
const {delay} = require('./util');
const sample = require('../counttoken-with-txt-vid.js');
const {delay} = require('../../test/util');

describe('counttoken-with-txt-vid', async () => {
it('should return the total token count for a text and video prompt', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../count-tokens/counttoken-with-txt.js');
const sample = require('../counttoken-with-txt.js');

describe('counttoken-with-txt', async () => {
it('should return the total token count for a text prompt', async function () {
Expand Down
20 changes: 20 additions & 0 deletions genai/image-generation/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "nodejs-genai-image-generation",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"test": "c8 mocha -p -j 2 --timeout 2400000 test/*.test.js"
},
"dependencies": {
"@google/genai": "1.30.0"
},
"devDependencies": {
"c8": "^10.0.0",
"chai": "^4.5.0",
"mocha": "^10.0.0"
}
}
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const location = 'global';
const sample = require('../image-generation/imggen-mmflash-edit-img-with-txt-img');
const {delay} = require('./util');
const sample = require('../imggen-mmflash-edit-img-with-txt-img');
const {delay} = require('../../test/util');

describe('imggen-mmflash-edit-img-with-txt-img', async () => {
it('should return a response object containing image parts', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const location = 'global';
const sample = require('../image-generation/imggen-mmflash-locale-aware-with-txt');
const {delay} = require('./util');
const sample = require('../imggen-mmflash-locale-aware-with-txt');
const {delay} = require('../../test/util');

describe('imggen-mmflash-locale-aware-with-txt', async () => {
it('should generate a response with text and image parts', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const {describe, it} = require('mocha');
const projectId = process.env.CAIP_PROJECT_ID;
const location = 'global';

const sample = require('../image-generation/imggen-mmflash-multiple-imgs-with-txt');
const {delay} = require('./util');
const sample = require('../imggen-mmflash-multiple-imgs-with-txt');
const {delay} = require('../../test/util');

describe('imggen-mmflash-multiple-imgs-with-txt', async () => {
it('should return a response object containing image parts', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const location = 'global';
const sample = require('../image-generation/imggen-mmflash-txt-and-img-with-txt');
const {delay} = require('./util');
const sample = require('../imggen-mmflash-txt-and-img-with-txt');
const {delay} = require('../../test/util');

describe('imggen-mmflash-txt-and-img-with-txt', async () => {
it('should generate a response with text and image parts', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const {describe, it} = require('mocha');
const projectId = process.env.CAIP_PROJECT_ID;
const location = 'global';

const sample = require('../image-generation/imggen-mmflash-with-txt.js');
const {delay} = require('./util');
const sample = require('../imggen-mmflash-with-txt.js');
const {delay} = require('../../test/util');

describe('imggen-mmflash-with-txt', async () => {
it('should generate images from a text prompt', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;

const sample = require('../image-generation/imggen_virtual-try-on-with-txt-img');
const {delay} = require('./util');
const sample = require('../imggen_virtual-try-on-with-txt-img');
const {delay} = require('../../test/util');

describe('imggen_virtual-try-on-with-txt-img', async () => {
it('should return a response object containing image parts', async function () {
Expand Down
25 changes: 25 additions & 0 deletions genai/live/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "nodejs-genai-live",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"engines": {
"node": ">=16.0.0"
},
"scripts": {
"test": "c8 mocha -p -j 2 --timeout 2400000 test/*.test.js"
},
"dependencies": {
"@google/genai": "1.30.0",
"google-auth-library": "^10.3.0",
"node-fetch": "^2.7.0",
"openai": "^5.19.1"
},
"devDependencies": {
"c8": "^10.0.0",
"chai": "^4.5.0",
"mocha": "^10.0.0",
"proxyquire": "^2.1.3",
"sinon": "^18.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../live/live-audio-with-txt');
const sample = require('../live-audio-with-txt');

describe('live-audio-with-txt', () => {
it('should generate audio content in a live session conversation from a text prompt', async function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {assert} = require('chai');
const {describe, it} = require('mocha');

const projectId = process.env.CAIP_PROJECT_ID;
const sample = require('../live/live-code-exec-with-txt');
const sample = require('../live-code-exec-with-txt');

describe('live-code-exec-with-txt', () => {
it('should generate code execution in a live session from a text prompt', async function () {
Expand Down
Loading
Loading