@@ -34,6 +34,7 @@ import {
34
34
HarmBlockThreshold ,
35
35
HarmCategory ,
36
36
isFunctionDeclarationsTool ,
37
+ isGoogleMapsTool ,
37
38
isGoogleSearchRetrievalTool ,
38
39
isRetrievalTool ,
39
40
} from '../../src/vertexai/types.js' ;
@@ -347,6 +348,34 @@ describe('Vertex AI Gemini', () => {
347
348
assert . deepStrictEqual ( apiRequest . labels , myLabels ) ;
348
349
} ) ;
349
350
351
+ it ( 'handles retrievalConfig' , async ( ) => {
352
+ mockFetchResponse ( defaultApiResponse ) ;
353
+ const request : GenerateRequest < typeof GeminiConfigSchema > = {
354
+ ...minimalRequest ,
355
+ config : {
356
+ retrievalConfig : {
357
+ latLng : {
358
+ latitude : 37.7749 ,
359
+ longitude : - 122.4194 ,
360
+ } ,
361
+ languageCode : 'en-US' ,
362
+ } ,
363
+ } ,
364
+ } ;
365
+ const model = defineModel ( 'gemini-2.5-flash' , clientOptions ) ;
366
+ await model . run ( request ) ;
367
+ const apiRequest : GenerateContentRequest = JSON . parse (
368
+ fetchStub . lastCall . args [ 1 ] . body
369
+ ) ;
370
+ assert . deepStrictEqual ( apiRequest . toolConfig ?. retrievalConfig , {
371
+ latLng : {
372
+ latitude : 37.7749 ,
373
+ longitude : - 122.4194 ,
374
+ } ,
375
+ languageCode : 'en-US' ,
376
+ } ) ;
377
+ } ) ;
378
+
350
379
it ( 'constructs tools array with functionDeclarations' , async ( ) => {
351
380
mockFetchResponse ( defaultApiResponse ) ;
352
381
const request : GenerateRequest < typeof GeminiConfigSchema > = {
@@ -402,6 +431,29 @@ describe('Vertex AI Gemini', () => {
402
431
}
403
432
} ) ;
404
433
434
+ it ( 'handles googleMaps tool' , async ( ) => {
435
+ mockFetchResponse ( defaultApiResponse ) ;
436
+ const request : GenerateRequest < typeof GeminiConfigSchema > = {
437
+ ...minimalRequest ,
438
+ config : {
439
+ tools : [ { googleMaps : { enableWidget : true } } as any ] ,
440
+ } ,
441
+ } ;
442
+ const model = defineModel ( 'gemini-2.5-flash' , clientOptions ) ;
443
+ await model . run ( request ) ;
444
+ const apiRequest : GenerateContentRequest = JSON . parse (
445
+ fetchStub . lastCall . args [ 1 ] . body
446
+ ) ;
447
+ const mapsTool = apiRequest . tools ?. find ( isGoogleMapsTool ) ;
448
+ assert . ok ( mapsTool , 'Expected GoogleMapsTool' ) ;
449
+ if ( mapsTool ) {
450
+ assert . ok ( mapsTool . googleMaps , 'Expected googleMaps property' ) ;
451
+ assert . deepStrictEqual ( mapsTool , {
452
+ googleMaps : { enableWidget : true } ,
453
+ } ) ;
454
+ }
455
+ } ) ;
456
+
405
457
if ( clientOptions . kind === 'regional' ) {
406
458
it ( 'handles vertexRetrieval tool' , async ( ) => {
407
459
mockFetchResponse ( defaultApiResponse ) ;
0 commit comments