File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ import {
58
58
onValue ,
59
59
off
60
60
} from 'firebase/database' ;
61
- import { getGenerativeModel , getVertexAI , VertexAI } from 'firebase/vertexai' ;
61
+ import { getGenerativeModel , getVertexAI , InferenceMode , VertexAI } from 'firebase/vertexai' ;
62
62
import { getDataConnect , DataConnect } from 'firebase/data-connect' ;
63
63
64
64
/**
@@ -332,6 +332,15 @@ function callDataConnect(app) {
332
332
console . log ( '[DATACONNECT] initialized' ) ;
333
333
}
334
334
335
+ async function callVertex ( app ) {
336
+ console . log ( '[VERTEX] start' ) ;
337
+ const vertex = getVertexAI ( app )
338
+ const model = getGenerativeModel ( vertex , { mode : InferenceMode . PREFER_ON_DEVICE } )
339
+ const result = await model . generateContent ( "What is Roko's Basalisk?" )
340
+ console . log ( result . response . text ( ) )
341
+ console . log ( '[VERTEX] initialized' ) ;
342
+ }
343
+
335
344
/**
336
345
* Run smoke tests for all products.
337
346
* Comment out any products you want to ignore.
@@ -353,6 +362,7 @@ async function main() {
353
362
await callVertexAI ( app ) ;
354
363
callDataConnect ( app ) ;
355
364
await authLogout ( app ) ;
365
+ await callVertex ( app ) ;
356
366
console . log ( 'DONE' ) ;
357
367
}
358
368
You can’t perform that action at this time.
0 commit comments