Skip to content

feat: add Tavily search as top-priority provider in internet search#1

Open
mani2001 wants to merge 1 commit into
gonicolas12:mainfrom
mani2001:feat/tavily-migration/main-internet-search
Open

feat: add Tavily search as top-priority provider in internet search#1
mani2001 wants to merge 1 commit into
gonicolas12:mainfrom
mani2001:feat/tavily-migration/main-internet-search

Conversation

@mani2001

Copy link
Copy Markdown

Summary

  • Adds Tavily as a configurable, top-priority search source in EnhancedInternetSearchEngine
  • When TAVILY_API_KEY is set in the environment, Tavily is tried first via _search_tavily()
  • Falls back to the existing DuckDuckGo → Cloudscraper → SearXNG → Requests → Google → Brave → Wikipedia chain if Tavily is unavailable or returns no results
  • Existing behavior is completely unchanged when TAVILY_API_KEY is not set

Files changed

  • models/internet_search.py — Added import os, Tavily client import (guarded), _search_tavily() method, and prepended it to the search methods priority list in _perform_search()
  • config.yaml — Added tavily: configuration section with api_key, enabled, and max_results
  • requirements.txt — Added tavily-python>=0.5.0 to the RÉSEAU & WEB block

Dependency changes

  • Added tavily-python>=0.5.0 to requirements.txt

Environment variable changes

  • Added TAVILY_API_KEY — required to enable Tavily search (optional; system works without it)

Notes for reviewers

  • This is an additive change — no existing provider code was modified or removed
  • The Tavily import is wrapped in a try/except so the module loads fine without tavily-python installed
  • _search_tavily() returns early with [] if the API key is missing or the library is unavailable, ensuring zero impact on the existing fallback chain

🤖 Generated with Claude Code

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration is functionally correct and additive. SDK usage patterns (import, client construction, search call, response parsing) are all valid for tavily-python>=0.5.0. The fallback chain is fully preserved — Tavily returns [] when the key is missing or the library is unavailable, so no regressions exist. Two minor issues: (1) the config.yaml tavily section is never actually read by the code, making its enabled, max_results, and api_key fields decorative rather than functional; (2) TavilyClient is re-instantiated on every search call instead of once at init. Neither issue blocks 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