feat: add Tavily as parallel search provider alongside SearXNG#10
Open
tavily-integrations wants to merge 1 commit into
Open
Conversation
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 a configurable, additive search provider in the search API route. When
TAVILY_API_KEYis set, Tavily is used as the primary search source; if it returns no useful results, the existing SearXNG pipeline is used as a fallback. When the env var is absent, behavior is completely unchanged (SearXNG only).What changed
src/app/api/search/route.ts: AddedsearchTavily()function that calls the Tavily REST API viafetch(edge-runtime compatible) and maps results to the existingSearchResultinterface. ModifiedwebSearch()to use Tavily as primary whenTAVILY_API_KEYis present, with automatic SearXNG fallback.package.json: Added@tavily/coreas a runtime dependency.README.md: DocumentedTAVILY_API_KEYenv var in the environment setup section.Files changed
src/app/api/search/route.tspackage.jsonREADME.mdDependency changes
@tavily/core^0.6.1 topackage.jsondependenciesEnvironment variable changes
TAVILY_API_KEY— enables Tavily as primary search provider when presentNotes for reviewers
fetchrather than through the@tavily/coreSDK to ensure edge runtime compatibility (export const runtime = 'edge').topicparameter mapsisCurrentEventsto Tavily's "news" topic for better results on current events queries.Automated Review
fetchagainst the Tavily REST API for edge runtime compatibility (the route exportsruntime = 'edge'), the fallback logic to SearXNG is sound, and existing SearXNG-only behavior is completely unchanged whenTAVILY_API_KEYis absent. The main concern is that@tavily/corewas added topackage.jsonbut is never imported — the implementation explicitly chosefetchover the SDK for edge compatibility, making the SDK dependency dead weight. This is worth cleaning up but doesn't cause any runtime failure or regression since Next.js only restricts what is imported, not what exists in node_modules. The package-lock.json changes also include cosmetic"peer": trueflag removals unrelated to Tavily, which are harmless lock-file normalization artifacts from runningnpm install.