Skip to content

feat: add Tavily as configurable search provider alongside DuckDuckGo - #1

Open
tavily-integrations wants to merge 1 commit into
klsdfernando:mainfrom
Tavily-FDE:feat/tavily-migration/cli-duckduckgo-additive-tavily
Open

tavily-integrations wants to merge 1 commit into
klsdfernando:mainfrom
Tavily-FDE:feat/tavily-migration/cli-duckduckgo-additive-tavily

Conversation

@tavily-integrations

Copy link
Copy Markdown

Summary

Adds Tavily as an optional, configurable search provider alongside the existing DuckDuckGo HTML scraping implementation. This is an additive change — DuckDuckGo remains the default and all existing functionality is preserved.

What changed

  • requirements.txt — Added tavily-python dependency
  • search.py — Added search_web_tavily() function using TavilyClient and a search_web_provider() dispatcher that routes to either DuckDuckGo or Tavily based on the provider argument. Both return the same (formatted_str, urls_list) tuple shape.
  • main.py — Added --provider CLI argument (duckduckgo | tavily, default: duckduckgo), reads TAVILY_API_KEY from environment when Tavily is selected, and routes the search call through the new dispatcher.

Usage

# Default (DuckDuckGo, unchanged behavior)
python main.py --web

# Use Tavily
TAVILY_API_KEY=tvly-xxx python main.py --web --provider tavily

Dependency changes

  • Added tavily-python to requirements.txt

Environment variable changes

  • Added TAVILY_API_KEY (required only when --provider=tavily)

Notes for reviewers

  • The existing DuckDuckGo code path is completely untouched
  • Both providers return the same tuple shape so the rest of the pipeline is unaffected
  • TAVILY_API_KEY is validated at startup with a clear error message if missing

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration is a clean additive implementation. All three files (requirements.txt, search.py, main.py) are correctly updated. The Tavily SDK patterns are valid, DuckDuckGo remains the default and is fully preserved, and the API key is validated eagerly at startup. No critical or major issues found — only minor style and documentation concerns.

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