File tree 4 files changed +1128
-1078
lines changed
4 files changed +1128
-1078
lines changed Original file line number Diff line number Diff line change 17
17
"author" : " " ,
18
18
"license" : " ISC" ,
19
19
"dependencies" : {
20
- "firebase" : " 11.3.0 "
20
+ "firebase" : " ^ 11.8.0-20250512211235 "
21
21
},
22
22
"devDependencies" : {
23
23
"@babel/core" : " 7.26.8" ,
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 , getAI } from 'firebase/ai' ;
61
+ import { getGenerativeModel , getAI , VertexAIBackend } from 'firebase/ai' ;
62
62
import { getDataConnect , DataConnect } from 'firebase/data-connect' ;
63
63
64
64
/**
@@ -312,7 +312,7 @@ function callPerformance(app) {
312
312
*/
313
313
async function callAI ( app ) {
314
314
console . log ( '[AI] start' ) ;
315
- const ai = getAI ( app ) ;
315
+ const ai = getAI ( app , { backend : new VertexAIBackend ( ) } ) ;
316
316
const model = getGenerativeModel ( ai , { model : 'gemini-1.5-flash' } ) ;
317
317
const result = await model . countTokens ( 'abcdefg' ) ;
318
318
console . log ( `[AI] counted tokens: ${ result . totalTokens } ` ) ;
Original file line number Diff line number Diff line change @@ -86,7 +86,12 @@ import {
86
86
StorageReference ,
87
87
deleteObject
88
88
} from 'firebase/storage' ;
89
- import { getGenerativeModel , getAI , AI } from 'firebase/vertexai' ;
89
+ import {
90
+ getGenerativeModel ,
91
+ getAI ,
92
+ AI ,
93
+ VertexAIBackend
94
+ } from 'firebase/vertexai' ;
90
95
import { getDataConnect , DataConnect } from 'firebase/data-connect' ;
91
96
import { config , testAccount } from '../firebase-config' ;
92
97
import 'jest' ;
@@ -307,10 +312,10 @@ describe('MODULAR', () => {
307
312
} ) ;
308
313
} ) ;
309
314
310
- describe . only ( 'AI' , ( ) => {
315
+ describe ( 'AI' , ( ) => {
311
316
let ai : AI ;
312
317
it ( 'getVertexAI()' , ( ) => {
313
- ai = getAI ( app ) ;
318
+ ai = getAI ( app , { backend : new VertexAIBackend ( ) } ) ;
314
319
} ) ;
315
320
it ( 'getGenerativeModel() and countTokens()' , async ( ) => {
316
321
const model = getGenerativeModel ( ai , { model : 'gemini-1.5-flash' } ) ;
You can’t perform that action at this time.
0 commit comments