Skip to content

feat: add Tavily search/extract backends to web module#1

Open
tavily-integrations wants to merge 1 commit intoZoranner:masterfrom
Tavily-FDE:feat/tavily-migration/web-tavily-search-backend
Open

feat: add Tavily search/extract backends to web module#1
tavily-integrations wants to merge 1 commit intoZoranner:masterfrom
Tavily-FDE:feat/tavily-migration/web-tavily-search-backend

Conversation

@tavily-integrations
Copy link
Copy Markdown

Summary

  • Added TavilySearchBackend and TavilyFetchBackend implementations in a new src/web/backends/tavily.rs module
  • TavilySearchBackend uses Tavily's POST /search endpoint to return web search results
  • TavilyFetchBackend uses Tavily's POST /extract endpoint for richer content extraction as an alternative to DirectFetchBackend
  • Both backends read TAVILY_API_KEY from the environment at call time
  • All new code is gated behind a tavily Cargo feature (which implies web)
  • DuckDuckGo remains the default; Tavily is opt-in via feature flag and WebContextBuilder

Files changed

  • Cargo.toml — Added tavily feature (depends on web), included in full
  • src/web/backends/tavily.rs — New file with both backend implementations
  • src/web/backends/mod.rs — Feature-gated module declaration and re-exports
  • src/web/mod.rs — Feature-gated re-exports of Tavily types

Dependency changes

  • No new crate dependencies; Tavily REST API is accessed via the existing reqwest dependency with JSON support

Environment variable changes

  • TAVILY_API_KEY — Required at runtime when using TavilySearchBackend or TavilyFetchBackend

Notes for reviewers

  • Uses raw reqwest JSON calls to the Tavily REST API rather than a dedicated Tavily crate, keeping the dependency tree minimal
  • Follows the same error handling patterns as the existing DuckDuckGo and DirectFetch backends
  • Consumers opt in with: WebContextBuilder::new().search(TavilySearchBackend).build()

🤖 Generated with Claude Code

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration implementation is correct and well-scoped. Both TavilySearchBackend (POST /search) and TavilyFetchBackend (POST /extract) properly implement the existing WebSearchBackend and WebFetchBackend traits with matching signatures. The tavily Cargo feature is correctly additive (enabling web), all four planned files are touched, feature-gating is consistently applied via #[cfg(feature = "tavily")], and DuckDuckGo remains completely untouched. Only minor issues were found — none block approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant