@@ -14,6 +14,50 @@ describe('VertexAI', () => {
14
14
} ) ;
15
15
} ) ;
16
16
17
+ it ( 'no location given, should instantiate VertexAI and VertexAIPreview' , ( ) => {
18
+ const vertexaiNoLocation = new VertexAI ( { project : PROJECT } ) ;
19
+ const generativeModel = vertexaiNoLocation . getGenerativeModel ( {
20
+ model : 'gemini-pro' ,
21
+ } ) ;
22
+ const generativeModelPreview =
23
+ vertexaiNoLocation . preview . getGenerativeModel ( {
24
+ model : 'gemini-pro' ,
25
+ } ) ;
26
+ expect ( vertexaiNoLocation ) . toBeInstanceOf ( VertexAI ) ;
27
+ expect ( generativeModel ) . toBeInstanceOf ( GenerativeModel ) ;
28
+ expect ( generativeModelPreview ) . toBeInstanceOf ( GenerativeModelPreview ) ;
29
+ } ) ;
30
+
31
+ it ( 'location in run time env GOOGLE_CLOUD_REGION, should instantiate VertexAI and VertexAIPreview' , ( ) => {
32
+ process . env [ 'GOOGLE_CLOUD_REGION' ] = 'us-central1' ;
33
+ const vertexaiNoLocation = new VertexAI ( { project : PROJECT } ) ;
34
+ const generativeModel = vertexaiNoLocation . getGenerativeModel ( {
35
+ model : 'gemini-pro' ,
36
+ } ) ;
37
+ const generativeModelPreview =
38
+ vertexaiNoLocation . preview . getGenerativeModel ( {
39
+ model : 'gemini-pro' ,
40
+ } ) ;
41
+ expect ( vertexaiNoLocation ) . toBeInstanceOf ( VertexAI ) ;
42
+ expect ( generativeModel ) . toBeInstanceOf ( GenerativeModel ) ;
43
+ expect ( generativeModelPreview ) . toBeInstanceOf ( GenerativeModelPreview ) ;
44
+ } ) ;
45
+
46
+ it ( 'location in run time env CLOUD_ML_REGION, should instantiate VertexAI and VertexAIPreview' , ( ) => {
47
+ process . env [ 'CLOUD_ML_REGION' ] = 'us-central1' ;
48
+ const vertexaiNoLocation = new VertexAI ( { project : PROJECT } ) ;
49
+ const generativeModel = vertexaiNoLocation . getGenerativeModel ( {
50
+ model : 'gemini-pro' ,
51
+ } ) ;
52
+ const generativeModelPreview =
53
+ vertexaiNoLocation . preview . getGenerativeModel ( {
54
+ model : 'gemini-pro' ,
55
+ } ) ;
56
+ expect ( vertexaiNoLocation ) . toBeInstanceOf ( VertexAI ) ;
57
+ expect ( generativeModel ) . toBeInstanceOf ( GenerativeModel ) ;
58
+ expect ( generativeModelPreview ) . toBeInstanceOf ( GenerativeModelPreview ) ;
59
+ } ) ;
60
+
17
61
it ( 'given undefined google auth options, should be instantiated' , ( ) => {
18
62
expect ( vertexai ) . toBeInstanceOf ( VertexAI ) ;
19
63
} ) ;
0 commit comments