Skip to content

feat: add support for Google Search grounding as a tool type for Gemini models#1641

Merged
mathetake merged 8 commits intoenvoyproxy:mainfrom
Digital-Insight-Technologies-Ltd:support-google-search
Jan 7, 2026
Merged

feat: add support for Google Search grounding as a tool type for Gemini models#1641
mathetake merged 8 commits intoenvoyproxy:mainfrom
Digital-Insight-Technologies-Ltd:support-google-search

Conversation

@jamesbuddrige
Copy link
Copy Markdown
Contributor

@jamesbuddrige jamesbuddrige commented Dec 9, 2025

Description

Adds support for Google Search grounding 1 as a tool type for Gemini models, complementing the existing enterprise web search support added in #1526. Enterprise search and Google Search are two different tools in Vertex. See 2 for more details.

The implementation translates the google_search tool type to Gemini's GoogleSearch with support for all configuration options:

  • exclude_domains: Filter out specific domains from search results (Vertex AI only)
  • blocking_confidence: Set phishing block threshold (Vertex AI only)
  • time_range_filter: Restrict results to a time window (Gemini API only)

Response grounding metadata is already handled by the existing GroundingMetadata field from #1526.

Related Issues/PRs (if applicable)

Related PR: #1526

Special notes for reviewers (if applicable)

The config structs are prefixed with GCP (e.g., GCPGoogleSearchConfig, GCPTimeRangeFilter) to follow the existing pattern for vendor-specific extensions (GCPVertexAIVendorFields, GCPVertexAIGenerationConfig).

I'm not completely sure this is the right design pattern for tool options going forward. These fields are necessary to expose the full functionality of the underlying API, but adding vendor-specific config structs to the OpenAI schema does muddy the interface a bit. The alternative would be something more generic (e.g., map[string]any), but that loses type safety. Open to feedback on whether this approach makes sense or if we want to establish a different pattern for future tool configurations.

@jamesbuddrige jamesbuddrige requested a review from a team as a code owner December 9, 2025 00:20
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 9, 2025
Signed-off-by: jamesbuddrige <jxbuddrige@hotmail.co.uk>
@jamesbuddrige jamesbuddrige changed the title Add support for Google Search grounding as a tool type for Gemini models feat: add support for Google Search grounding as a tool type for Gemini models Dec 9, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.08%. Comparing base (f92f8f4) to head (a63e219).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
internal/translator/gemini_helper.go 90.90% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1641      +/-   ##
==========================================
+ Coverage   81.04%   81.08%   +0.03%     
==========================================
  Files         147      147              
  Lines       13341    13363      +22     
==========================================
+ Hits        10812    10835      +23     
+ Misses       1876     1874       -2     
- Partials      653      654       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mathetake
Copy link
Copy Markdown
Member

@yuzisun @hustxiayang could you take a look?

@yuzisun
Copy link
Copy Markdown
Contributor

yuzisun commented Dec 21, 2025

@jamesbuddrige can you help update the doc here to include the GoogleSearch tool
https://aigateway.envoyproxy.io/docs/capabilities/llm-integrations/vendor-specific-fields#gcp-vertex-ai-gemini

Signed-off-by: jamesbuddrige <jxbuddrige@hotmail.co.uk>
@mathetake mathetake enabled auto-merge (squash) January 7, 2026 22:52
@mathetake mathetake disabled auto-merge January 7, 2026 23:28
@mathetake mathetake merged commit 1ece5ac into envoyproxy:main Jan 7, 2026
32 checks passed
@jamesbuddrige jamesbuddrige deleted the support-google-search branch January 8, 2026 00:25
hustxiayang pushed a commit to hustxiayang/ai-gateway that referenced this pull request Jan 13, 2026
…ni models (envoyproxy#1641)

**Description**

Adds support for Google Search grounding [1] as a tool type for Gemini
models, complementing the existing enterprise web search support added
in envoyproxy#1526. Enterprise search and Google Search are two different tools in
Vertex. See [2] for more details.

[1]:
https://docs.cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-search
[2]:
https://docs.cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise#overview

The implementation translates the google_search tool type to Gemini's
GoogleSearch with support for all configuration options:
- exclude_domains: Filter out specific domains from search results
(Vertex AI only)
- blocking_confidence: Set phishing block threshold (Vertex AI only)
- time_range_filter: Restrict results to a time window (Gemini API only)

Response grounding metadata is already handled by the existing
GroundingMetadata field from envoyproxy#1526.

**Related Issues/PRs (if applicable)**

Related PR: envoyproxy#1526

**Special notes for reviewers (if applicable)**

The config structs are prefixed with GCP (e.g., GCPGoogleSearchConfig,
GCPTimeRangeFilter) to follow the existing pattern for vendor-specific
extensions (GCPVertexAIVendorFields, GCPVertexAIGenerationConfig).

---------

Signed-off-by: jamesbuddrige <jxbuddrige@hotmail.co.uk>
hustxiayang pushed a commit to hustxiayang/ai-gateway that referenced this pull request Jan 13, 2026
…ni models (envoyproxy#1641)

**Description**

Adds support for Google Search grounding [1] as a tool type for Gemini
models, complementing the existing enterprise web search support added
in envoyproxy#1526. Enterprise search and Google Search are two different tools in
Vertex. See [2] for more details.

[1]:
https://docs.cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-search
[2]:
https://docs.cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise#overview

The implementation translates the google_search tool type to Gemini's
GoogleSearch with support for all configuration options:
- exclude_domains: Filter out specific domains from search results
(Vertex AI only)
- blocking_confidence: Set phishing block threshold (Vertex AI only)
- time_range_filter: Restrict results to a time window (Gemini API only)

Response grounding metadata is already handled by the existing
GroundingMetadata field from envoyproxy#1526.

**Related Issues/PRs (if applicable)**

Related PR: envoyproxy#1526

**Special notes for reviewers (if applicable)**

The config structs are prefixed with GCP (e.g., GCPGoogleSearchConfig,
GCPTimeRangeFilter) to follow the existing pattern for vendor-specific
extensions (GCPVertexAIVendorFields, GCPVertexAIGenerationConfig).

---------

Signed-off-by: jamesbuddrige <jxbuddrige@hotmail.co.uk>
Signed-off-by: yxia216 <yxia216@bloomberg.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants