@@ -21,6 +21,7 @@ import { expect } from 'chai';
21
21
import { AI } from './public-types' ;
22
22
import { GenerativeModel } from './models/generative-model' ;
23
23
import { VertexAIBackend } from './backend' ;
24
+ import { AI_TYPE } from './constants' ;
24
25
25
26
const fakeAI : AI = {
26
27
app : {
@@ -43,8 +44,8 @@ describe('Top level API', () => {
43
44
} catch ( e ) {
44
45
expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_MODEL ) ;
45
46
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 } )`
48
49
) ;
49
50
}
50
51
} ) ;
@@ -58,9 +59,9 @@ describe('Top level API', () => {
58
59
} catch ( e ) {
59
60
expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_API_KEY ) ;
60
61
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 ` +
62
63
`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 } )`
64
65
) ;
65
66
}
66
67
} ) ;
@@ -74,9 +75,9 @@ describe('Top level API', () => {
74
75
} catch ( e ) {
75
76
expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_PROJECT_ID ) ;
76
77
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` +
78
79
` 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 } )`
80
81
) ;
81
82
}
82
83
} ) ;
@@ -90,9 +91,9 @@ describe('Top level API', () => {
90
91
} catch ( e ) {
91
92
expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_APP_ID ) ;
92
93
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` +
94
95
` 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 } )`
96
97
) ;
97
98
}
98
99
} ) ;
@@ -107,8 +108,8 @@ describe('Top level API', () => {
107
108
} catch ( e ) {
108
109
expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_MODEL ) ;
109
110
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 } )`
112
113
) ;
113
114
}
114
115
} ) ;
@@ -122,9 +123,9 @@ describe('Top level API', () => {
122
123
} catch ( e ) {
123
124
expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_API_KEY ) ;
124
125
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 ` +
126
127
`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 } )`
128
129
) ;
129
130
}
130
131
} ) ;
@@ -138,9 +139,9 @@ describe('Top level API', () => {
138
139
} catch ( e ) {
139
140
expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_PROJECT_ID ) ;
140
141
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` +
142
143
` 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 } )`
144
145
) ;
145
146
}
146
147
} ) ;
@@ -154,9 +155,9 @@ describe('Top level API', () => {
154
155
} catch ( e ) {
155
156
expect ( ( e as AIError ) . code ) . includes ( AIErrorCode . NO_APP_ID ) ;
156
157
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` +
158
159
` 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 } )`
160
161
) ;
161
162
}
162
163
} ) ;
0 commit comments