diff --git a/promptulate/client/chat.py b/promptulate/client/chat.py index 84e6137e..59f1be68 100644 --- a/promptulate/client/chat.py +++ b/promptulate/client/chat.py @@ -34,7 +34,6 @@ DuckDuckGoTool, HumanFeedBackTool, PythonREPLTool, - SleepTool, ) from promptulate.tools.shell import ShellTool from promptulate.utils.color_print import print_text @@ -46,7 +45,6 @@ "WebSearch": DuckDuckGoTool, "Python Script Executor": PythonREPLTool, "Arxiv Query": ArxivQueryTool, - "Sleep": SleepTool, "Shell Executor": ShellTool, "HumanFeedBackTool": HumanFeedBackTool, } @@ -173,6 +171,8 @@ def chat(): llm = ChatOpenAI(model=model, temperature=0.0) elif "ernie" in model: llm = ErnieBot(model=model, temperature=0.1) + else: + raise ValueError(f"model {model} is not supported.") if terminal_mode == "Simple Chat": simple_chat(llm) diff --git a/promptulate/tools/duckduckgo/tools.py b/promptulate/tools/duckduckgo/tools.py index 7c75061f..62a5fdd2 100644 --- a/promptulate/tools/duckduckgo/tools.py +++ b/promptulate/tools/duckduckgo/tools.py @@ -1,5 +1,5 @@ import time -from typing import Dict, List, Union +from typing import Dict, List, Optional, Union from promptulate.tools.base import Tool from promptulate.tools.duckduckgo.api_wrapper import DuckDuckGoSearchAPIWrapper @@ -16,8 +16,12 @@ class DuckDuckGoTool(Tool): "Args : keyword(str)" "Input should be a search query." ) - api_wrapper: DuckDuckGoSearchAPIWrapper = DuckDuckGoSearchAPIWrapper() - max_retry: int = 5 + + def __init__(self, max_retry: Optional[int] = None, *args, **kwargs): + super().__init__(*args, **kwargs) + + self.max_retry: int = max_retry or 5 + self.api_wrapper = DuckDuckGoSearchAPIWrapper() def _run(self, keyword: str, **kwargs) -> Union[str, List[str]]: """Run duckduckgo search and get search result. diff --git a/pyproject.toml b/pyproject.toml index c6c1d74f..f76f9892 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ description = "A powerful LLM Application development framework." name = "promptulate" readme = "README.md" repository = "https://github.com/Undertone0809/promptulate" -version = "1.15.1" +version = "1.15.2" keywords = [ "promptulate", "pne",