@@ -34,6 +34,7 @@ import {
3434 HarmBlockThreshold ,
3535 HarmCategory ,
3636 isFunctionDeclarationsTool ,
37+ isGoogleMapsTool ,
3738 isGoogleSearchRetrievalTool ,
3839 isRetrievalTool ,
3940} from '../../src/vertexai/types.js' ;
@@ -347,6 +348,34 @@ describe('Vertex AI Gemini', () => {
347348 assert . deepStrictEqual ( apiRequest . labels , myLabels ) ;
348349 } ) ;
349350
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+
350379 it ( 'constructs tools array with functionDeclarations' , async ( ) => {
351380 mockFetchResponse ( defaultApiResponse ) ;
352381 const request : GenerateRequest < typeof GeminiConfigSchema > = {
@@ -402,6 +431,29 @@ describe('Vertex AI Gemini', () => {
402431 }
403432 } ) ;
404433
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+
405457 if ( clientOptions . kind === 'regional' ) {
406458 it ( 'handles vertexRetrieval tool' , async ( ) => {
407459 mockFetchResponse ( defaultApiResponse ) ;
0 commit comments