Open fywang2 opened 5 months ago
you can use plugin test to verify code exection
From the error message, I can see that the response of LLM has the send_to
field assigned a wrong value which is the plugin name. In fact, it should be a role name such as User
or CodeInterpreter
. I suggest you start a new session and retry or test a different model to see if this is constant. These issues are typically caused due to the capability of the model used.
THANKS FOR YOUR APPLY!
1、Response to "start a new session and retry or test a different model to see if this is constant.": I remove the TaskWeaver docker container , then run a new TaskWeaver container based on LLM qwen-max, open a new Chrome browser, it has the same result "Exception: Unknown recipient sql_pull_mysql_data" as the same above.
2、Respose to " These issues are typically caused due to the capability of the model used.": 2.1、I switch LLM to zhipuai, the first time I ask TaskWeaver, it calls the plugin sql_pull_mysql_data to get data from mysql. It happens 'ModuleNotFoundError: No module named 'tabulate''.
sudo docker run -it \ --name taskweaver \ --privileged \ --net=host \ -e "LLM_API_KEY=4089d115fXXXX" \ -e "LLM_API_TYPE=zhipuai" \ -e "LLM_MODEL=glm-4" \ -e "LLM.EMBEDDING_MODEL=embedding-2" \ -e "LLM.EMBEDDING_API_TYPE=zhipuai" \ -e "TASKWEAVER_UID=0" \ -e "TASKWEAVER_GID=0" \ -p 8000:8000 \ -v /etc/localtime:/etc/localtime:ro \ -v /data/workspace/vscode/vscodeProjects/taskWeaverFromContaner/project:/app/project \ --entrypoint /app/entrypoint_chainlit.sh \ taskweavercontainers/taskweaver-all-in-one:latest
2024-04-17 21:46:39 - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 "
2024-04-17 21:46:39 - LLM output: sq
2024-04-17 21:46:39 - Failed to parse LLM output stream due to JSONError: failed to parse root: s
State: [('root', (True, False))] Prefix: []
2024-04-17 21:46:39 - Failed to parse LLM output due to Missing elements: send_to, message, init_plan, plan, current_plan_step in the response
element
2024-04-17 21:46:39 - Planner talk to Planner: Failed to parse LLM output due to Missing elements: send_to, message, init_plan, plan, current_plan_step in the response
element
2024-04-17 21:46:42 - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 "
2024-04-17 21:46:50 - LLM output: {"response": [{"type": "init_plan", "content": "1. Display the industrial worker projects"}, {"type": "plan", "content": "1. Use the sql_pull_mysql_data plugin to display the industrial worker projects"}, {"type": "current_plan_step", "content": "1. Use the sql_pull_mysql_data plugin to display the industrial worker projects"}, {"type": "send_to", "content": "CodeInterpreter"}, {"type": "message", "content": "Please use the sql_pull_mysql_data plugin to retrieve and display the industrial worker projects data"}]}
2024-04-17 21:46:50 - Planner talk to CodeInterpreter: Please use the sql_pull_mysql_data plugin to retrieve and display the industrial worker projects data
2024-04-17 21:46:54 - HTTP Request: POST https://open.bigmodel.cn/api/paas/v4/chat/completions "HTTP/1.1 200 "
2024-04-17 21:46:58 - LLM output: {"response": [{"type": "python", "content": "df, description = sql_pull_mysql_data(\"显示产业工人项目\")\nprint(description)\nprint(df.to_markdown())"}]}
2024-04-17 21:46:58 - Code to be verified: df, description = sql_pull_mysql_data("显示产业工人项目")
print(description)
print(df.to_markdown())
2024-04-17 21:46:58 - Code to be executed: df, description = sql_pull_mysql_data("显示产业工人项目")
print(description)
print(df.to_markdown())
2024-04-17 21:47:00 - Translation file for zh-CN not found. Using default translation en-US.
2024-04-17 21:47:04 - CodeInterpreter talk to CodeInterpreter: The following python code has been executed:
df, description = sql_pull_mysql_data("显示产业工人项目") print(description) print(df.to_markdown())
The execution of the generated python code above has failed
During execution, the following messages were logged: Traceback (most recent call last):
File /usr/local/lib/python3.10/site-packages/pandas/compat/_optional.py:135 in import_optional_dependency module = importlib.import_module(name)
File /usr/local/lib/python3.10/importlib/init.py:126 in import_module return _bootstrap._gcd_import(name[level:], package, level)
File
File
File
ModuleNotFoundError: No module named 'tabulate'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
Cell In[1], line 1 df, description = sql_pull_mysql_data("显示产业工人项目")
File /tmp/tmpwxhr90fi/sql_pull_mysql_data.py:28 in call
File /usr/local/lib/python3.10/site-packages/pandas/util/_decorators.py:333 in wrapper return func(*args, **kwargs)
File /usr/local/lib/python3.10/site-packages/pandas/core/frame.py:2983 in to_markdown tabulate = import_optional_dependency("tabulate")
File /usr/local/lib/python3.10/site-packages/pandas/compat/_optional.py:138 in import_optional_dependency raise ImportError(msg)
ImportError: Missing optional dependency 'tabulate'. Use pip or conda to install tabulate. ': '测试项目bbbbbbbbbb', '项目所在地区': '广州', '项目状态': None}, {'编码': 17, '项目名称': '测试项目2', '项目所在地区': 'CS001', '项目状态': None}, (omit some json data)
(omit another round output)
2.2、I remove the TaskWeaver docker container , then run a new TaskWeaver container based on LLM zhipuai, pip install tabulate, open a new Chrome browser, it has the result "Exception: Unknown recipient sql_pull_mysql_data" as the same above.
Installing pymysql,tabulate in the Docker container: docker exec -it taskweaver /bin/bash pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple pip install pymysql pip install tabulate
TaskWeaver Exception: 2024-04-17 21:50:54 - Traceback (most recent call last): File "/app/playground/UI/../../taskweaver/session/session.py", line 194, in _send_text_message post = _send_message(post.send_to, post) File "/app/playground/UI/../../taskweaver/module/tracing.py", line 174, in wrapper return func(*args, **kwargs) File "/app/playground/UI/../../taskweaver/session/session.py", line 182, in _send_message raise Exception(f"Unknown recipient {recipient}") Exception: Unknown recipient sql_pull_mysql_data
Thanks for the detailed experiements. When I said 'a new session', I mean you just need to create a new session by clicking the web page to create a new one, not necessary to remove and download the container again, which need more effort.
From your observations, the 2.1 looks good except that the missing dependency issue. The key part is that the LLM output (shown below) contains the send_to
field and its content should be CodeInterpreter and should not be the name of the plugin, i.e., sql_pull_mysql_data.
{"response": [{"type": "init_plan", "content": "1. Display the industrial worker projects"}, {"type": "plan", "content": "1. Use the sql_pull_mysql_data plugin to display the industrial worker projects"}, {"type": "current_plan_step", "content": "1. Use the sql_pull_mysql_data plugin to display the industrial worker projects"}, {"type": "send_to", "content": "CodeInterpreter"}, {"type": "message", "content": "Please use the sql_pull_mysql_data plugin to retrieve and display the industrial worker projects data"}]}
I don't know why this happens so frequently and we haven't seen this error before using GPT3.5 or GPT4. We don't have access to other models so not able to try them. One thing you can check is the prompt inside the project folder, i.e., project/workspace/sessions/session_id/planner_prompt_log_xxxx.json
where you can find the prompt sending to the model. I'm not sure if the definition of the plugin has interference to the prompt so that the model missunderstand it as a character instead of a plugin.
1、Docker host operating system:ubuntun 22.04 desktop
2、Run TaskWeaver using the All-in-One Docker Image:
3、plugin file: sql_pull_mysql_data.py
4、plugin file: sql_pull_mysql_data.yaml
5、Installing pymysql in the Docker container
6、When asking “显示产业工人项目”,Taskweaver execute the plugin sql_pull_mysql_data, then the backend execption logs: