Skip to content

Conversation

@jamesbuddrige
Copy link

@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
@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

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.43%. Comparing base (502d8ad) to head (b247487).
⚠️ Report is 1 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   83.41%   83.43%   +0.01%     
==========================================
  Files         138      138              
  Lines       12447    12469      +22     
==========================================
+ Hits        10383    10403      +20     
- Misses       1431     1432       +1     
- Partials      633      634       +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.

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.

2 participants