@@ -21,6 +21,7 @@ import { expect } from 'chai';
2121import { AI } from './public-types' ;
2222import { GenerativeModel } from './models/generative-model' ;
2323import { VertexAIBackend } from './backend' ;
24+ import { AI_TYPE } from './constants' ;
2425
2526const fakeAI : AI = {
2627 app : {
@@ -43,8 +44,8 @@ describe('Top level API', () => {
4344 } catch ( e ) {
4445 expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_MODEL ) ;
4546 expect ( ( e as AIError ) . message ) . includes (
46- `VertexAI : Must provide a model name. Example: ` +
47- `getGenerativeModel({ model: 'my-model-name' }) (vertexAI /${ AIErrorCode . NO_MODEL } )`
47+ `AI : Must provide a model name. Example: ` +
48+ `getGenerativeModel({ model: 'my-model-name' }) (${ AI_TYPE } /${ AIErrorCode . NO_MODEL } )`
4849 ) ;
4950 }
5051 } ) ;
@@ -58,9 +59,9 @@ describe('Top level API', () => {
5859 } catch ( e ) {
5960 expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_API_KEY ) ;
6061 expect ( ( e as AIError ) . message ) . equals (
61- `VertexAI : The "apiKey" field is empty in the local ` +
62+ `AI : The "apiKey" field is empty in the local ` +
6263 `Firebase config. Firebase AI requires this field to` +
63- ` contain a valid API key. (vertexAI /${ AIErrorCode . NO_API_KEY } )`
64+ ` contain a valid API key. (${ AI_TYPE } /${ AIErrorCode . NO_API_KEY } )`
6465 ) ;
6566 }
6667 } ) ;
@@ -74,9 +75,9 @@ describe('Top level API', () => {
7475 } catch ( e ) {
7576 expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_PROJECT_ID ) ;
7677 expect ( ( e as AIError ) . message ) . equals (
77- `VertexAI : The "projectId" field is empty in the local` +
78+ `AI : The "projectId" field is empty in the local` +
7879 ` Firebase config. Firebase AI requires this field ` +
79- `to contain a valid project ID. (vertexAI /${ AIErrorCode . NO_PROJECT_ID } )`
80+ `to contain a valid project ID. (${ AI_TYPE } /${ AIErrorCode . NO_PROJECT_ID } )`
8081 ) ;
8182 }
8283 } ) ;
@@ -90,9 +91,9 @@ describe('Top level API', () => {
9091 } catch ( e ) {
9192 expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_APP_ID ) ;
9293 expect ( ( e as AIError ) . message ) . equals (
93- `VertexAI : The "appId" field is empty in the local` +
94+ `AI : The "appId" field is empty in the local` +
9495 ` Firebase config. Firebase AI requires this field ` +
95- `to contain a valid app ID. (vertexAI /${ AIErrorCode . NO_APP_ID } )`
96+ `to contain a valid app ID. (${ AI_TYPE } /${ AIErrorCode . NO_APP_ID } )`
9697 ) ;
9798 }
9899 } ) ;
@@ -107,8 +108,8 @@ describe('Top level API', () => {
107108 } catch ( e ) {
108109 expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_MODEL ) ;
109110 expect ( ( e as AIError ) . message ) . includes (
110- `VertexAI : Must provide a model name. Example: ` +
111- `getImagenModel({ model: 'my-model-name' }) (vertexAI /${ AIErrorCode . NO_MODEL } )`
111+ `AI : Must provide a model name. Example: ` +
112+ `getImagenModel({ model: 'my-model-name' }) (${ AI_TYPE } /${ AIErrorCode . NO_MODEL } )`
112113 ) ;
113114 }
114115 } ) ;
@@ -122,9 +123,9 @@ describe('Top level API', () => {
122123 } catch ( e ) {
123124 expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_API_KEY ) ;
124125 expect ( ( e as AIError ) . message ) . equals (
125- `VertexAI : The "apiKey" field is empty in the local ` +
126+ `AI : The "apiKey" field is empty in the local ` +
126127 `Firebase config. Firebase AI requires this field to` +
127- ` contain a valid API key. (vertexAI /${ AIErrorCode . NO_API_KEY } )`
128+ ` contain a valid API key. (${ AI_TYPE } /${ AIErrorCode . NO_API_KEY } )`
128129 ) ;
129130 }
130131 } ) ;
@@ -138,9 +139,9 @@ describe('Top level API', () => {
138139 } catch ( e ) {
139140 expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_PROJECT_ID ) ;
140141 expect ( ( e as AIError ) . message ) . equals (
141- `VertexAI : The "projectId" field is empty in the local` +
142+ `AI : The "projectId" field is empty in the local` +
142143 ` Firebase config. Firebase AI requires this field ` +
143- `to contain a valid project ID. (vertexAI /${ AIErrorCode . NO_PROJECT_ID } )`
144+ `to contain a valid project ID. (${ AI_TYPE } /${ AIErrorCode . NO_PROJECT_ID } )`
144145 ) ;
145146 }
146147 } ) ;
@@ -154,9 +155,9 @@ describe('Top level API', () => {
154155 } catch ( e ) {
155156 expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_APP_ID ) ;
156157 expect ( ( e as AIError ) . message ) . equals (
157- `VertexAI : The "appId" field is empty in the local` +
158+ `AI : The "appId" field is empty in the local` +
158159 ` Firebase config. Firebase AI requires this field ` +
159- `to contain a valid app ID. (vertexAI /${ AIErrorCode . NO_APP_ID } )`
160+ `to contain a valid app ID. (${ AI_TYPE } /${ AIErrorCode . NO_APP_ID } )`
160161 ) ;
161162 }
162163 } ) ;
0 commit comments