1717import { ModelParams } from './types' ;
1818import { getGenerativeModel } from './api' ;
1919import { expect } from 'chai' ;
20- import { Vertex } from './public-types' ;
20+ import { VertexAI } from './public-types' ;
2121import { GenerativeModel } from './models/generative-model' ;
2222import { VertexError } from './errors' ;
2323
24- const fakeVertex : Vertex = {
24+ const fakeVertexAI : VertexAI = {
2525 app : {
2626 name : 'DEFAULT' ,
2727 automaticDataCollectionEnabled : true ,
@@ -35,30 +35,30 @@ const fakeVertex: Vertex = {
3535
3636describe ( 'Top level API' , ( ) => {
3737 it ( 'getGenerativeModel throws if no model is provided' , ( ) => {
38- expect ( ( ) => getGenerativeModel ( fakeVertex , { } as ModelParams ) ) . to . throw (
38+ expect ( ( ) => getGenerativeModel ( fakeVertexAI , { } as ModelParams ) ) . to . throw (
3939 VertexError . NO_MODEL
4040 ) ;
4141 } ) ;
4242 it ( 'getGenerativeModel throws if no apiKey is provided' , ( ) => {
4343 const fakeVertexNoApiKey = {
44- ...fakeVertex ,
44+ ...fakeVertexAI ,
4545 app : { options : { projectId : 'my-project' } }
46- } as Vertex ;
46+ } as VertexAI ;
4747 expect ( ( ) =>
4848 getGenerativeModel ( fakeVertexNoApiKey , { model : 'my-model' } )
4949 ) . to . throw ( VertexError . NO_API_KEY ) ;
5050 } ) ;
5151 it ( 'getGenerativeModel throws if no projectId is provided' , ( ) => {
5252 const fakeVertexNoProject = {
53- ...fakeVertex ,
53+ ...fakeVertexAI ,
5454 app : { options : { apiKey : 'my-key' } }
55- } as Vertex ;
55+ } as VertexAI ;
5656 expect ( ( ) =>
5757 getGenerativeModel ( fakeVertexNoProject , { model : 'my-model' } )
5858 ) . to . throw ( VertexError . NO_PROJECT_ID ) ;
5959 } ) ;
6060 it ( 'getGenerativeModel gets a GenerativeModel' , ( ) => {
61- const genModel = getGenerativeModel ( fakeVertex , { model : 'my-model' } ) ;
61+ const genModel = getGenerativeModel ( fakeVertexAI , { model : 'my-model' } ) ;
6262 expect ( genModel ) . to . be . an . instanceOf ( GenerativeModel ) ;
6363 expect ( genModel . model ) . to . equal ( 'publishers/google/models/my-model' ) ;
6464 } ) ;
0 commit comments