Skip to content

feat: add Tavily as configurable search provider in web_search#1

Open
mani2001 wants to merge 3 commits into
Tyrannosaurusss:mainfrom
mani2001:feat/tavily-migration/code-edith-web-search
Open

feat: add Tavily as configurable search provider in web_search#1
mani2001 wants to merge 3 commits into
Tyrannosaurusss:mainfrom
mani2001:feat/tavily-migration/code-edith-web-search

Conversation

@mani2001

Copy link
Copy Markdown

Summary

  • Added Tavily as an optional search backend in bin/tool/web_search.py, selectable via the SEARCH_PROVIDER environment variable
  • Existing DuckDuckGo (ddgs) implementation remains the default and is unchanged
  • Setting SEARCH_PROVIDER=tavily routes queries through TavilyClient, which requires TAVILY_API_KEY to be set
  • Tavily results are formatted to match the existing Source: <url>\n<body> output format, so no changes to the tool dispatch layer are needed

Files changed

  • bin/tool/web_search.py — Added _search_ddgs() and _search_tavily() helper functions; web_search() now reads SEARCH_PROVIDER env var to select backend
  • requirements.txt — Added tavily-python
  • pyproject.toml — Added tavily-python to project dependencies

Dependency changes

  • Added tavily-python (existing ddgs==9.10.0 kept)

Environment variable changes

  • SEARCH_PROVIDER (optional, values: ddgs | tavily, defaults to ddgs)
  • TAVILY_API_KEY (required when SEARCH_PROVIDER=tavily)

Notes for reviewers

  • The web_search(query) -> str function signature is unchanged, so bin/chat.py and tools.json require no modifications
  • Tavily import is deferred inside _search_tavily() to avoid import errors when tavily-python is not installed and ddgs is used

🤖 Generated with Claude Code

Automated Review

  • Passed after 2 attempt(s)
  • Final review: The Tavily migration is well-implemented and addresses all three previously flagged issues. tavily-python==0.7.23 is correctly pinned in both requirements.txt and pyproject.toml, matching the existing pinning convention. The README documentation is clear and accurate. The web_search.py implementation is correct: TavilyClient() without an explicit key is the recommended pattern (reads TAVILY_API_KEY from env), the Tavily response fields (r['url'], r['content']) are valid, the lazy import avoids ImportError when Tavily is not selected, and DuckDuckGo remains the default with no regression. No unrelated files were touched.

@Tyrannosaurusss Tyrannosaurusss force-pushed the main branch 27 times, most recently from 797c6fb to e5de67e Compare March 26, 2026 04:06
@Tyrannosaurusss Tyrannosaurusss force-pushed the main branch 30 times, most recently from 753266c to f9064f9 Compare March 31, 2026 23:01
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.

2 participants