fix(search): restore SearchGraph by migrating DuckDuckGo backend to ddgs#1083
Merged
Conversation
The 'duckduckgo-search' package was renamed to 'ddgs'. Recent langchain-community releases import 'from ddgs import DDGS' in their DuckDuckGoSearchResults tool, so with the old dependency installed the default SearchGraph path raised ImportError and returned no results (GH #1082). Replace the langchain-community DuckDuckGo wrapper with a direct ddgs call in research_web._search_duckduckgo, extracting result URLs from the structured 'href' field instead of regex-parsing a formatted string. Swap the 'duckduckgo-search' dependency for 'ddgs>=9.0.0'. Fixes #1082 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closed
Dependency ReviewThe following issues were found:
Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. License Issuesuv.lock
OpenSSF ScorecardScorecard details
Scanned Files
|
|
🎉 This PR is included in version 2.1.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1082 — SearchGraph (the "Search Scraper") stopped returning any results after a recent update, even for simple queries like
NVIDIA news, while other modules kept working.Root cause
The upstream
duckduckgo-searchpackage was renamed toddgs. Recentlangchain-communityreleases (we resolve0.4.1) now dofrom ddgs import DDGSinside theirDuckDuckGoSearchResultstool. Since the project still depended on the oldduckduckgo-searchpackage, instantiating that tool inresearch_web.search_on_webraised anImportError, so the default DuckDuckGo search path returned nothing and SearchGraph produced no answer.Changes
scrapegraphai/utils/research_web.py— replace thelangchain-communityDuckDuckGoSearchResultswrapper with a directddgs.DDGS().text()call in a new_search_duckduckgohelper. URLs are now read from the structuredhreffield instead of regex-parsing a formatted string, and proxy is passed through. A clearImportErrormessage is raised ifddgsis missing.pyproject.toml— swapduckduckgo-search>=8.1.1forddgs>=9.0.0.uv.lock— regenerated. Beyond the dependency swap,uvalso pruned stale lock entries (Sphinx/docs deps that were already removed frompyproject.tomlin an earlier commit and their transitives);uv lock --checkconfirms the lockfile is consistent withpyproject.toml.Testing
search_on_web(query="NVIDIA news", search_engine="duckduckgo")now returns URLs (previouslyImportError/empty).SearchGraph("NVIDIA news", ...)with an OpenAI model returns considered URLs and a structured answer.tests/test_search_graph.pypasses. (The pre-existingtest_omni_search_graph.pyfailures are unrelated —KeyError: 'model_provider'from thedummy-modelconfig not using the requiredprovider/modelformat.)🤖 Generated with Claude Code