feat: add Tavily as configurable search backend alongside TinyFish - #2
Open
tavily-integrations wants to merge 2 commits into
Conversation
added 2 commits
May 13, 2026 14:53
… search backend alongside TinyFish
Owner
|
@tavily-integrations thanks for contribution, please rebase the branch with main :) |
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 Tavily as an opt-in, configurable search backend alongside the existing TinyFish provider. When
TAVILY_API_KEYis set (orSEARCH_PROVIDER=tavily), the service uses Tavily; otherwise it falls back to TinyFish. No existing code is removed.Changes
internal/search/tinyfish.go— RenamedSearch()toSearchTinyFish()so the dispatcher can call providers by name.internal/search/tavily.go(new) — ImplementsSearchTavily()using Tavily's REST API (POST https://api.tavily.com/search), mapping response fields to the existingResultstruct.internal/search/provider.go(new) — Top-levelSearch()dispatcher that readsSEARCH_PROVIDERenv var (tavily|tinyfish) and auto-detects based onTAVILY_API_KEYpresence when unset.cmd/wr/main.go— AddedTAVILY_API_KEYandSEARCH_PROVIDERtocmdSetup()checks andusage()text.Dependency Changes
net/http(same pattern as TinyFish).Environment Variable Changes
TAVILY_API_KEY— Tavily API key (https://app.tavily.com)SEARCH_PROVIDER— Optional selector:tavilyortinyfish(auto-detected if omitted)Notes for Reviewers
internal/research/service.gocallssearch.Search()which now routes through the new dispatcher — no changes needed there.cmd/wr-mcp/main.go) inherits the new capability transitively.Automated Review
cmdSetup()now requires at least one of TINYFISH_API_KEY or TAVILY_API_KEY, (2) the usage string is updated to "provider auto-detected", (3)http.StatusOKreplaces the magic 200, and (4) the unusedScorefield is removed. The newprovider.godispatcher cleanly routes through the existingsearch.Searchcall surface, so bothcmd/wrandcmd/wr-mcp(which go throughresearch.Service) work without changes. No new external dependencies are needed since the Tavily client uses only stdlib. No regressions detected.