FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: add Tavily search backend to web search tool by tavily-integrations · Pull Request #11 · tta-lab/organon · GitHub

Repository navigation

feat: add Tavily search backend to web search tool - #11

Open
tavily-integrations wants to merge 1 commit into
tta-lab:mainfrom
Tavily-FDE:feat/tavily-migration/web-search-tavily
Open

tavily-integrations wants to merge 1 commit into
tta-lab:mainfrom
Tavily-FDE:feat/tavily-migration/web-search-tavily

Conversation

Copy link
Copy Markdown

Summary

  • Added Tavily as a configurable, highest-priority search backend alongside existing Exa, Brave, and DuckDuckGo backends
  • The priority chain is now: TAVILY_API_KEY → EXA_API_KEY → BRAVE_API_KEY → DuckDuckGo
  • Existing backends are fully preserved and unchanged

Files changed

  • internal/search/tavily.go (new) — TavilySearcher implementation using net/http POST to https://api.tavily.com/search, mapping results[].{title, url, content} to SearchResult
  • internal/search/search.go — Added TAVILY_API_KEY check as first priority in resolveSearcher() with empty-key guard
  • internal/search/search_test.go — Added tests for Tavily searcher (success, HTTP error), resolver priority (Tavily over Exa), empty key error; updated existing tests to unset TAVILY_API_KEY

Dependency changes

  • None — uses net/http from the Go stdlib

Environment variable changes

  • Added TAVILY_API_KEY — set to a Tavily API key to enable the Tavily backend (takes priority over all other backends when set)

Notes for reviewers

  • No new Go module dependencies required
  • Follows the exact same patterns as ExaSearcher and BraveSearcher (struct with apiKey/baseURL/client, test server override via unexported fields)
  • Go toolchain was not available in the build environment so tests could not be run locally; CI should validate

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration is well-implemented and correct. tavily.go follows the existing exa.go pattern closely: same struct layout, HTTP client setup, error wrapping style, and //nolint:errcheck usage. The Tavily REST API is called correctly — POST to /search with api_key in the JSON body, which matches Tavily's documented API contract. The resolveSearcher() priority insertion is clean and consistent. Tests are comprehensive, cover the happy path, HTTP errors, and resolver priority; existing tests are correctly guarded with unsetEnv(t, "TAVILY_API_KEY") to prevent interference. One minor test weakness noted but not blocking.

Copy link
Copy Markdown
Contributor

So sorry for the two-month delay – I just spotted this. I really need to sort out my email inbox. I'll review your contribution as soon as possible. Thank you so much for contributing!

birdmanmandbir self-requested a review June 6, 2026 05:44
birdmanmandbir added the enhancement New feature or request label Jun 6, 2026

Copy link
Copy Markdown
Contributor

@tavily-integrations can you fix these?
Fetched and reviewed Tavily-FDE/autopr--fork-organon branch feat/tavily-migration/web-search-tavily at 708c19e.

Findings

  1. Blocking: branch does not merge cleanly with current origin/main.
    internal/search/search.go and internal/search/search_test.go both conflict. Current main added provider-name plumbing via
    resolveSearchProvider() and searchWithProvider(); the Tavily branch was cut before that and adds Tavily directly inside
    resolveSearcher(). Rebase/update is needed before review can be merged safely.

  2. Blocking: Tavily auth appears wrong for the current official API.
    In /tmp/organon-tavily-review/internal/search/tavily.go:36, the API key is sent as JSON field api_key, and the request only sets
    Content-Type / Accept headers at /tmp/organon-tavily-review/internal/search/tavily.go:51. Tavily’s current docs show POST /search
    uses Authorization: Bearer tvly-.... This mocked test will pass, but real searches may return 401. The fix should put the key in
    Authorization: Bearer and remove api_key from the body unless Tavily confirms body auth is still supported.

Verification

CGO_ENABLED=0 go test ./internal/search passed on the branch.
CGO_ENABLED=0 go test ./... also passed on the branch’s own stale base.
Merge check against origin/main showed conflicts.

birdmanmandbir commented Jun 6, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

@tavily-integrations I pushed the fixes to origin/feat/tavily-migration/web-search-tavily-fixed. It rebases your Tavily change onto current main and fixes the Tavily auth header. You can cherry-pick from that branch.

Since I can’t push directly to your fork branch, so this should be the easiest way to pick up the changes. or I may merge this fixed branch instead while preserving your original commit authorship.

This branch has not been deployed

No deployments
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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL