Skip to content

Commit

Permalink
Merge pull request #595 from Undertone0809/v1.15.2/fix-ddg-depc-in-we…
Browse files Browse the repository at this point in the history
…bagent

fix: ddg depc error in webagent
  • Loading branch information
Undertone0809 authored Apr 21, 2024
2 parents 6144a8c + f7f1632 commit 24903a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions promptulate/client/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
DuckDuckGoTool,
HumanFeedBackTool,
PythonREPLTool,
SleepTool,
)
from promptulate.tools.shell import ShellTool
from promptulate.utils.color_print import print_text
Expand All @@ -46,7 +45,6 @@
"WebSearch": DuckDuckGoTool,
"Python Script Executor": PythonREPLTool,
"Arxiv Query": ArxivQueryTool,
"Sleep": SleepTool,
"Shell Executor": ShellTool,
"HumanFeedBackTool": HumanFeedBackTool,
}
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 7 additions & 3 deletions promptulate/tools/duckduckgo/tools.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 24903a2

Please sign in to comment.