feat: add Gemini as web search backend (google_search grounding)#13268
Open
SpectreMercury wants to merge 1 commit into
Open
feat: add Gemini as web search backend (google_search grounding)#13268SpectreMercury wants to merge 1 commit into
SpectreMercury wants to merge 1 commit into
Conversation
Adds "gemini" as a new web search backend that uses Gemini API's
native google_search grounding tool. This provides web search
capability without requiring any third-party API key — it uses the
existing GOOGLE_API_KEY or GEMINI_API_KEY already configured for the
LLM provider.
How it works:
- Calls Gemini native API with `tools: [{"google_search": {}}]`
- Gemini automatically generates search queries, searches Google,
and returns grounded responses with source URLs
- Uses gemini-2.5-flash for search (fast and cost-effective)
- Returns results in the same normalized format as other backends
Changes:
- web_tools.py: Add _gemini_search() function, register "gemini"
backend in _get_backend() and _is_backend_available()
- tools_config.py: Add "Google Gemini" as a search provider option
in `hermes tools` setup wizard
Configuration:
# config.yaml
web:
backend: "gemini"
# .env (same key used for the LLM provider)
GOOGLE_API_KEY=your_key_here
When web.backend is "auto" or unset, Gemini is auto-selected if
GOOGLE_API_KEY is present (highest priority since it's free and
doesn't need an additional API key).
19 tasks
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds "gemini" as a new web search backend that uses Gemini API's native
google_searchgrounding tool. This provides web search without requiring any third-party API key — it reuses the existingGOOGLE_API_KEYorGEMINI_API_KEYalready configured for the LLM provider.Motivation
Currently,
web_searchrequires a third-party search API key (Firecrawl, Tavily, Exa, or Parallel). Users who choose Gemini as their LLM provider already have a Google API key, but can't use it for web search. Gemini's native Google Search grounding provides high-quality web search results at no additional cost.How it works
tools: [{"google_search": {}}]gemini-2.5-flashfor search (fast and cost-effective)Changes
tools/web_tools.py: Add_gemini_search()function, register "gemini" backend in_get_backend()and_is_backend_available()hermes_cli/tools_config.py: Add "Google Gemini" as a search provider option inhermes toolssetup wizardConfiguration
When
web.backendis unset, Gemini is auto-selected ifGOOGLE_API_KEYis present (highest priority in the fallback chain since it doesn't need an additional API key).Test plan
hermes tools→ select "Google Gemini" as web backendhermes chat -q "What happened in tech news today?"→ should return grounded resultshermes doctor→ web check passes with onlyGOOGLE_API_KEYset