Skip to content

Commit

Permalink
Merge pull request #146 from Undertone0809/v1.9.1/fix-error-in-webagent
Browse files Browse the repository at this point in the history
fix: error in webagent
  • Loading branch information
Undertone0809 authored Nov 16, 2023
2 parents 839fe34 + d6413e2 commit 65c146a
Show file tree
Hide file tree
Showing 7 changed files with 3,201 additions and 3,196 deletions.
6,251 changes: 3,125 additions & 3,126 deletions poetry.lock

Large diffs are not rendered by default.

Empty file removed promptulate/agents/auto_agent.py
Empty file.
14 changes: 10 additions & 4 deletions promptulate/agents/web_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@ def _run(self, prompt: str, *args, **kwargs) -> str:

# Loop search until find the answer
while True:
answer: str = self.llm(self.conversation_prompt, stop=self.stop_sequences)
llm_output: str = self.llm(
self.conversation_prompt, stop=self.stop_sequences
)
logger.info(
f"[pne] tool agent <{iterations}> current prompt: {self.conversation_prompt}"
)

if "Final Answer" in answer:
return answer.split("Final Answer:")[-1]
if "Final Answer" in llm_output:
return llm_output.split("Final Answer:")[-1]

self.conversation_prompt += llm_output

query_words: str = self._find_query_words(answer)
# get keywords and query by websearch
query_words: str = self._find_query_words(llm_output)
Hook.call_hook(
HookTable.ON_AGENT_ACTION,
self,
Expand All @@ -66,6 +71,7 @@ def _run(self, prompt: str, *args, **kwargs) -> str:
Hook.call_hook(
HookTable.ON_AGENT_OBSERVATION, self, observation=query_result
)

self.conversation_prompt += f"Observation: {query_result}\nThought: "
iterations += 1

Expand Down
2 changes: 1 addition & 1 deletion promptulate/agents/web_agent/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
After the user enters a question, you need to generate keywords for web search,
and then summarize until you think you can answer the user's answer.
Use the following format:
Your output format is as follows:
Question: the input question you must answer
Thought: The next you should do
Query: web search query words
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "promptulate"
version = "1.9.0"
version = "1.9.1"
description = "A powerful LLM Application development framework."
authors = ["Zeeland <zeeland@foxmail.com>"]
authors = ["Zeeland <zeeland4work@gmail.com>"]
readme = "README.md"
repository = "https://github.com/Undertone0809/promptulate"

Expand Down
124 changes: 62 additions & 62 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
--index-url https://pypi.tuna.tsinghua.edu.cn/simple

aiofiles==23.2.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiohttp==3.8.6 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiosignal==1.3.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
anyio==4.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
appdirs==1.4.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
arxiv==1.4.8 ; python_full_version >= "3.8.1" and python_version < "4.0"
async-timeout==4.0.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
attrs==23.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
broadcast-service==1.3.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
brotli==1.1.0 ; platform_python_implementation == "CPython" and python_full_version >= "3.8.1" and python_version < "4.0"
brotlicffi==1.1.0.0 ; platform_python_implementation != "CPython" and python_full_version >= "3.8.1" and python_version < "4.0"
certifi==2023.7.22 ; python_full_version >= "3.8.1" and python_version < "4.0"
cffi==1.16.0 ; platform_python_implementation != "CPython" and python_full_version >= "3.8.1" and python_version < "4.0"
charset-normalizer==3.3.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
click==8.1.7 ; python_full_version >= "3.8.1" and python_version < "4.0"
colorama==0.4.6 ; python_full_version >= "3.8.1" and python_version < "4.0" and platform_system == "Windows"
cushy-storage==1.2.5 ; python_full_version >= "3.8.1" and python_version < "4.0"
duckduckgo-search==3.9.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
exceptiongroup==1.1.3 ; python_full_version >= "3.8.1" and python_version < "3.11"
feedparser==6.0.10 ; python_full_version >= "3.8.1" and python_version < "4.0"
filelock==3.13.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
frozenlist==1.4.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
fsspec==2023.10.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
h11==0.14.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
h2==4.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
hpack==4.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
httpcore==1.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
httpx[brotli,http2,socks]==0.25.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
huggingface-hub==0.17.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
hyperframe==6.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
idna==3.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
importlib-metadata==6.8.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
jinja2==3.1.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
litellm==0.12.12 ; python_full_version >= "3.8.1" and python_version < "4.0"
lxml==4.9.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
markupsafe==2.1.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
multidict==6.0.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
numexpr==2.8.6 ; python_full_version >= "3.8.1" and python_version < "4.0"
numpy==1.24.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
openai==0.28.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
packaging==23.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
prompt-toolkit==3.0.36 ; python_full_version >= "3.8.1" and python_version < "4.0"
pycparser==2.21 ; python_full_version >= "3.8.1" and platform_python_implementation != "CPython" and python_version < "4.0"
pydantic==1.10.13 ; python_full_version >= "3.8.1" and python_version < "4.0"
python-dotenv==1.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
pyyaml==6.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
questionary==2.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
regex==2023.10.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
requests==2.31.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
sgmllib3k==1.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
sniffio==1.3.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
socksio==1.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
tiktoken==0.5.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
tokenizers==0.14.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
tqdm==4.66.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
typing-extensions==4.8.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
urllib3==2.0.7 ; python_full_version >= "3.8.1" and python_version < "4.0"
wcwidth==0.2.9 ; python_full_version >= "3.8.1" and python_version < "4.0"
yarl==1.9.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
zipp==3.17.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
--index-url https://pypi.tuna.tsinghua.edu.cn/simple

aiofiles==23.2.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiohttp==3.8.6 ; python_full_version >= "3.8.1" and python_version < "4.0"
aiosignal==1.3.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
anyio==3.7.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
appdirs==1.4.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
arxiv==1.4.8 ; python_full_version >= "3.8.1" and python_version < "4.0"
async-timeout==4.0.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
attrs==23.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
broadcast-service==1.3.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
brotli==1.1.0 ; platform_python_implementation == "CPython" and python_full_version >= "3.8.1" and python_version < "4.0"
brotlicffi==1.1.0.0 ; platform_python_implementation != "CPython" and python_full_version >= "3.8.1" and python_version < "4.0"
certifi==2023.7.22 ; python_full_version >= "3.8.1" and python_version < "4.0"
cffi==1.16.0 ; platform_python_implementation != "CPython" and python_full_version >= "3.8.1" and python_version < "4.0"
charset-normalizer==3.3.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
click==8.1.7 ; python_full_version >= "3.8.1" and python_version < "4.0"
colorama==0.4.6 ; python_full_version >= "3.8.1" and python_version < "4.0" and platform_system == "Windows"
cushy-storage==1.2.5 ; python_full_version >= "3.8.1" and python_version < "4.0"
duckduckgo-search==3.9.5 ; python_full_version >= "3.8.1" and python_version < "4.0"
exceptiongroup==1.1.3 ; python_full_version >= "3.8.1" and python_version < "3.11"
feedparser==6.0.10 ; python_full_version >= "3.8.1" and python_version < "4.0"
filelock==3.13.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
frozenlist==1.4.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
fsspec==2023.10.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
h11==0.14.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
h2==4.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
hpack==4.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
httpcore==1.0.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
httpx[brotli,http2,socks]==0.25.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
huggingface-hub==0.19.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
hyperframe==6.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
idna==3.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
importlib-metadata==6.8.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
jinja2==3.1.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
litellm==0.12.12 ; python_full_version >= "3.8.1" and python_version < "4.0"
lxml==4.9.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
markupsafe==2.1.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
multidict==6.0.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
numexpr==2.8.6 ; python_full_version >= "3.8.1" and python_version < "4.0"
numpy==1.24.4 ; python_full_version >= "3.8.1" and python_version < "4.0"
openai==0.28.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
packaging==23.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
prompt-toolkit==3.0.36 ; python_full_version >= "3.8.1" and python_version < "4.0"
pycparser==2.21 ; python_full_version >= "3.8.1" and platform_python_implementation != "CPython" and python_version < "4.0"
pydantic==1.10.13 ; python_full_version >= "3.8.1" and python_version < "4.0"
python-dotenv==1.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
pyyaml==6.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
questionary==2.0.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
regex==2023.10.3 ; python_full_version >= "3.8.1" and python_version < "4.0"
requests==2.31.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
sgmllib3k==1.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
sniffio==1.3.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
socksio==1.0.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
tiktoken==0.5.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
tokenizers==0.15.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
tqdm==4.66.1 ; python_full_version >= "3.8.1" and python_version < "4.0"
typing-extensions==4.8.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
urllib3==2.1.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
wcwidth==0.2.10 ; python_full_version >= "3.8.1" and python_version < "4.0"
yarl==1.9.2 ; python_full_version >= "3.8.1" and python_version < "4.0"
zipp==3.17.0 ; python_full_version >= "3.8.1" and python_version < "4.0"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

setuptools.setup(
name="promptulate",
version="1.9.0",
version="1.9.1",
author="Zeeland",
author_email="[email protected]",
description="A powerful LLM Application development framework.",
Expand Down

0 comments on commit 65c146a

Please sign in to comment.