Skip to content

feat(Google Gemini Node): Add Google Search grounding support - #336

Open
everettbu wants to merge 6 commits into
masterfrom
feat/google-gemini-search-grounding
Open

feat(Google Gemini Node): Add Google Search grounding support#336
everettbu wants to merge 6 commits into
masterfrom
feat/google-gemini-search-grounding

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of n8n-io/n8n#23161
Original author: RishabhGithub7348


Add Google Search grounding capability to Google Gemini Chat Model and Google Vertex Chat Model nodes. This feature allows AI agents to access real-time information from Google Search, improving response accuracy for queries about current events, recent data, or topics beyond the model's knowledge cutoff.

Key changes:

  • Add "Google Search Grounding" toggle option to both nodes
  • Implement automatic model version detection (Gemini 1.x vs 2.0+)
  • Use appropriate API format based on model version:
    • Gemini 1.x: googleSearchRetrieval with dynamic threshold
    • Gemini 2.0+/3.x: googleSearch (simpler format)
  • Add "Dynamic Retrieval Threshold" option (only shown for Gemini 1.x)
  • Ensure compatibility with Tools Agent by overriding bindTools method

Summary

  • Add Google Search grounding support to Google Gemini and Google Vertex Chat Model nodes
  • Allows AI agents to use Google Search for real-time information beyond the model's knowledge cutoff
  • Automatically detects model version and uses appropriate API format:
    • Gemini 1.x: googleSearchRetrieval with dynamic retrieval config
    • Gemini 2.0+/3.x: googleSearch tool
  • Add "Dynamic Retrieval Threshold" option (only shown for Gemini 1.x models)
  • Ensure compatibility with Tools Agent by overriding bindTools method

Related Linear tickets, Github issues, and Community forum posts

N/A - New feature implementation

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

Rishabh Maurya and others added 6 commits December 13, 2025 00:17
Add Google Search grounding capability to Google Gemini Chat Model and
Google Vertex Chat Model nodes. This feature allows AI agents to access
real-time information from Google Search, improving response accuracy
for queries about current events, recent data, or topics beyond the
model's knowledge cutoff.

Key changes:
- Add "Google Search Grounding" toggle option to both nodes
- Implement automatic model version detection (Gemini 1.x vs 2.0+)
- Use appropriate API format based on model version:
  - Gemini 1.x: googleSearchRetrieval with dynamic threshold
  - Gemini 2.0+/3.x: googleSearch (simpler format)
- Add "Dynamic Retrieval Threshold" option (only shown for Gemini 1.x)
- Ensure compatibility with Tools Agent by overriding bindTools method
… Search Grounding

- Replace inline type casting with GeminiModelOptions interface
- Add shared types.ts for Gemini model options
- Add unit tests for Google Search grounding feature in both nodes:
  - Test model version detection (Gemini 1.x vs 2.0+/3.x)
  - Test correct tool format selection (googleSearchRetrieval vs googleSearch)
  - Test bindTools override behavior
  - Test default dynamicRetrievalThreshold value
@everettbu everettbu added community Authored by a community member in linear Issue or PR has been created in Linear for internal review labels Jan 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Authored by a community member in linear Issue or PR has been created in Linear for internal review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants