Skip to content

feat: add Tavily as a pluggable internet search backend#1332

Closed
ParakhJaggi wants to merge 2 commits intoMemTensor:dev-20260323-v2.0.11from
tavily-ai:feat/tavily-migration/memos-core-tavily-backend
Closed

feat: add Tavily as a pluggable internet search backend#1332
ParakhJaggi wants to merge 2 commits intoMemTensor:dev-20260323-v2.0.11from
tavily-ai:feat/tavily-migration/memos-core-tavily-backend

Conversation

@ParakhJaggi
Copy link

Summary

  • Added Tavily as a fifth pluggable backend in the InternetRetrieverFactory system, keeping BochaAI as the default
  • Created TavilySearchRetriever class using the tavily-python SDK, following the same retrieve_from_internet interface and TextualMemoryItem metadata schema as BochaAISearchRetriever
  • Registered TavilySearchConfig in InternetRetrieverConfigFactory.backend_to_class and wired instantiation in InternetRetrieverFactory.from_config()
  • Updated APIConfig.get_internet_config() to auto-select Tavily when TAVILY_API_KEY is set and BOCHA_API_KEY is absent
  • Added tavily-python as an optional dependency under a new tavily extra and in the all group
  • Added a Step 7 Tavily demo block to the internet search example, gated on TAVILY_API_KEY

Files changed

  • src/memos/memories/textual/tree_text_memory/retrieve/tavilysearch.py (new)
  • src/memos/configs/internet_retriever.py
  • src/memos/memories/textual/tree_text_memory/retrieve/internet_retriever_factory.py
  • src/memos/api/config.py
  • pyproject.toml
  • examples/basic_modules/textual_memory_internet_search_example.py

Dependency changes

  • Added tavily-python (>=0.5.0,<1.0.0) as optional dependency under new tavily extra
  • Added tavily-python to the all extras group

Environment variable changes

  • Added TAVILY_API_KEY — API key for Tavily Search (additive; existing BOCHA_API_KEY, GOOGLE_API_KEY, GOOGLE_SEARCH_ENGINE_ID unchanged)

Notes for reviewers

  • This is an additive change — no existing backends or code paths are modified
  • Backend selection priority: if TAVILY_API_KEY is set and BOCHA_API_KEY is not set, Tavily is used; otherwise BochaAI remains the default
  • The Tavily retriever uses search_depth="basic" for cost efficiency; can be changed to "advanced" for higher relevance

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The Tavily migration is well-implemented and follows existing patterns correctly. All six files from the plan are addressed. The TavilySearchRetriever correctly uses the tavily-python SDK (TavilyClient, response["results"] field access), mirrors the BochaAI retriever interface (retrieve_from_internet signature, TextualMemoryItem construction, metadata schema), and uses require_python_package for lazy dependency guarding. Config registration, factory wiring, dependency declarations, and the example are all properly done. Three minor issues were found — none block approval.

@CaralHsi CaralHsi changed the base branch from main to dev-20260323-v2.0.11 March 24, 2026 03:12
@tavily-ai tavily-ai closed this by deleting the head repository Mar 25, 2026
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