diff --git a/CHANGELOG.md b/CHANGELOG.md index b207c1e6a..48013f3a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Parsing `ActionCallDeltaMessageContent`s with empty string `partial_input`s. - `Stream` util not properly propagating thread contextvars. +### Deprecated + +- `DuckDuckGoWebSearchDriver`. `DuckDuckGoWebSearchDriver` relies on `duckduckgo_search` which is no longer maintained and has been archived. + ## [1.0.0] - 2024-12-09 ### Added diff --git a/docs/griptape-framework/drivers/web-search-drivers.md b/docs/griptape-framework/drivers/web-search-drivers.md index 6e950dba0..7408973f3 100644 --- a/docs/griptape-framework/drivers/web-search-drivers.md +++ b/docs/griptape-framework/drivers/web-search-drivers.md @@ -63,19 +63,6 @@ Example using `GoogleWebSearchDriver` directly: --8<-- "docs/griptape-framework/drivers/src/web_search_drivers_1.py" ``` -### DuckDuckGo - -!!! info - This driver requires the `drivers-web-search-duckduckgo` [extra](../index.md#extras). - -The [DuckDuckGoWebSearchDriver](../../reference/griptape/drivers/web_search/duck_duck_go_web_search_driver.md) uses the [duckduckgo_search](https://github.com/deedy5/duckduckgo_search) SDK for web searching. - -Example of using `DuckDuckGoWebSearchDriver` directly: - -```python ---8<-- "docs/griptape-framework/drivers/src/web_search_drivers_3.py" -``` - ### Tavily !!! info @@ -98,3 +85,14 @@ Example of using `ExaWebSearchDriver` directly: ```python --8<-- "docs/griptape-framework/drivers/src/web_search_drivers_6.py" ``` + +### DuckDuckGo + +!!! warning + `DuckDuckGoWebSearchDriver` is deprecated and will be removed in a future release. + `DuckDuckGoWebSearchDriver` relies on `duckduckgo_search` which is no longer maintained and has been archived. + +!!! info + This driver requires the `drivers-web-search-duckduckgo` [extra](../index.md#extras). + +The [DuckDuckGoWebSearchDriver](../../reference/griptape/drivers/web_search/duck_duck_go_web_search_driver.md) uses the [duckduckgo_search](https://github.com/deedy5/duckduckgo_search) SDK for web searching. diff --git a/griptape/drivers/web_search/duck_duck_go_web_search_driver.py b/griptape/drivers/web_search/duck_duck_go_web_search_driver.py index 113ca5a8a..bc16036a0 100644 --- a/griptape/drivers/web_search/duck_duck_go_web_search_driver.py +++ b/griptape/drivers/web_search/duck_duck_go_web_search_driver.py @@ -1,6 +1,7 @@ from __future__ import annotations import json +import warnings from typing import TYPE_CHECKING from attrs import define, field @@ -25,6 +26,13 @@ def client(self) -> DDGS: return import_optional_dependency("duckduckgo_search").DDGS() def search(self, query: str, **kwargs) -> ListArtifact: + warnings.warn( + "`DuckDuckGoWebSearchDriver` is deprecated and will be removed in a future release. " + "`DuckDuckGoWebSearchDriver` relies on `duckduckgo_search` which is no longer maintained and has been archived.", + DeprecationWarning, + stacklevel=2, + ) + try: results = self.client.text( query, region=f"{self.language}-{self.country}", max_results=self.results_count, **kwargs diff --git a/tests/unit/drivers/web_search/test_duck_duck_go_web_search_driver.py b/tests/unit/drivers/web_search/test_duck_duck_go_web_search_driver.py index be79798ba..f4dedafc9 100644 --- a/tests/unit/drivers/web_search/test_duck_duck_go_web_search_driver.py +++ b/tests/unit/drivers/web_search/test_duck_duck_go_web_search_driver.py @@ -43,3 +43,7 @@ def test_search_returns_results(self, driver): def test_search_raises_error(self, driver_with_error): with pytest.raises(Exception, match="Error searching 'test' with DuckDuckGo: test_error"): driver_with_error.search("test") + + def test_search_deprecation_warning(self, driver): + with pytest.warns(DeprecationWarning): + driver.search("test")