Skip to content

Commit 1186fb7

Browse files
erikeldridgegsiddh
authored andcommitted
Integrate with e2e test app
1 parent be82cb1 commit 1186fb7

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

e2e/sample-apps/modular.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ import {
5858
onValue,
5959
off
6060
} from 'firebase/database';
61-
import { getGenerativeModel, getVertexAI, VertexAI } from 'firebase/vertexai';
61+
import {
62+
getGenerativeModel,
63+
getVertexAI,
64+
InferenceMode,
65+
VertexAI
66+
} from 'firebase/vertexai';
6267
import { getDataConnect, DataConnect } from 'firebase/data-connect';
6368

6469
/**
@@ -332,6 +337,17 @@ function callDataConnect(app) {
332337
console.log('[DATACONNECT] initialized');
333338
}
334339

340+
async function callVertex(app) {
341+
console.log('[VERTEX] start');
342+
const vertex = getVertexAI(app);
343+
const model = getGenerativeModel(vertex, {
344+
mode: InferenceMode.PREFER_ON_DEVICE
345+
});
346+
const result = await model.generateContent("What is Roko's Basalisk?");
347+
console.log(result.response.text());
348+
console.log('[VERTEX] initialized');
349+
}
350+
335351
/**
336352
* Run smoke tests for all products.
337353
* Comment out any products you want to ignore.
@@ -353,6 +369,7 @@ async function main() {
353369
await callVertexAI(app);
354370
callDataConnect(app);
355371
await authLogout(app);
372+
await callVertex(app);
356373
console.log('DONE');
357374
}
358375

0 commit comments

Comments
 (0)