feat: add Tavily as a web search engine option#2218
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 fifth selectable web search engine in the
web_searchtool, alongside the existing DuckDuckGo, Bing, Google, and Baidu engines. This is an additive change — all existing engines remain unchanged.Tavily Search API is called via raw HTTP POST (same pattern as Google/Baidu), so no new Go module dependencies are needed. The API key is stored in the tool's
clientSecretdatabase field, consistent with existing engines.Changes
Backend (
tool/web_search.go)webSearchEngineTavilyconstant andtavilySearchEndpointURLtavilySearchRequestandtavilySearchResponsestructsrunTavilySearchandparseTavilySearchResponsefunctionsparseWebSearchEngineswitch to handle"Tavily"subtyperunWebSearchswitch to dispatch to Tavily engineFrontend
web/src/Setting.js: Added{id: 'Tavily', name: 'Tavily'}toweb_searchsubtype optionsweb/src/ToolEditPage.js: ExtendedshouldShowClientSecretInputto show API key field when subType is"Tavily"web/src/locales/en/data.json: Added"Tavily API Key"and tooltip stringweb/src/locales/zh/data.json: Added Chinese translations for Tavily tooltipSeed Data (
object/init.go)web_search_tavilytool record so admins see Tavily in the tool list and only need to supply their API key to activate itDependency changes
net/httpclient pattern)Environment variable changes
clientSecretDB field (not a process env var), obtained from https://app.tavily.comNotes for reviewers
https://api.tavily.com/searchwith{api_key, query, max_results}in the JSON bodywebSearchResultstructAutomated Review
runTavilySearch, and extends both switch statements following the same structure as the Baidu provider. The frontend adds the subtype dropdown entry, clientSecret visibility, and locale strings. The seed record ininit.gois correctly inactive. One minor issue: two i18n locale keys ("Tavily API Key" and "Tavily API Key - Tooltip") are added but never referenced in any JS component —getClientSecretLabeluses the generic"provider:API key"label for all web_search types, making the new strings dead code.