Skip to content

feat: migrate code-search modules to include Tavily as parallel source#4

Open
tavily-integrations wants to merge 1 commit into
gonicolas12:mainfrom
Tavily-FDE:feat/tavily-migration/code-search-modules
Open

feat: migrate code-search modules to include Tavily as parallel source#4
tavily-integrations wants to merge 1 commit into
gonicolas12:mainfrom
Tavily-FDE:feat/tavily-migration/code-search-modules

Conversation

@tavily-integrations

Copy link
Copy Markdown

Summary

  • Added Tavily as an additive, parallel search provider to the three code-search modules (smart_code_searcher.py, smart_web_searcher.py, real_web_code_generator.py)
  • Created a shared tavily_search() async helper in core/shared.py to avoid duplicating SDK calls across modules
  • Tavily searches run concurrently with existing sources (DuckDuckGo HTML, GitHub API, Google scraping) and results are merged
  • All changes are guarded by TAVILY_API_KEY availability — existing behavior is fully preserved when the key is not set

Files changed

  • core/shared.py — Added tavily_search() helper and is_tavily_available() check
  • models/smart_code_searcher.py — Added _search_tavily() coroutine, runs in parallel with DuckDuckGo
  • models/smart_web_searcher.py — Added _search_tavily() method alongside GitHub/SO/GeeksforGeeks
  • models/real_web_code_generator.py — Added _search_tavily() method to parallel task list
  • requirements.txt — Added tavily-python>=0.5.0

Dependency changes

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

Environment variable changes

  • Requires TAVILY_API_KEY to enable Tavily searches (optional — existing providers still work without it)

Notes for reviewers

  • The Tavily SDK's search() is synchronous; we use asyncio.to_thread() to keep the async flow non-blocking
  • Tavily is only invoked when TAVILY_API_KEY is present in the environment
  • All existing scraping/API paths remain intact as primary sources

🤖 Generated with Claude Code

Automated Review

  • Passed after 1 attempt(s)
  • Final review: The migration is correct and complete. A shared async tavily_search() helper is added to core/shared.py and wired into all three code-search modules as an additive, parallel source guarded by is_tavily_available(). The Tavily SDK patterns are valid (TavilyClient() auto-reads TAVILY_API_KEY from the environment, asyncio.to_thread correctly bridges the sync SDK), dict key shapes are consistent across sources, and existing behaviour is fully preserved when the key is absent. Only minor issues were found, none of which 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