feat: add support for google maps grounding#1478
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for Google Maps grounding functionality to the Google and Google Vertex AI providers. The implementation allows users to specify geographic coordinates for location-based queries through a new googleMaps tool.
Key changes:
- Added
retrievalConfigtoGoogleToolConfiginterface to support latitude/longitude parameters - Implemented Google Maps tool detection and configuration in both Google and Vertex AI providers
- Added tool transformation logic to handle the
googleMapstool with widget support
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/providers/google/chatComplete.ts | Added retrievalConfig to GoogleToolConfig interface and implemented Google Maps tool detection/configuration in tool_choice parameter handling |
| src/providers/google-vertex-ai/utils.ts | Added googleMaps and google_maps to the list of recognized Google tools and implemented transformation logic for Google Maps tool |
| src/providers/google-vertex-ai/chatComplete.ts | Mirrored Google provider changes for Vertex AI, adding Google Maps tool detection and configuration in tool_choice parameter handling |
Comments suppressed due to low confidence (1)
src/providers/google/chatComplete.ts:1
- The Google Maps tool detection logic (lines 338-346) is duplicated from the default function (lines 450-458). Consider extracting this into a helper function to avoid code duplication and improve maintainability.
import { GOOGLE } from '../../globals';
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return toolConfig; | ||
| } | ||
| const googleMapsTool = params.tools?.find( | ||
| (tool) => | ||
| tool.function?.name === 'googleMaps' || | ||
| tool.function?.name === 'google_maps' | ||
| ); | ||
| if (googleMapsTool) { | ||
| toolConfig.retrievalConfig = | ||
| googleMapsTool.function?.parameters?.retrieval_config; | ||
| } | ||
| return toolConfig; |
There was a problem hiding this comment.
The Google Maps tool detection logic (lines 338-346) is duplicated from the default function (lines 307-315). Consider extracting this into a helper function to avoid code duplication and improve maintainability.
417b079 to
a682340
Compare
Description: (required)
Adds support for grounding with google maps
Tests Run/Test cases added: (required)
Type of Change:
cURL