Repository navigation
feat: add optional You.com web search provider - #21
Open
valueadd-lgtm wants to merge 1 commit into
Open
valueadd-lgtm wants to merge 1 commit into
valueadd-lgtm wants to merge 1 commit into
Conversation
You.com joins native and Tavily as a selectable provider for the web_search, fetch_page and deep_search tools, mirroring the Tavily backend's shape: a search.Backend implementation over the You.com Search and Contents APIs, wired into BuildBackend so the native engine chain stays the last-link fallback. Its key is read from the environment (YDC_API_KEY) rather than stored config, so the settings surface for it is a provider tab plus a pointer to the variable — no new stored credential. Results and pages are stamped provider "youcom", and selecting it without the key set falls back to native with a warning logged, the same way an unkeyed Tavily selection does. Signed-off-by: valueadd-lgtm <339269770+valueadd-lgtm@users.noreply.github.com>
valueadd-lgtm
force-pushed
the
feat/youcom-search-provider
branch
from
October 14, 2026 01:59
785df95 to
7ea5f28
Compare
This branch has not been deployed
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.
This adds You.com as a third selectable search provider alongside native and Tavily, for the
web_search,fetch_pageanddeep_searchtools.Why this is useful here: You.com exposes a Search API plus a Contents (page-extraction) API, which maps one-to-one onto the two
Backendmethods — so the provider slots into the existing engine-choice pattern without any new abstraction, and without a new dependency (stdlibnet/httponly). The You.com API key is a static key from you.com/platform/api-keys.What changed
internal/search/youcom.go—YoucomBackend, mirroringTavilyBackend's shape:POST /v1/searchfor results,POST /v1/contentsfor page markdown, per-operation timeouts, capped result count,nativePageCharstruncation so the fetch_page truncation note stays accurate, and the same error reporting (a 401 is called out as a rejected key).internal/search/backend.go—ProviderYoucom = "youcom"in the shared provider constants.internal/search/build.go—BuildBackendwiresNewFallbackBackend(youcom, nativeChain)when provider isyoucomand a key is resolvable. The native chain stays the last link, so a bad key, exhausted quota or network error falls through rather than going dark — same contract as Tavily.internal/session/search_store.go—SearchProviderYoucomconstant;normalisekeeps it (no schema change — the provider column is already a string).internal/server/server.go—logSearchProviderlogs the youcom selection and warns whenYDC_API_KEYis missing, so a silent native fallback is visible.web/src/pages/settings/search.tsx,web/src/api/client.ts) — a You.com tab whose row explains that the key comes fromYDC_API_KEYin the server environment, with a link to get one. Deliberately no stored credential: the key travels with the deployment, not the database, so no new column, no masking surface, and nothing changes for existing users who never select the tab.docs-site/src/content/docs/search-and-skills.md) — one row in the provider-key env table.Setup / env
Then pick the You.com tab in Settings → Web search (or set
provider: "youcom"). The change applies live — no restart. Unsetting the key or selecting another provider reverts to native behavior.Usage example: with the provider selected,
web_searchresults carryprovider: youcom; when You.com fails a call, the fallback chain stampsnative (youcom fallback)on the rescued answer — the attribution behavior the tools already render for Tavily.Validation
go build ./...,go vet ./internal/...— clean.go test ./...— full suite passes.internal/search/youcom_test.gomirrortavily_test.go(stub HTTP server, no network): request shape (X-API-Key header, path, clamped count), result mapping including the snippets→snippet fallback, empty-URL dropping, page extraction with title derivation and null-markdown failure, 401 → "rejected", blank-key error, and provider stamping.internal/search/youcom_live_test.go, gated the same way as the native live tests:YDC_API_KEY=*** OGCODE_LIVE_SEARCH_TEST=1 go test ./internal/search/ -run TestLiveYoucom -v. I could not run it end-to-end here (no key on this machine), so the live path is verified by the stub tests plus the gated runner.YDC_API_KEYthat selection resolves to the native chain with a logged warning.Fallback/error handling: a missing key, rejected key, rate limit or network error all fall through to the native engine chain via the existing
NewFallbackBackend; errors are returned with a short capped body snippet and never abort the fallback.Happy to adjust the shape — e.g. storing the key in the settings surface like Tavily's, if you would rather keep both providers' credentials symmetrical than keep this one env-only.