diff --git a/__init__.py b/__init__.py index 09e59c3..4d1fe5e 100644 --- a/__init__.py +++ b/__init__.py @@ -27,14 +27,6 @@ from .nodes.config.lmstudio_config import gtUILMStudioStructureConfig from .nodes.config.ollama_config import gtUIOllamaStructureConfig from .nodes.config.openai_compatible_config import gtUIOpenAiCompatibleConfig from .nodes.config.openai_config import gtUIOpenAiStructureConfig - -# from .nodes.config.config_nodes import ( -# # gtUIEnv, -# # gtUIGoogleStructureConfig, -# # gtUILMStudioStructureConfig, -# # gtUIOllamaStructureConfig, -# # gtUIOpenAiStructureConfig, -# ) from .nodes.display_nodes import ( # gtUIOutputArtifactNode, gtUIOutputDataNode, diff --git a/nodes/duckduckgo_client/__init__.py b/nodes/duckduckgo_client/__init__.py deleted file mode 100644 index c35025f..0000000 --- a/nodes/duckduckgo_client/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .tool import DuckDuckGoTool - -__all__ = ["DuckDuckGoTool"] diff --git a/nodes/duckduckgo_client/manifest.yml b/nodes/duckduckgo_client/manifest.yml deleted file mode 100644 index 3d4a083..0000000 --- a/nodes/duckduckgo_client/manifest.yml +++ /dev/null @@ -1,5 +0,0 @@ -version: "v1" -name: Duck Duck Go Client -description: client for duckduckgo search engine -contact_email: hello@griptape.ai -legal_info_url: https://www.example.com/legal diff --git a/nodes/duckduckgo_client/requirements.txt b/nodes/duckduckgo_client/requirements.txt deleted file mode 100644 index 83ca02f..0000000 --- a/nodes/duckduckgo_client/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -duckduckgo_search -griptape -python_dotenv \ No newline at end of file diff --git a/nodes/duckduckgo_client/tool.py b/nodes/duckduckgo_client/tool.py deleted file mode 100644 index 205fc46..0000000 --- a/nodes/duckduckgo_client/tool.py +++ /dev/null @@ -1,96 +0,0 @@ -from __future__ import annotations - -import schema -from attr import define -from duckduckgo_search import DDGS -from griptape.artifacts import ErrorArtifact, ListArtifact, TextArtifact -from griptape.tools import BaseTool -from griptape.utils.decorators import activity -from schema import Literal, Schema - - -@define -class DuckDuckGoTool(BaseTool): - @activity( - config={ - "description": "Can be used to perform a text search on DuckDuckGo", - "schema": Schema( - { - Literal("keywords", description="The keywords to search for"): str, - schema.Optional( - "max_results", - default=None, - description="The maximum number of results to return", - ): int, - schema.Optional( - "region", - default="wt-wt", - description="The region to search in (wt-wt, us-en, uk-en, ru-ru, etc)", - ): str, - schema.Optional( - "safe_search", - default="moderate", - description="The safe search level to use (on, moderate, off)", - ): str, - schema.Optional( - "timelimit", - default=None, - description="The time limit for the search (d, w, m, y)", - ): str, - schema.Optional( - "backend", - default="api", - description="The backend to use for the search (api, html, lite)", - ): str, - }, - ), - } - ) - def text(self, params: dict) -> ListArtifact | ErrorArtifact: - keyword_value = params["values"].get("keywords") - max_results = params["values"].get("max_results") - region = params["values"].get("region") - safe_search = params["values"].get("safe_search") - timelimit = params["values"].get("timelimit") - backend = params["values"].get("backend") - - # Initialize a dictionary with the keyword argument - params = {} - - # Add parameters to the dictionary only if they are not None - if max_results is not None: - params["max_results"] = max_results - if region is not None: - params["region"] = region - if safe_search is not None: - params["safe_search"] = safe_search - if timelimit is not None: - params["timelimit"] = timelimit - if backend is not None: - params["backend"] = backend - try: - results = DDGS().text(keyword_value, **params) - return ListArtifact([TextArtifact(result) for result in results]) - - except Exception as e: - return ErrorArtifact(str(e)) - - @activity( - config={ - "description": "Can be used to get instant answers from DuckDuckGo", - "schema": Schema( - { - Literal("keywords", description="The keywords to search for"): str, - }, - ), - } - ) - def answers(self, params: dict) -> ListArtifact | ErrorArtifact: - keyword_value = params["values"].get("keywords") - - try: - results = DDGS().answers(keyword_value) - return ListArtifact([TextArtifact(result) for result in results]) - - except Exception as e: - return ErrorArtifact(str(e))