You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gpt-pilot/docs/tools
AkosCz 3a3c2da916
[Feature]: Add Gemini (Google Search grounding) as web_search provider (#13075)
* feat: add Gemini (Google Search grounding) as web_search provider

Add Gemini as a fourth web search provider alongside Brave, Perplexity,
and Grok. Uses Gemini's built-in Google Search grounding tool to return
search results with citations.

- Add runGeminiSearch() with Google Search grounding via tools API
- Resolve Gemini's grounding redirect URLs to direct URLs via parallel
  HEAD requests (5s timeout, graceful fallback)
- Add Gemini config block (apiKey, model) with env var fallback
- Default model: gemini-2.5-flash (fast, cheap, grounding-capable)
- Strip API key from error messages for security
- Add config validation tests for Gemini provider
- Update docs/tools/web.md with Gemini provider documentation

Closes #13074

* feat: auto-detect search provider from available API keys

When no explicit provider is configured, resolveSearchProvider now
checks for available API keys in priority order (Brave → Gemini →
Perplexity → Grok) and selects the first provider with a valid key.

- Add auto-detection logic using existing resolve*ApiKey functions
- Export resolveSearchProvider via __testing_provider for tests
- Add 8 tests covering auto-detection, priority order, and explicit override
- Update docs/tools/web.md with auto-detection documentation

* fix: merge __testing exports, downgrade auto-detect log to debug

* fix: use defaultRuntime.log instead of .debug (not in RuntimeEnv type)

* fix: mark gemini apiKey as sensitive in zod schema

* fix: address Greptile review — add externalContent to Gemini payload, add Gemini/Grok entries to schema labels/help, remove dead schema-fields.ts

* fix(web-search): add JSON parse guard for Gemini API responses

Addresses Greptile review comment: add try/catch to handle non-JSON
responses from Gemini API gracefully, preventing runtime errors on
malformed responses.

Note: FIELD_HELP entries for gemini.apiKey and gemini.model were
already present in schema.help.ts, and gemini.apiKey was already
marked as sensitive in zod-schema.agent-runtime.ts (both fixed in
earlier commits).

* fix: use structured readResponseText result in Gemini error path

readResponseText returns { text, truncated, bytesRead }, not a string.
The Gemini error handler was using the result object directly, which
would always be truthy and never fall through to res.statusText.
Align with Perplexity/xAI/Brave error patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix import order and formatting after rebase onto main

* Web search: send Gemini API key via header

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
9 months ago
..
agent-send.md Docs: add nav titles across docs (#5689) 10 months ago
apply-patch.md fix(security): default apply_patch workspace containment 9 months ago
browser-linux-troubleshooting.md revert(docs): undo markdownlint autofix churn 10 months ago
browser-login.md chore(skills): remove bird skill 10 months ago
browser.md CLI: resolve parent/subcommand option collisions (#18725) 9 months ago
chrome-extension.md fix(browser): unify extension relay auth on gateway token 9 months ago
clawhub.md Docs: expand ClawHub overview 10 months ago
creating-skills.md docs: add missing summaries and read_when hints 9 months ago
elevated.md fix(security): tighten elevated allowFrom sender matching 9 months ago
exec-approvals.md fix(security): harden allow-always wrapper persistence 9 months ago
exec.md fix(exec): restore sandbox as implicit host default 9 months ago
firecrawl.md Docs: add nav titles across docs (#5689) 10 months ago
index.md docs: document thread-bound subagent sessions and remove plan 9 months ago
llm-task.md revert(docs): undo markdownlint autofix churn 10 months ago
lobster.md refactor(lobster): remove lobsterPath overrides 9 months ago
loop-detection.md docs: add missing summary/read_when metadata 9 months ago
multi-agent-sandbox-tools.md fix(security): scope session tools and webhook secret fallback 9 months ago
plugin.md chore: remove dead plugin hook loader 9 months ago
reactions.md Docs: add nav titles across docs (#5689) 10 months ago
skills-config.md Docs: add nav titles across docs (#5689) 10 months ago
skills.md docs: canonicalize docs paths and align zh navigation (#11428) 10 months ago
slash-commands.md docs: document verbose-gated tool error details 9 months ago
subagents.md docs: keep channel names only in thread-support list 9 months ago
thinking.md docs: document verbose-gated tool error details 9 months ago
web.md [Feature]: Add Gemini (Google Search grounding) as web_search provider (#13075) 9 months ago