File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff 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' ;
6267import { 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
You can’t perform that action at this time.
0 commit comments