Skip to content

feat: Enable Google Image Search grounding alongside web search#65

Merged
shinpr merged 2 commits intomainfrom
feature/enhance-google-search-grounding
Mar 17, 2026
Merged

feat: Enable Google Image Search grounding alongside web search#65
shinpr merged 2 commits intomainfrom
feature/enhance-google-search-grounding

Conversation

@shinpr
Copy link
Owner

@shinpr shinpr commented Mar 17, 2026

Summary

  • When useGoogleSearch is enabled, include both webSearch and imageSearch in the searchTypes parameter passed to the Gemini API
  • Previously only basic googleSearch: {} was sent (web search only); now the model can also retrieve visual references via Google Image Search before generating images
  • This improves accuracy for real-world subjects (landmarks, products, styles) by providing visual context during generation

Changes

  • src/api/geminiClient.ts: Updated tools structure from [{ googleSearch: {} }] to [{ googleSearch: { searchTypes: { webSearch: {}, imageSearch: {} } } }]
  • src/api/__tests__/geminiClient.test.ts: Added assertions to verify the exact tools parameter structure in all 4 useGoogleSearch test cases

Test plan

  • All 161 existing tests pass
  • TypeScript build passes
  • Lint passes
  • Manual verification: generate an image with useGoogleSearch: true referencing a real-world landmark and confirm improved accuracy

🤖 Generated with Claude Code

When useGoogleSearch is enabled, include both webSearch and imageSearch
in searchTypes so Gemini can retrieve visual references from the web
before generating images, improving accuracy for real-world subjects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shinpr shinpr self-assigned this Mar 17, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shinpr shinpr merged commit af3a4c0 into main Mar 17, 2026
1 check passed
@shinpr shinpr deleted the feature/enhance-google-search-grounding branch March 17, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant