Skip to content

feat: add Bing and Google web search providers for AI discovery#114

Merged
linroid merged 3 commits intomainfrom
feat/search-providers
Apr 21, 2026
Merged

feat: add Bing and Google web search providers for AI discovery#114
linroid merged 3 commits intomainfrom
feat/search-providers

Conversation

@linroid
Copy link
Copy Markdown
Owner

@linroid linroid commented Feb 24, 2026

Summary

  • Add BingSearchProvider (Bing Web Search API v7) and GoogleSearchProvider (Google Custom Search JSON API) as real implementations of SearchProvider
  • Auto-resolve provider from SearchConfig.provider in AiModule.create() — no manual wiring needed
  • CLI, Desktop, and Android read env vars (BING_SEARCH_API_KEY or GOOGLE_SEARCH_API_KEY + GOOGLE_SEARCH_CX) to auto-select the provider
  • DummySearchProvider remains the fallback when no search API is configured

Test plan

  • Unit tests for query building (buildQuery, buildMultiSiteQuery) with 0, 1, N sites
  • MockEngine integration tests for JSON parsing, empty results, missing fields, HTTP errors
  • ./gradlew :ai:discover:test passes
  • CLI, Desktop, Android modules compile clean
  • Manual: BING_SEARCH_API_KEY=<key> OPENAI_API_KEY=<key> ./gradlew :cli:run --args="ai-discover 'ubuntu 24.04 iso'"
  • Manual: GOOGLE_SEARCH_API_KEY=<key> GOOGLE_SEARCH_CX=<cx> OPENAI_API_KEY=<key> ./gradlew :cli:run --args="ai-discover 'ffmpeg download'"
  • Verify no search env vars → DummySearchProvider (empty results, no crash)

Wire real search APIs into the AI agent's searchWeb/searchSites tools,
which previously always returned empty results via DummySearchProvider.

- BingSearchProvider: Bing Web Search API v7 with site: operators
- GoogleSearchProvider: Google Custom Search JSON API with siteSearch
- Auto-resolve from SearchConfig.provider in AiModule
- CLI/Desktop/Android read BING_SEARCH_API_KEY or GOOGLE_SEARCH_API_KEY
  + GOOGLE_SEARCH_CX env vars to select the provider automatically
- MockEngine integration tests for JSON parsing and error handling
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 24, 2026

Test Results

1 043 tests  ±0   1 043 ✅ ±0   14s ⏱️ ±0s
   94 suites ±0       0 💤 ±0 
   94 files   ±0       0 ❌ ±0 

Results for commit e129cf0. ± Comparison against base commit 68f79d4.

♻️ This comment has been updated with latest results.

linroid added 2 commits April 20, 2026 23:04
# Conflicts:
#	app/desktop/src/main/kotlin/com/linroid/ketch/app/desktop/main.kt
- Extract resolveSearchConfigFromEnv() into ai:discover; drop 3 copies
  in CLI, Desktop, and Android
- Add HttpTimeout to search HttpClient (matches fetcher)
- Fall back to DummySearchProvider when provider is configured but
  credentials are blank; log a warning
- Log caught exceptions in Bing/Google providers via KetchLogger
- Rename default SearchConfig.provider from "llm" to "none" to match
  actual behavior
- Remove unused BingWebPage.dateLastCrawled
@linroid linroid merged commit f6e19f4 into main Apr 21, 2026
6 checks passed
@linroid linroid deleted the feat/search-providers branch April 21, 2026 06:09
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