feat(tools): prioritize tavily as first search provider
Reorder web search priority from Perplexity > Brave > Tavily > DuckDuckGo to Tavily > Perplexity > Brave > DuckDuckGo. Add Tavily configuration entry to config.example.json for discoverability.
This commit is contained in:
parent
e1bf24e874
commit
ef7cdde43c
2 changed files with 15 additions and 10 deletions
|
|
@ -214,6 +214,11 @@
|
|||
"enabled": true,
|
||||
"max_results": 5
|
||||
},
|
||||
"tavily": {
|
||||
"enabled": false,
|
||||
"api_key": "tvly-YOUR_TAVILY_API_KEY",
|
||||
"max_results": 5
|
||||
},
|
||||
"perplexity": {
|
||||
"enabled": false,
|
||||
"api_key": "pplx-xxx",
|
||||
|
|
|
|||
|
|
@ -354,8 +354,16 @@ func NewWebSearchTool(opts WebSearchToolOptions) *WebSearchTool {
|
|||
var provider SearchProvider
|
||||
maxResults := 5
|
||||
|
||||
// Priority: Perplexity > Brave > Tavily > DuckDuckGo
|
||||
if opts.PerplexityEnabled && opts.PerplexityAPIKey != "" {
|
||||
// Priority: Tavily > Perplexity > Brave > DuckDuckGo
|
||||
if opts.TavilyEnabled && opts.TavilyAPIKey != "" {
|
||||
provider = &TavilySearchProvider{
|
||||
apiKey: opts.TavilyAPIKey,
|
||||
baseURL: opts.TavilyBaseURL,
|
||||
}
|
||||
if opts.TavilyMaxResults > 0 {
|
||||
maxResults = opts.TavilyMaxResults
|
||||
}
|
||||
} else if opts.PerplexityEnabled && opts.PerplexityAPIKey != "" {
|
||||
provider = &PerplexitySearchProvider{apiKey: opts.PerplexityAPIKey}
|
||||
if opts.PerplexityMaxResults > 0 {
|
||||
maxResults = opts.PerplexityMaxResults
|
||||
|
|
@ -365,14 +373,6 @@ func NewWebSearchTool(opts WebSearchToolOptions) *WebSearchTool {
|
|||
if opts.BraveMaxResults > 0 {
|
||||
maxResults = opts.BraveMaxResults
|
||||
}
|
||||
} else if opts.TavilyEnabled && opts.TavilyAPIKey != "" {
|
||||
provider = &TavilySearchProvider{
|
||||
apiKey: opts.TavilyAPIKey,
|
||||
baseURL: opts.TavilyBaseURL,
|
||||
}
|
||||
if opts.TavilyMaxResults > 0 {
|
||||
maxResults = opts.TavilyMaxResults
|
||||
}
|
||||
} else if opts.DuckDuckGoEnabled {
|
||||
provider = &DuckDuckGoSearchProvider{}
|
||||
if opts.DuckDuckGoMaxResults > 0 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue