File tree Expand file tree Collapse file tree 4 files changed +1128
-1078
lines changed Expand file tree Collapse file tree 4 files changed +1128
-1078
lines changed Original file line number Diff line number Diff line change 1717 "author" : " " ,
1818 "license" : " ISC" ,
1919 "dependencies" : {
20- "firebase" : " 11.3.0 "
20+ "firebase" : " ^ 11.8.0-20250512211235 "
2121 },
2222 "devDependencies" : {
2323 "@babel/core" : " 7.26.8" ,
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ import {
5858 onValue ,
5959 off
6060} from 'firebase/database' ;
61- import { getGenerativeModel , getAI } from 'firebase/ai' ;
61+ import { getGenerativeModel , getAI , VertexAIBackend } from 'firebase/ai' ;
6262import { getDataConnect , DataConnect } from 'firebase/data-connect' ;
6363
6464/**
@@ -312,7 +312,7 @@ function callPerformance(app) {
312312 */
313313async function callAI ( app ) {
314314 console . log ( '[AI] start' ) ;
315- const ai = getAI ( app ) ;
315+ const ai = getAI ( app , { backend : new VertexAIBackend ( ) } ) ;
316316 const model = getGenerativeModel ( ai , { model : 'gemini-1.5-flash' } ) ;
317317 const result = await model . countTokens ( 'abcdefg' ) ;
318318 console . log ( `[AI] counted tokens: ${ result . totalTokens } ` ) ;
Original file line number Diff line number Diff line change @@ -86,7 +86,12 @@ import {
8686 StorageReference ,
8787 deleteObject
8888} 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' ;
9095import { getDataConnect , DataConnect } from 'firebase/data-connect' ;
9196import { config , testAccount } from '../firebase-config' ;
9297import 'jest' ;
@@ -307,10 +312,10 @@ describe('MODULAR', () => {
307312 } ) ;
308313 } ) ;
309314
310- describe . only ( 'AI' , ( ) => {
315+ describe ( 'AI' , ( ) => {
311316 let ai : AI ;
312317 it ( 'getVertexAI()' , ( ) => {
313- ai = getAI ( app ) ;
318+ ai = getAI ( app , { backend : new VertexAIBackend ( ) } ) ;
314319 } ) ;
315320 it ( 'getGenerativeModel() and countTokens()' , async ( ) => {
316321 const model = getGenerativeModel ( ai , { model : 'gemini-1.5-flash' } ) ;
You can’t perform that action at this time.
0 commit comments