Skip to content

feat: add Tavily as configurable internet search backend#1357

Open
Tavily-FDE-Bot wants to merge 1 commit intoMemTensor:mainfrom
Tavily-FDE-Bot:feat/tavily-migration/core-tavily-retriever
Open

feat: add Tavily as configurable internet search backend#1357
Tavily-FDE-Bot wants to merge 1 commit intoMemTensor:mainfrom
Tavily-FDE-Bot:feat/tavily-migration/core-tavily-retriever

Conversation

@Tavily-FDE-Bot
Copy link

Summary

  • Added Tavily as a new internet search backend option alongside existing BochaAI, Google, Bing, and Xinyu providers
  • Uses the additive/parallel strategy: existing providers are fully preserved, Tavily is opt-in via configuration
  • Backend selection controlled by INTERNET_SEARCH_BACKEND env var (defaults to bocha)

Files Changed

  • src/memos/configs/internet_retriever.py — Added TavilySearchConfig dataclass and registered 'tavily' in InternetRetrieverConfigFactory.backend_to_class
  • src/memos/memories/textual/tree_text_memory/retrieve/tavilysearch.pyNew file: InternetTavilyRetriever implementation using tavily-python SDK, mirroring bochasearch.py patterns
  • src/memos/memories/textual/tree_text_memory/retrieve/internet_retriever_factory.py — Registered 'tavily' in backend_to_class and added instantiation logic in from_config()
  • src/memos/api/config.py — Updated get_internet_config() to support 'tavily' backend via INTERNET_SEARCH_BACKEND env var
  • pyproject.toml — Added tavily-python as optional dependency under [tavily] extra and in [all]
  • docker/requirements.txt — Added tavily-python==0.5.0
  • docker/requirements-full.txt — Added tavily-python==0.5.0
  • docker/.env.example — Documented INTERNET_SEARCH_BACKEND and TAVILY_API_KEY
  • apps/memos-local-openclaw/.env.example — Documented TAVILY_API_KEY
  • examples/basic_modules/textual_memory_internet_search_example.py — Added Tavily example block

Dependency Changes

  • Added tavily-python (>=0.5.0,<1.0.0) to pyproject.toml optional extras ([tavily] and [all])
  • Added tavily-python==0.5.0 to docker/requirements.txt
  • Added tavily-python==0.5.0 to docker/requirements-full.txt

Environment Variable Changes

  • Added INTERNET_SEARCH_BACKEND (default: bocha) to select the search backend
  • Added TAVILY_API_KEY — required when INTERNET_SEARCH_BACKEND=tavily
  • Added TAVILY_SEARCH_DEPTH (optional, default: basic)
  • Added TAVILY_INCLUDE_ANSWER (optional, default: false)

Notes for Reviewers

  • No existing providers are modified or removed — this is purely additive
  • The Tavily retriever does not use a MemReader for chunking (unlike Bocha); it relies on Tavily's pre-extracted content snippets
  • The require_python_package decorator ensures tavily-python and jieba are installed at runtime

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration is a clean, additive implementation that correctly integrates the tavily-python SDK alongside existing search backends. The TavilySearchConfig, InternetTavilyRetriever, factory registration, API config routing, and dependency files are all properly updated. SDK usage is correct (TavilyClient init, .search() parameters). No regressions introduced to existing backends. Four minor issues noted but 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